How do I remove "api-resource-controller" from my openapi swagger

Viewed 3587

I'm currently using the below openapi-ui dependency.

    <dependency>
        <groupId>org.springdoc</groupId>
        <artifactId>springdoc-openapi-ui</artifactId>
        <version>1.4.4</version>
    </dependency>

How to remove the api-resource-controller from the openapi-ui swagger screen?

enter image description here

3 Answers

If you want to hide certain paths, you could use the springdoc.paths-to-exclude property, documented here.

So, in your case you should use:

# Paths to exclude
springdoc.paths-to-exclude=/swagger-resources/**

You can use the @Hidden annotation from swagger-annotations, on the top of the controller you want to hide.

Or you can use properties to filter the endpoints to show, filtering by path or package:

# Packages to include
springdoc.packagesToScan=com.package1, com.package2

or

# Paths to include
springdoc.pathsToMatch=/v1, /api/balance/**

You can remove @EnableSwagger2 from your swagger config file or openapi config file then these openapi-resource controller will authomatically be removed.

Related