fix: resolve Validation Meta annotations not working (#4886) #4986
+137
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request
Thank you for contributing to swagger-core!
Please fill out the following information to help us review your PR efficiently.
Description
This PR fixes an issue where Validation Meta annotations were not being correctly recognized by the
ModelResolver
.Problem
When developers use composed validation annotations (for example, a custom
@MyNotBlank
built on top of@NotBlank
), swagger-core failed to introspect these Meta annotations, causing validation metadata to be lost in generated models.Solution
Enhanced
ModelResolver
to introspect and apply Meta annotations properly.A new test class
ComposedConstraintMetaAnnotationTest
verifies correct handling of composed constraint annotations.Fixes: #4886
Type of Change
Checklist
mvn clean test
/gradle test
)Screenshots / Additional Context
Verified that composed constraint annotations are now detected and applied.
No regressions in direct annotation handling.
Affected files:
modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java
modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/ComposedConstraintMetaAnnotationTest.java