Skip to content

ModelResolver.enumAsRef = true result in invalid openapi with actuator using enum param #2905

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
christophejan opened this issue Feb 18, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@christophejan
Copy link

When ModelResolver.enumAsRef = true (like described here), the resulting openapi contains invalid reference on actuator using enum parameter.

The spring boot loggers actuator endpoint write / post operation, for example, is in that case.

Here a sample of the resulting openapi :

{
  "paths": {
    "/actuator/loggers/{name}": {
      "post": {
        "tags": [
          "Actuator"
        ],
        "summary": "Actuator web endpoint 'loggers-name'",
        "operationId": "configureLogLevel",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LogLevel"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "No Content"
          },
          "400": {
            "description": "Bad Request"
          }
        }
      }
    }
  }
}

The issue is that LogLevel doesn’t exist in /components/schemas and so the resulting openapi is invalid.

@bnasslahsen bnasslahsen added the bug Something isn't working label Mar 20, 2025
@christophejan
Copy link
Author

Great ! Thx @bnasslahsen !

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants