Iain Cambridge
06/23/2020, 4:00 PMdata class Credential(
@field:JsonProperty("country_code")
@field:Pattern(regexp = "^[A-Z]{2}$", message = "country_code must be a string of 2 capital letters i.e. DE")
val countryCode: String? = null,
)
With
fun registerCredentials(@Validated @RequestBody credential: Credential):Credential{
//...
}
I've tried @Valid
and that doesn't work either. I don't get any error, I just ged a object with null values.Thiago Nerys
06/23/2020, 4:58 PMhibernate validator
in the classpath?
https://mvnrepository.com/artifact/org.hibernate/hibernate-validatorIain Cambridge
06/23/2020, 5:04 PMspring-boot-starter-validation
and I now get validation errors 😄