Describe the bug
When defining a REST Endpoint with an UUID parameter, non-UUID values in HTTP Requests will lead to a 404 Not Found response instead of the (in our case) expected 400 Bad Request.
This seems strange to me.
Reasoning:
A malformed UUID is bad data (400 Bad Request).
The endpoint, based on the URL mapping, exists (Not 404 Not Found).
Expected behavior
Return 400 for invalid path param data
Actual behavior
Returns 404, regardless of existing resource
To Reproduce
Do a call with invalid path param data to a path param endpoint
​
e.g.
​
http://localhost:8080/sample/1234, even though only a valid UUID is accepted
​
I've added a link to an example, in which a valid UUID call (http://localhost:8080/sample/Random-UUID) returns the passed UUID and an invalid UUID (http://localhost:8080/sample/1234) returns a 404 Not Found.
@nakhadon Hi - this may seem non-intuitive but this is the spec, see section 3.2, example here https://github.com/jax-rs/spec/blob/master/spec.pdf.
You can control the status yourself, have path param be a String and return 400 in case of invalid UUID
Thanks, closing this issue
I see. @sberyozkin thank you for the helpful and fast reply!
Most helpful comment
@nakhadon Hi - this may seem non-intuitive but this is the spec, see section 3.2, example here https://github.com/jax-rs/spec/blob/master/spec.pdf.
You can control the status yourself, have path param be a String and return 400 in case of invalid UUID
Thanks, closing this issue