openapi-typescript-codegen icon indicating copy to clipboard operation
openapi-typescript-codegen copied to clipboard

Processing large OpenAPI spec leads to StackOverflow

Open khanab85 opened this issue 4 years ago • 1 comments

While processing this Spec file (4k lines) - it seems that a recrusive function is causing an StackOverflow.

adh-openapi-docs.json.zip

Command used: npx openapi-typescript-codegen --input ./adh-openapi-docs.json --output ./schemas

Error: RangeError: Maximum call stack size exceeded at String.replace () at M (/Users/khalednabli/.npm/_npx/47c45e4589f31efb/node_modules/openapi-typescript-codegen/dist/index.js:1:16501) at ee (/Users/khalednabli/.npm/_npx/47c45e4589f31efb/node_modules/openapi-typescript-codegen/dist/index.js:1:21805) at /Users/khalednabli/.npm/_npx/47c45e4589f31efb/node_modules/openapi-typescript-codegen/dist/index.js:1:20671 at Array.reduce () at /Users/khalednabli/.npm/_npx/47c45e458

9f31efb/node_modules/openapi-typescript-codegen/dist/index.js:1:20614 at K (/Users/khalednabli/.npm/_npx/47c45e4589f31efb/node_modules/openapi-typescript-codegen/dist/index.js:1:20810) at ee (/Users/khalednabli/.npm/_npx/47c45e4589f31efb/node_modules/openapi-typescript-codegen/dist/index.js:1:24547) at /Users/khalednabli/.npm/_npx/47c45e4589f31efb/node_modules/openapi-typescript-codegen/dist/index.js:1:20671 at Array.reduce ()

khanab85 avatar Jan 13 '22 14:01 khanab85

@khanab85 It seems there is indeed a circular reference in the models. I quickly looked into this, but there seems to be something interesting with the composition of the models. Did you run this through other generators with succes? I will keep the ticket open as a reminder, but will need to check how to solve this.

ferdikoomen avatar Jan 24 '22 22:01 ferdikoomen