Forum Discussion

Techtez's avatar
Techtez
Occasional Contributor
24 days ago

All application end points are displaying

I have deployed my swagger-integrated RESTEasy application as a war file on JBoss. Another ear file  RESTEasy application which is not integrated with swagger annotations also deployed on the same JBoss.

But in the swagger UI, along with RESTEasy application war file API's other ear application end points also displaying. The ear file application has not set any Application Path. But the war file application has set "serviceApi" as ApplicationPath. In the swagger initializer mentioned the URL as Project/serviceApi/openapi.json.

OpenApiDefinition and schema annotations are mentioned only in the war file application. 

How can I disable the displaying of other application endpoints from swagger UI?

 

 

1 Reply

  • Techtez's avatar
    Techtez
    Occasional Contributor

    Hi all,

    we have fixed this issue by restricting the package scan for a specific packages using following code. 

    try {
                OpenAPI oas = new OpenAPI();
                SwaggerConfiguration oasConfig = new SwaggerConfiguration()
                    .openAPI(oas)
                    .prettyPrint(true)
                    // Replace with your actual package(s)
                    .resourcePackages(Set.of("com.exampl.your.package"));
                
                new JaxrsOpenApiContextBuilder()
                    .application(this)
                    .openApiConfiguration(oasConfig)
                    .buildContext(true);
            } catch (OpenApiConfigurationException e) {
                throw new RuntimeException(e.getMessage(), e);
            }

     

    Thanks