swagger-api / swagger-ui

Swagger UI is a collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API.
https://swagger.io
Apache License 2.0
26.63k stars 8.96k forks source link

How to exclude third party dependency's APIs from sneaking into our application Swagger documentation? #10214

Open PSrinivas0813 opened 1 week ago

PSrinivas0813 commented 1 week ago

Q&A (please complete the following information)

Content & configuration

We have a Java EE application with Rest Endpoints. We use annotations to mark the endpoints to be picked up by Swagger UI. These endpoints do show up correctly. We use a third party library - Apache's solr-solrj, this library internally uses solr-api as a dependency because of which these APIs also show up in the Swagger documentation.

How can we exclude these Solr APIs from showing up?

Maven Dependency:

        <dependency>
            <groupId>org.apache.solr</groupId>
            <artifactId>solr-solrj</artifactId>
            <version>9.5.0</version>
        </dependency>

I have tried resourcePackages, resourceClasses but no luck.

We now have removed these APIs manually by overring the default behavior of filterAPImethod.

There has to be a better way to do this. Can you please guide.

Swagger/OpenAPI definition:

# your YAML here

Swagger-UI configuration options:

SwaggerUI({
  // your config options here
})
?yourQueryStringConfig

Screenshots

How can we help?