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

override-with-generic-response not working from 1.6.8 onwards #1791

Closed
ahopgood opened this issue Aug 16, 2022 · 0 comments
Closed

override-with-generic-response not working from 1.6.8 onwards #1791

ahopgood opened this issue Aug 16, 2022 · 0 comments

Comments

@ahopgood
Copy link

Describe the bug
When using the springdoc.override-with-generic-response=true property after version 1.6.7 methods annotated with @ResponseStatus and @ExceptionHandler are no longer included in the swagger definition.

This applies for handler methods inside either the @RestController class or a @ControllerAdvice class for handling global exceptions.

To Reproduce
Steps to reproduce the behavior:

openapi: 3.0.1
info:
  title: Hello API
  description: An API for saying hello.
  version: 1.0-SNAPSHOT
servers:
- url: http://0.0.0.0:8080
  description: Generated server url
tags:
- name: Hello Api
paths:
  /api/hello:
    get:
      tags:
      - Hello Api
      summary: Says hello
      operationId: getHello
      responses:
        "200":
          description: OK
          content:
            text/plain:
              schema:
                type: string
components: {}

Expected behavior

  • It is expected that every @ExceptionHandler method that is annotated with @ResponseStatus should show as a response for every API path in the swagger doc when springdoc.override-with-generic-response=true
  • Expected output
openapi: 3.0.1
info:
  title: Hello API
  description: An API for saying hello.
  version: 1.0-SNAPSHOT
servers:
- url: http://0.0.0.0:8080
  description: Generated server url
tags:
- name: Hello Api
paths:
  /api/hello:
    get:
      tags:
      - Hello Api
      summary: Says hello
      operationId: getHello
      responses:
        "403":
          description: Forbidden
          content:
            '*/*':
              schema:
                type: string
        "500":
          description: Internal Server Error
          content:
            '*/*':
              schema:
                type: string
        "200":
          description: OK
          content:
            text/plain:
              schema:
                type: string
components: {}

Screenshots
Here is an example of the expected output where the errors are shown in the endpoint documentation:
swagger-error-statuses

When using 1.6.8 or above the error statuses are missing:
swagger-no-errors

Additional context
Add any other context about the problem here.

bnasslahsen added a commit that referenced this issue Aug 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant