Skip to content
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

Can't overwrite the pre-defined response model by another one using @ApiResponse(response = ...) #4039

Closed
3 tasks done
olyakrasnozhon opened this issue Nov 28, 2022 · 2 comments
Labels

Comments

@olyakrasnozhon
Copy link

olyakrasnozhon commented Nov 28, 2022

The question hasn't been asked or answered. The issue: Swagger 3.0.0 doesn't allow to overwrite the global response model that we defined in "createDocket()" method by using @ApiResponse(response = SomeErrorModel.class). We have a different responses types for the same error (500) and can't go with a common response model for this error.

  • What version of the library are you using? Is it the latest version? The latest released version is Download

Our dependencies: springfox-swagger2 3.0.0, springfox-swagger-ui 3.0.0, spring-plugin-core 2.0.0.RELEASE.

What kind of issue is this?

  • Question. Is this a question about how to do a certain thing? Yes, please describe how to set response model for specific error in @ApiResponse annotation ("response" parameter doesn't work anymore)?

  • Feature Request. Could you please re-add the option to define the response model (not example value) in @ApiResponse annotation like it worked in Swagger 2.x.x? We'd not like to stay with the deprecated classes (ModelRef, ResponseMessage, ResponseMessageBuilder) to have this functionality.

Expected usage:

@ApiResponses(value = {
@ApiResponse(code = 200, message = "Ok", response = SomeOutDto.class),
@ApiResponse(code = 204, message = "No Content"),
@ApiResponse(code = 401, message = "Invalid JWT"),
@ApiResponse(code = 404, message = "Bad request"),
@ApiResponse(code = 500, message = "Internal server error", response = OurCustomErrorResponseModel.class)

Thanks!
Best regards,
Olya

@stale
Copy link

stale bot commented Apr 26, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Apr 26, 2023
@stale
Copy link

stale bot commented May 20, 2023

This issue has been automatically closed because it has not had recent activity. Please re-open a new issue if this is still an issue.

@stale stale bot closed this as completed May 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant