docusaurus-openapi-docs
docusaurus-openapi-docs copied to clipboard
Huge swagger.json file is not being processed
I have a swagger.json file with almost 150 000 lines for my API.
I want to generate the documentation (mdx files) with this plugin, but it doesn't run.
yarn docusaurus gen-api-docs myapi
Simply doesn't generate anything and kinda hangs.
Is it because the file is too big?
How do you get around such a problem?
Thanks
Hi @joaorodr84 have you tried parsing it using other tools, like redoc? If it's in fact too large only strategy that comes to mind would be splitting it up into "micro" specs and/or refactoring it to leverage reusable components as much as possible, which may help reduce the overall size.
I am having a similar issue. I merely have 10K lines in my swagger.json file, but I get:
Loading of api failed for "\swagger.json" [ERROR] RangeError: Invalid string length at JSON.stringify (
) at loadAndResolveSpec (\docusaurus-plugin-openapi-docs\lib\openapi\utils\loadAndResolveSpec.js:140:29) at async readOpenapiFiles (\docusaurus-plugin-openapi-docs\lib\openapi\openapi.js:451:19) at async generateApiDocs (\docusaurus-plugin-openapi-docs\lib\index.js:94:28) at async \docusaurus-plugin-openapi-docs\lib\index.js:439:15
Docusaurus 3.4.0 and docusaurus-plugin-openapi-docs 3.0.1.
Hi @hbulens, I given where the error is occurring, it's possible that circular references could be the root cause. Does your spec parse properly with other OpenAPI tools?
Hi @hbulens, I given where the error is occurring, it's possible that circular references could be the root cause. Does your spec parse properly with other OpenAPI tools?
That must be it. Our OpenAPI spec does work using Swashbuckle but not with other parsers.