2

With this controller definition, with a tag:

@RestController
@RequestMapping("/some_path")
@Tag(name = "MyController")
public class MyController {
   ...
}

When trying to customize OpenApi, I can't get the value of tags:

@Bean
public OpenApiCustomiser order() {
    return openApi -> openApi.setTags(openApi.getTags() ...

openApi.getTags() always returns null, I was expecting a list with MyController tag.

Any suggestion?

C.P.O
  • 1,213
  • 2
  • 11
  • 29

1 Answers1

0

You can use the OperationCustomizer, which is more relevant for your case:

@Bean
public OperationCustomizer operationCustomizer() {
    return (operation, handlerMethod) -> {
        operation.setTags(operation.getTags()); // to adapt
        //operation.addTagsItem("my new tag");
        return operation;
    };
}
brianbro
  • 4,141
  • 2
  • 24
  • 37