Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Huge swagger.json file is not being processed #884

Open
joaorodr84 opened this issue Jul 10, 2024 · 4 comments
Open

Huge swagger.json file is not being processed #884

joaorodr84 opened this issue Jul 10, 2024 · 4 comments

Comments

@joaorodr84
Copy link

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

@sserrata
Copy link
Member

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.

@hbulens
Copy link

hbulens commented Jul 29, 2024

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.

@sserrata
Copy link
Member

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?

@hbulens
Copy link

hbulens commented Aug 1, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants