question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@ApiResponse response parameter not used in 3.0.0

See original GitHub issue

Starting with 3.0.0 (in 2.9.2 it worked properly)

@ApiResponse(code = 404, message = "Not Found", response = CustomError::class)

The 404 - Not Found is in the documentation, but the defined response (CustomError in example) not shown in the generated documentation (response sample and model)

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:9
  • Comments:13 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
gonwancommented, Sep 1, 2020

Same issue here. After some debugging, root cause should be: https://github.com/springfox/springfox/blob/07a4c86d70b791f21c2d2f656a863920b8c883c7/springfox-swagger2/src/main/java/springfox/documentation/swagger2/mappers/ServiceModelToSwagger2Mapper.java#L117

Springfox 3.0 uses v3 models by default, but source.getResponses() gives wrong type. To workaround it for now, add: springfox.documentation.swagger.use-model-v3=false in your application.properties.

3reactions
drognisepcommented, Jan 19, 2021

To workaround it for now, add: springfox.documentation.swagger.use-model-v3=false

The prescribed workaround doesn’t seem to work for ResponseEntity<?> return types. I’m not sure if that’s a separate issue or if it’s part and parcel to this bug.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Describing Responses - Swagger
In OpenAPI 3.0, you can use oneOf to specify alternate schemas for the response and document possible dependencies verbally in the response description...
Read more >
<Spring Boot / Springfox> Swagger UI not showing example ...
In the case of using the springdoc-openapi-ui (>=1.5.0) here is my working sample to show example data in the request and response sections ......
Read more >
Documenting a Spring REST API Using OpenAPI 3.0 - Baeldung
Learn how to generate OpenAPI 3.0 specifications for a Spring REST API using SpringDoc.
Read more >
F.A.Q - Springdoc-openapi
You can use the same swagger properties in the documentation as Spring Boot ... description = "Not found", content = @Content), @ApiResponse(responseCode ...
Read more >
Springfox Reference Documentation - GitHub Pages
For non-boot applications springfox-swagger-ui is no longer ... and indicate that it will use the response model Error (which will be ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found