Skip to content

Summary endpoint RestControllerEndpoint #1886

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
sbernardo opened this issue Oct 13, 2022 · 1 comment
Closed

Summary endpoint RestControllerEndpoint #1886

sbernardo opened this issue Oct 13, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@sbernardo
Copy link

Hello,
I was implementing a custom actuator with @RestControllerEndpoint. I wanted to add documentation on my actuator and the summary setting doesn't work properly.

Below an example with screen

Example Application to reproduce
Main class

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class SampleApplication {

    public static void main(String[] args) {
        SpringApplication.run(SampleApplication.class, args);
    }

}

Actuator annotation @endpoint

import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
import org.springframework.stereotype.Component;

@Component
@Endpoint(id = "basic")
public class EnpointBasic {

    @ReadOperation
    public boolean testEndpoint() {
        return true;
    }

}

Actuator annotation @RestControllerEndpoint

import io.swagger.v3.oas.annotations.Operation;
import org.springframework.boot.actuate.endpoint.web.annotation.RestControllerEndpoint;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import javax.validation.constraints.NotNull;

@Component
@RestControllerEndpoint(id = "rest")
public class EndpointRestController {

    @Operation(description = "Example description", summary = "Summary description")
    @PostMapping(path = "/example/{id}", consumes = "plain/text")
    public String exampleRest(@PathVariable @NotNull String id,
                              @RequestBody String body) {
        return body;
    }

}

Versions:
Springboot 2.7.3
Spring openapi 1.6.11

Maven dependencies:

<dependencies>
       <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <version>2.7.3</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
            <version>2.7.3</version>
        </dependency>
        <dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-ui</artifactId>
            <version>1.6.11</version>
        </dependency>
</dependencies>

application.properties

management.endpoints.web.exposure.include=basic,rest
springdoc.show-actuator=true

SwaggerUI:

immagine

Summary field of @operation annotation is ignored and showed other.

@bnasslahsen bnasslahsen added the enhancement New feature or request label Oct 14, 2022
@bnasslahsen
Copy link
Collaborator

fixed by #1888

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants