Details
Assignee
UnassignedUnassignedReporter
Vojtěch KnyttlVojtěch KnyttlLabels
Bug Testcase Reminder (view)
Bug reports should generally be accompanied by a test case!
Bug Testcase Reminder (edit)
Bug reports should generally be accompanied by a test case!
Participants
Vojtěch KnyttlAffects versions
Priority
Major
Details
Details
Assignee
Unassigned
UnassignedReporter
Vojtěch Knyttl
Vojtěch KnyttlLabels
Bug Testcase Reminder (view)
Bug reports should generally be accompanied by a test case!
Bug Testcase Reminder (edit)
Bug reports should generally be accompanied by a test case!
Participants
Vojtěch Knyttl
Affects versions
Priority
Created October 26, 2021 at 4:24 PM
Updated December 10, 2024 at 12:14 PM
The validation for `List<@Size(min = 1) String>` is not working in Kotlin.
data class Pet( @get:Size(min = 1, max = 16) val name: String, @get:Valid // @Size parameter seems to be ignored val labels: List<@Size(min = 1, max = 16) String>, ) fun main() { val validator = Validation .byDefaultProvider() .configure() .messageInterpolator(ParameterMessageInterpolator()) .buildValidatorFactory() .validator // correctly fails with: [ConstraintViolationImpl{interpolatedMessage='size must be between 1 and 16', propertyPath=name, rootBeanClass=class net.goout.entitystorage.services.Pet, messageTemplate='{javax.validation.constraints.Size.message}'}] println(validator.validate(Pet(name = "", labels = listOf("Naughty")))) // false negative, should fail, returns: [] println(validator.validate(Pet(name = "Jane", labels = listOf(""))))}
See the comments in the code above.