Questions tagged [jakarta-validation]

6 questions
3
votes
2 answers

How to put validation on list of String coming from request in spring boot?

I am creating Spring boot APIs and one of the API consumening data below: class DataRequest{ @Size(min=1, max=10) private String dataTitle; private List emails; } How can we validate List like all strings must be valid emails…
Nitin
  • 2,701
  • 2
  • 30
  • 60
2
votes
0 answers

Jakarta / Spring Validation of Contained Values in Kotlin

I'm running into an issue validating values via a Spring Boot 3 REST API. More specifically, I need to validate the contained values within a List Param. Here's my API: @GetMapping fun getHelloWorld( @Valid queryParams: HelloWorldQueryParams, ):…
TheJeff
  • 3,665
  • 34
  • 52
0
votes
1 answer

Validating class which cannot be modified by add new annotations

the model is generated by some tools. Particular fields are annotated by for instance @NotNull annotation. I cannot modify generated classes. I need to do additonal validation of generated classes like check that value of the string field does't…
tomasz-mer
  • 3,753
  • 10
  • 50
  • 69
0
votes
1 answer

Dynamic Validation message in Constraint Validation of Enums

I was trying to Validate the Enum before Request Processing, EnumValidator.java @Target({ElementType.FIELD, ElementType.PARAMETER}) @Retention(RetentionPolicy.RUNTIME) @Constraint(validatedBy = EnumValidatorImpl.class) public @interface…
0
votes
0 answers

How to disable auto validation of request in Spring boot controller

I have some DTO object with validation annotations: MyDto { @NotBlank(message = "subscription name is empty") @Size(max = Constants.SUBSCRIPTION_NAME_MAX_LENGTH, message = "size must not exceed 64 symbols") String name; } Also I have wrapper class…
Aslan
  • 21
  • 5
0
votes
2 answers

using multiple validation on same attribute and stop on first failure

Java: 20 Springboot: 3.0.1 @NotBlank(message = "userId id can not be blank.") @NotEmpty(message = "userId id can not be empty.") @UUID @User private String userId; now in request, I am not passing userId, I am getting any of the 4 validation error,…