Search code examples
spring-bootspringfoxspringdocspringdoc-openapi-ui

Replace SpringFox @Api tag with SpringDoc tag


I have this SpringFox @Api tag:

@Api(hidden = true)

I tried to replace it with:

@Tag(hidden = true)

But where is not option hidded=true

What is the proper way to replace this?


Solution

  • There's not a hidden attribute on the @Tag annotation because it doesn't make a lot of sense to have an API in a public facing class but then not include it in the documentation.

    The suggested approach is to move all such methods into a separate class of their own and not tag that class with the @Tag annotation. Then you can set the property springdoc.auto-tag-classes to false so that Springdoc doesn't pick it up in the default tag.

    If at all you need to have APIs in a class that's tagged with @Tag you should annotate the method with @Operation(hidden = true) and that should hide the method from tag.