swagger-js
swagger-js copied to clipboard
Resolving large specs takes very long / crashes
Q&A (please complete the following information)
- OS: Ubuntu 22.04
- Environment: Node 16.13.2
- Method of installation: npm
- Swagger-Client version: 3.18.5
- Swagger/OpenAPI version: OpenAPI 3.0
Content & configuration
Swagger/OpenAPI definition: Stripe
Swagger-Client usage:
const SwaggerClient = require('swagger-client');
SwaggerClient.resolve({url: 'https://github.com/stripe/openapi/raw/master/openapi/spec3.json'})
Describe the bug you're encountering
Running the above script takes very long and and uses one CPU core non-stop 100%. I was too impatient to wait until it might complete or node.js fails, so I cancelled the process after 27 minutes. A user of my downstream library reported that the process crashes after about one hour.
To reproduce...
Steps to reproduce the behavior:
- Run the script above (
e.g. node index.js)
Expected behavior
The script terminates successfully after a reasonable period of time.
Additional context or thoughts
While I think it is acceptable that resolving very large / complex specs takes longer, I would think that it should be faster than it is at the moment. Doing the same using the Java swagger-parser only takes a few seconds for the same spec.