Skip to content

Duplicate tags if they are defined on @Operation annotation on swagger-ui #436

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
jamataran opened this issue Feb 17, 2020 · 2 comments
Closed
Labels
question Further information is requested

Comments

@jamataran
Copy link

Describe the bug
Duplicate definition when the annotations are given in the interface.

To Reproduce

  1. Define the Interface
public interface AperturaCasoAPI {


    @Operation(summary = "Creación de un nuevo caso",
            tags = {"apertura"},
            requestBody = @RequestBody(description = "Datos del caso", required = true),
            responses = {
                    @ApiResponse(
                            content = @Content(
                                    mediaType = "application/json",
                                    schema = @Schema(implementation = AperturaOutDTO.class))),
                    @ApiResponse(responseCode = "400", description = "Invalid ID supplied"),
                    @ApiResponse(responseCode = "404", description = "Pet not found"),
                    @ApiResponse(responseCode = "405", description = "Datos de entrada incorrectos")}
    )
    ResponseEntity<AperturaOutDTO> apertura(AperturaInDTO aperturaIn);

}
  1. Implement the interface
@RestController
@RequestMapping(value = "/apertura")
public class AperturaCasoRestController implements AperturaCasoAPI {

    @Override
    @PostMapping
    public ResponseEntity<AperturaOutDTO> apertura(AperturaInDTO aperturaIn) {
        return ResponseEntity.ok(AperturaOutDTO.builder().build());
    }
}

Expected behavior

Only one map for apertura endpoint. Actually, swagger-ui is showing two endPoints but only there are one.

Screenshots

image

Additional context
N/A

@bnasslahsen
Copy link
Collaborator

bnasslahsen commented Feb 17, 2020

Hi @jamataran,

This is due to the fact that the tags are already defined on Operation level (And not the fact of annotations on interface).
Anyway, this will be fixed for the next release: v1.2.31;

Also, with the next release we introduce the following property, so you can have full control on tags naming :

springdoc.auto-tag-classes=false

@bnasslahsen bnasslahsen changed the title Annotations on interface duplicates endpoints on swagger-ui Duplicate tags if they are defined on @Operation annotation on swagger-ui Feb 17, 2020
@jamataran
Copy link
Author

thank you soy much !

@bnasslahsen bnasslahsen added the question Further information is requested label Jan 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants