swagger-core icon indicating copy to clipboard operation
swagger-core copied to clipboard

`public OpenAPI read` takes almost 1 minute to execute

Open Frantch opened this issue 2 years ago • 1 comments

Hi,

We have recently switched from Swagger 2 to Swagger 3 oas and we are seeing an issue we weren't seeing before (or at least not so pronounced). Loading the swagger configuration takes forever to load causing the call to timeout.

I have debugged the line causing this in the io.swagger.v3.jaxrs2.GenericOpenApiContext.java file.

The line is: cached.openApi = getOpenApiReader().read(getOpenApiScanner().classes(), getOpenApiScanner().resources());

both getOpenApiScanner().classes() and getOpenApiReader().read(..) takes in total around 1 minute sometime to execute.

These are numbers returned by .read(..) once executed: Paths: 218 Schemas: 161 tags:32

and this is a screenshot of the the results of ScanResult scanResult = graph.scan(); in the JaxrsAnnotationScanner.java class

https://imgur.com/a/AvMjwJ4

We are using the latest version: swagger-jaxrs2: 2.1.13 swagger-core:2.1.13

This is an issue since in production we have 8-9 pods running scaling up and down and so more often than not the swagger page almost never load. Is it because we have too many resource annotated ? 218 paths doesn't seem 'that much' ?

Thank you

Frantch avatar Mar 25 '22 07:03 Frantch

We have same problem, too much time to generate meta file.

we have untill now, about 10.000 resource paths and swagger takes about 1 hour to generate . so it becomes unusable.

marcos-donato-br avatar Mar 30 '22 14:03 marcos-donato-br