Bean Validation annotations are ignored if class is in dependency
See original GitHub issueI’ve found a very strange issue.
I have two projects.
- Spring Boot App with Hilla
- Simply dependency with classes with Bean Validation annotations
The generator only generates the Model correctly for project 1 but not for project 2.
I assume the generator scans the source code, not the class files.
Example
public class Animal {
@NotBlank
@Email
private String email;
is generated as
export default class AnimalModel<T extends Animal = Animal> extends ObjectModel<T> {
static createEmptyValue: () => Animal;
get email(): StringModel {
return this[_getPropertyModel]('email', StringModel, [true]);
}
}
Issue Analytics
- State:
- Created a year ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
javax validation constraints annotations are ignoring during ...
For classes annotations, I use this: @Documented @Constraint(validatedBy = RestrictionsAreValidImpl.class) @Target(ElementType.
Read more >Bean Validation annotations ignored · Issue #987 - GitHub
I see this is in swagger-core maven module which I would say SpringFox project does not add as a dependency... That is a...
Read more >Hibernate Validator 8.0.0.Final - Jakarta Bean Validation ...
When applying constraints on an Iterable type argument, Hibernate Validator will validate each element. Example 2.3, “Container element ...
Read more >Chapter 18. Bean Validation Support
Validation is a process of verifying that some data obeys one or more pre-defined constraints. This chapter describes support for Bean Validation in...
Read more >Bean Validation specification
A constraint is said to be cross-parameter if it has one constraint validator targeting the array of parameters of a method or constructor...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The original reason for parsing sources is that we wanted to carry over method parameter names and JavaDocs to the generated TS. The new architecture uses bytecode as the main input and then supplements with additional details from sources if available.
That’s what version 1.2 does.