-
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
Adding class level @ApiResponse
removes default response, and results in NullPointerException
when adding an ApiResponse
with useReturnTypeSchema
#4483
Comments
Thanks for reporting this!
It's indeed intended even if opinionated. a
The exception is indeed a bug (fixed in #4501), however the current logic ONLY generates a response given an In your case you would get the expected result (with no NPE also with latest release version) using
Closing ticket, please reopen if still experiencing issues |
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...
When adding (an array of)
@ApiResponse
at the class level in order to define common error responses, the default responses for the methods from that class disappear from the generated schema (the ones that contain the response based on the method's return type).For example:
Without class level
@ApiResponse
:With class level
@ApiResponse
:This may or may not be intended behaviour , but trying to add
@ApiResponse(useReturnTypeSchema = true)
or@ApiResponse(useReturnTypeSchema = true, responseCode = "200")
to either the class, the method or theresponses
field of the@Operation
annotation results in the following NPE:This was observed on at least 2.2.15 and 2.2.16
The text was updated successfully, but these errors were encountered: