-
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
@Size
annotation on List<String>
causes incorrect openapi spec to be generated.
#4462
Comments
It seems this bug was introduced in version 2.2.13 and still exists in 2.2.15 (currently latest version). |
the problematic part (introduced in #4429) if (annotatedType.getCtxAnnotations() != null) {
strippedCtxAnnotations.addAll(Arrays.stream(
annotatedType.getCtxAnnotations()).filter(
ass -> !ass.annotationType().getName().startsWith("io.swagger")
).collect(Collectors.toList()));
} where annotatedType is, in this case, @frantuma any suggestion how we can resolve this regression? |
Thanks for reporting and analyzing this! It has been addressed in #4500 by excluding also |
Thank you! Quick question based on the PR: will this also work for jakarta.validation? javax.validation is effectively deprecated now I believe? |
yes it will |
Do you know already when will the next release be? |
no fixed ETA but should be next 1-2 days |
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [nu.ndw.nls:routing-map-matcher-spring-boot](https://spring.io/projects/spring-boot) ([source](https://github.com/spring-projects/spring-boot)) | compile | patch | `7.6.0` -> `7.6.1` | | [io.swagger.core.v3:swagger-annotations](https://github.com/swagger-api/swagger-core) | compile | patch | `2.2.17` -> `2.2.19` | | [org.openapitools:openapi-generator-maven-plugin](https://github.com/openapitools/openapi-generator) | build | minor | `7.0.1` -> `7.1.0` | | [org.keycloak:keycloak-authz-client](http://keycloak.org) ([source](https://github.com/keycloak/keycloak)) | test | patch | `22.0.4` -> `22.0.5` | --- ### Release Notes <details> <summary>swagger-api/swagger-core (io.swagger.core.v3:swagger-annotations)</summary> ### [`v2.2.19`](https://github.com/swagger-api/swagger-core/releases/tag/v2.2.19): Swagger-core 2.2.19 released! [Compare Source](swagger-api/swagger-core@v2.2.18...v2.2.19) - give precedence to requiredMode annotation ([#​4533](swagger-api/swagger-core#4533)) - update dependencies ([#​4521](swagger-api/swagger-core#4521)) - Bump org.apache.maven.plugins:maven-source-plugin from 3.2.1 to 3.3.0 ([#​4513](swagger-api/swagger-core#4513)) - add deps update CI ([#​4509](swagger-api/swagger-core#4509)) ### [`v2.2.18`](https://github.com/swagger-api/swagger-core/releases/tag/v2.2.18): Swagger-core 2.2.18 released! [Compare Source](swagger-api/swagger-core@v2.2.17...v2.2.18) - refs [#​4483](swagger-api/swagger-core#4483) - fix NullPointer for [@​ApiResponse](https://github.com/ApiResponse) missing description ([#​4501](swagger-api/swagger-core#4501)) - refs [#​4462](swagger-api/swagger-core#4462) - exclude javax.validation annotations from container values processing ([#​4500](swagger-api/swagger-core#4500)) - Update README.md versions list ([#​4493](swagger-api/swagger-core#4493)) - feat: add getUseFqn to TypeNameResolver ([#​4484](swagger-api/swagger-core#4484)) </details> <details> <summary>openapitools/openapi-generator (org.openapitools:openapi-generator-maven-plugin)</summary> ### [`v7.1.0`](https://github.com/OpenAPITools/openapi-generator/releases/tag/v7.1.0): released [Compare Source](OpenAPITools/openapi-generator@v7.0.1...v7.1.0) v7.1.0 is the first release [with breaking changes (with fallback)](https://github.com/OpenAPITools/openapi-generator/pulls?q=is%3Amerged+is%3Apr+milestone%3A7.1.0+label%3A%22Breaking+change+%28with+fallback%29%22+) after the major release v7.0.0 in Aug 2023. Breaking changes with f...
Hopefully this is the correct library to handle this issue; I was referred here from springdoc/springdoc-openapi#2337 -- apologies if I got it wrong.
Using a simple DTO can reproduce this issue:
The
@Size
validation is only (correctly) applied to the list size. However, the api spec itself is showing this:Essentially, the API spec is stating that:
You can also see that the description is also being duplicated from the array down to the element as well. I am uncertain if this is intentional and or desirable so not sure if that should also be considered a bug as well.
Note that the actual runtime validation is only applied to point1 above (correct behavior IMO).
Point2 is not enforced by the validator at runtime even though the generated API spec is indicating that the string should be between 1 and 5 characters in length.
This also just started occurring when we updated springdoc-openapi-starter-webmvc-ui to 2.2.0 (from 2.1.0).
The text was updated successfully, but these errors were encountered: