-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG @Pattern on type parameter of properties using collections is ignored when using oas 3.1.0 #4703
Comments
micryc
added a commit
that referenced
this issue
Sep 16, 2024
frantuma
pushed a commit
that referenced
this issue
Sep 16, 2024
micryc
added a commit
that referenced
this issue
Sep 18, 2024
micryc
added a commit
that referenced
this issue
Sep 19, 2024
micryc
added a commit
that referenced
this issue
Sep 19, 2024
micryc
added a commit
that referenced
this issue
Sep 19, 2024
@Lorenzo-Bracci thank you for reporting this issue. Fixed by: #4734 and will be part of next release |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem
When generating OpenAPI 3.1.0 spec the
@Pattern
annotation on a type parameter of properties with a collection type are ignored. The expected behaviour is that the generated property has thepattern
property set for theitems
schema but nopattern
is found in the generated open api.This issue is similar to #4702
Expected behaviour
@Pattern#regexp
is used to generatepattern
property for theitems
schema of the propertyReproducer
The issues is reproduced in the following test:
Investigation with proposed solution
Looking at the
ModelResolver.applyBeanValidatorAnnotations
code (which is where information from bean validation annotations are processed), the@Pattern
annotation is processed only if theproperty
input parameter of typeSchema
is an instance ofStringSchema
or ifproperty.getItems()
is an instance ofStringSchema
. If the check succeeds then the information from@Pattern
is propagated to the generated schema (using thepattern
property). Nevertheless for open api 3.1.0property.getItems()
will be of typeJsonSchema
instead ofStringSchema
and therefore the information from@Pattern
will not be used. A possible solution would be that instead of using doing aninstanceOf
check againstStringSchema
a check is performed on thetype
/types
fields to ensure that the property is a string schema.The text was updated successfully, but these errors were encountered: