I have the following:
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Path("/some/path")
void createSomething(@ApiParam(required = true) @Valid final User user);
And User is something like
class User {
@Valid
@NotNull
@NotBlank
final String name;
...
}
I do get back 400 if I do curl -X POST -H "Content-Type: application/json" /some/path -d '{"foo":"bar"}'.
However, if I do not send any thing, then I do not get 400, i.e curl -X POST -H "Content-Type: application/json" /some/path does not result in 400 (and later results in 500 cause the object user is now null.
What am I doing wrong?