spring-projects / spring-hateoas

Spring HATEOAS - Library to support implementing representations for hyper-text driven REST web services.
https://spring.io/projects/spring-hateoas
Apache License 2.0
1.03k stars 475 forks source link

UriTemplate does not allow spinal-case/kebab-case #972

Closed aaiezza closed 5 years ago

aaiezza commented 5 years ago

The UriTemplate cannot successfully identify a query parameter with hyphens in it.

Example: https://api.app.com/user{?send-verification-email} RFC 6570 does not discourage this type of syntax, though sadly does not give an example of it. However, I think it should be made allowed.

I would propose that the new regex for identifying templated uris be:

\{([\?\&#/]?)([\w\-\,*]+)\}
odrotbohm commented 5 years ago

According to the RFC, dashes are not allowed in variable names.

gregturn commented 5 years ago

Duplicates #799.

aaiezza commented 5 years ago

@gregturn you're raining on my parade here 😂 Thank you for pointing it out. As it happens, I now have comments for the "Request for Comments" RFC.

On another note, should longer variable names use underscores then or camel case?