rohit-gohri / redocusaurus

OpenAPI for Docusaurus with Redoc
https://redocusaurus.vercel.app/
MIT License
629 stars 114 forks source link

Memory regeneration problem when generating with cyclic dependencies #300

Open DrBronsy opened 1 year ago

DrBronsy commented 1 year ago

In the process of using the package on redocusaurus, I encountered the problem of overflowing the available memory when generating a method with cyclic dependencies.

When generating a method with objects interconnected by cyclic dependencies, the process crashes with an Error: Out of memory error. This indicates that the generation is looping, which should not happen when processing circular dependencies.

Play steps:

Create objects with complex relationships (cyclic dependencies). Try to generate the appropriate method using the redocusaurus package. Expected Result: The method with circular dependencies is generated successfully without exceeding the memory limit.

Actual result: The process crashes with the error Error: Out of memory.

girgab package version: 1.6.3

We would really appreciate your help in solving this problem.

image
stv0g commented 1 year ago

Probably caused by https://github.com/Redocly/redoc/issues/696

rohit-gohri commented 1 year ago

@DrBronsy Can you share a small reproduction? Some sample schema I can test with

mason-at-pieces commented 7 months ago

@DrBronsy Running into a similar issue that I've narrowed down to be related to $ref values that are used in the openapi yaml file.

However, there are some $ref values that do work so I'm still narrowing down which actually cause the issue. I'd assume it's some circular dependency.

I wonder if there's anyway to deal with circular dependencies on your end when parsing the file.

rohit-gohri commented 7 months ago

@mason-at-pieces can you share any openapi spec that I can use to reproduce the issue?

Might be related to redoc issue - https://github.com/Redocly/redoc/issues/2383

mason-at-pieces commented 7 months ago

@rohit-gohri I am having a chat with my team about this Monday. I'll get back to you then on this 👍

mason-at-pieces commented 6 months ago

@rohit-gohri So I downloaded the redocly cli and was able to use both the preview and preview-docs commands just fine. However, the build-docs command is what results in the memory leak.