Skip to content

Missing Request Body for Write Operation Actuator Endpoints #1565

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

Closed
mathieu-amblard opened this issue Mar 21, 2022 · 2 comments
Closed

Missing Request Body for Write Operation Actuator Endpoints #1565

mathieu-amblard opened this issue Mar 21, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@mathieu-amblard
Copy link
Contributor

mathieu-amblard commented Mar 21, 2022

Describe the bug
After adding springdoc.show-actuator=true, I can see all the actuator endpoints 👍 but I cannot see the Request Body field for the @WriteOperation endpoints (for example https://github.com/spring-projects/spring-boot/blob/47516b50c39bd6ea924a1f6720ce6d4a71088651/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/logging/LoggersEndpoint.java#L99).
In the following class it seems that only parameters are managed :

public class ActuatorOpenApiCustomizer implements OpenApiCustomiser {

To Reproduce
Steps to reproduce the behavior:

  • What version of spring-boot you are using? Tried with 2.5.10 and 2.6.4
  • What modules and versions of springdoc-openapi are you using? Tried with 1.6.2 and 1.6.6
        <dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-webmvc-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-ui</artifactId>
        </dependency>
  • What is the actual and the expected result using OpenAPI Description (yml or json)?
"post": {
    "tags": ["Actuator"],
    "summary": "Actuator web endpoint 'loggers-name'",
    "operationId": "loggers-name_7",
    "parameters": [{
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
                "type": "string"
            }
        }
    ],
    "responses": {...},
}

Expected behavior

  • A clear and concise description of what you expected to happen.
    We expect to have the Request Body field in case of @WriteOperation if it is possible as there is not @RequestBody annotation.
  • What is the expected result using OpenAPI Description (yml or json)?
    Something like this for the LoggersEndpoint :
"post": {
    "tags": ["Actuator"],
    "summary": "Actuator web endpoint 'loggers-name'",
    "operationId": "loggers-name_7",
    "parameters": [{
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
                "type": "string"
            }
        }
    ],
    "requestBody": {
        "content": {
            "application/json": {
                "schema": {
                    "type": "object",
                    "properties": {
                        "configuredLevel": {
                            "type": "string",
                            "required": true
                        }
                    }
                }
            }
        },
        "required": true
    },
    "responses": {...},
}
@bnasslahsen
Copy link
Collaborator

@mathieu-amblard,

I have added a fix, to handle this case out of the box.
Feel free to test with the latest SNAPSHOT and provide your feedback.

@bnasslahsen bnasslahsen added the bug Something isn't working label Mar 21, 2022
@mathieu-amblard
Copy link
Contributor Author

I works well, thank you for the fix and for your reactivity 👍

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

No branches or pull requests

2 participants