Add ability to disable default responses
See original GitHub issueI want to migrate from SpringFox library to SpringDoc. In my SpringFox configuration, I have disabled default response messages:
@Bean
public Docket publicApi(ServletContext servletContext) {
Docket docket = new Docket(DocumentationType.SWAGGER_2)
...
.useDefaultResponseMessages(false);
But I can’t find a way to do it in SpringDoc. Migration guide says “remove Docket and use application.properties instead”. But there is no such property.
Solution I’d like
- Posibility to disable default responses as a property in application.properties
- Expected result using OpenAPI Description - json
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Add an option to disable default sample · Issue #1490 - GitHub
I'd like to write examples which represent real use cases in the OpenAPI definition and leave unimportant responses/responses without sample.
Read more >Disable default response massages SpringDoc Open API 3
In order to disable responses described in @ControllerAdvice you should add springdoc.override-with-generic-response=false.
Read more >Remove the default canned response - Atlassian Community
Solved: We have upgraded to Service desk 4 and we have noticed the new canned response when adding a comment. The default seems...
Read more >Preventing Reply All - Microsoft Support
A custom form is a basic way to add restrictions to whether e-mail recipients can forward or reply to all recipients of a...
Read more >Remove "default" Response Message from Swagger UI
You can change default response to 200 by using OpenApiOperation filters. Plugins.Add(new OpenApiFeature { OperationFilter = (verb, op) => { var ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@pohorilyi,
According to the demo, springdoc reflects the http responses that are available on the code:
By default: springdoc automatically adds @ControllerAdvice responses to all the generated responses. If you want disable this, you have:
Note that mainly: springdoc-openapi reflects the http codes that are available on your code. And this can be customized, if you use
@ApiResponse
annotations.@bnasslahsen Is it possible to keep default response configuration
true
and hide some of them on specific endpoints with@ApiResponse
?