Skip to content

Conversation

@mschout
Copy link
Contributor

@mschout mschout commented Apr 18, 2024

Since e893628, some error response types referenced by the schema in $ref's were missing from the spec.

For example, we have a custom error response type that gets returned via @ControllerAdvice when we throw a specific exception type. In v2.3.0, these were correctly included in the OpenAPI spec. Starting in v2.4.0 these were missing, creating an invalid schema.

e.g.:

"400": {
            "description": "Bad Request",
            "content": {
              "*/*": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/BadRequestExceptionResponse"
                    },
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    }
                  ]
                }
              }
            }

and then later down, we should have BadRequestExceptionResponse in the spec under .compoents.schemas like this:

"BadRequestExceptionResponse": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          }
        }
      },

Quick git bisect revealed that this broke in e893628. I don't fully know the logic behind that commit, but the attached pull request gets the missing items back in the schema for us by changing how the ObjectMapper is constructed back to the way it was before e893628

Since e893628, some error response
types referenced by the schema in `$ref`'s were missing from the
spec.
@bnasslahsen bnasslahsen merged commit c3a76c8 into springdoc:main Jun 15, 2024
@bnasslahsen
Copy link
Collaborator

@mschout,

Thank you for your contribution to the project!

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

Successfully merging this pull request may close these issues.

2 participants