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.

Add ability to disable default responses

See original GitHub issue

I 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:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
bnasslahsencommented, Mar 30, 2021

@pohorilyi,

According to the demo, springdoc reflects the http responses that are available on the code:

  • If you have seen the demo in details: HTTP 200 comes from the controller
  • HTTP 400 code comes from a global exception handler.

By default: springdoc automatically adds @ControllerAdvice responses to all the generated responses. If you want disable this, you have:

springdoc.override-with-generic-response= false

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.

0reactions
istibekesicommented, Apr 20, 2022

@bnasslahsen Is it possible to keep default response configuration true and hide some of them on specific endpoints with @ApiResponse?

Read more comments on GitHub >

github_iconTop 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 >

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