Environment: Dropwizard 0.8.1, Java 1.8
I can't get Dropwizard's validation support to do anything. I believe I'm following what the manual suggests. Using the following resource, for example (and many variants using @Valid on the model class attributes, @Validated instead of @Valid, hibernate's @NotEmpty instead of javax.validation.constraints.NotNull, etc):
@Path("/test")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public class TestResource {
static public class ModelClass {
@JsonProperty("only_null") @Null public String onlyNull;
@JsonProperty("not_null") @NotNull public String notNull;
}
@PUT
public ModelClass testContainer(@Valid ModelClass record) {
return record;
}
}
If I PUT the following:
{"only_null":"shouldFail"}
rather than the expected 422, I get back:
{"only_null":"shouldFail","not_null":null}
What am I missing here? Is there some configuration that needs to be turned on to enable the validation?