Skip to content

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

Closed
@christophejan

Description

@christophejan

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions