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

Maximum call stack size exceeded #614

Open
pauldraper opened this issue Aug 7, 2024 · 1 comment
Open

Maximum call stack size exceeded #614

pauldraper opened this issue Aug 7, 2024 · 1 comment

Comments

@pauldraper
Copy link

a.json

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "oneOf": [
    { "$ref": "b.json" }
  ]
}

b.json

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "oneOf": [
    { "type": "string" },
    {
      "type": "array",
      "items": { "$ref": "#" }
    }
  ]
}

Then

json2ts a.json

results in

[
  RangeError: Maximum call stack size exceeded
      at memoized (/opt/homebrew/lib/node_modules/json-schema-to-typescript/node_modules/lodash/lodash.js:10612:30)
      at /opt/homebrew/lib/node_modules/json-schema-to-typescript/dist/src/generator.js:247:66
      at Array.map (<anonymous>)
      at generateSetOperation (/opt/homebrew/lib/node_modules/json-schema-to-typescript/dist/src/generator.js:247:32)
      at generateRawType (/opt/homebrew/lib/node_modules/json-schema-to-typescript/dist/src/generator.js:236:20)
      at generateTypeUnmemoized (/opt/homebrew/lib/node_modules/json-schema-to-typescript/dist/src/generator.js:128:18)
      at memoized (/opt/homebrew/lib/node_modules/json-schema-to-typescript/node_modules/lodash/lodash.js:10620:27)
      at /opt/homebrew/lib/node_modules/json-schema-to-typescript/dist/src/generator.js:145:55
      at generateRawType (/opt/homebrew/lib/node_modules/json-schema-to-typescript/dist/src/generator.js:147:15)
      at generateTypeUnmemoized (/opt/homebrew/lib/node_modules/json-schema-to-typescript/dist/src/generator.js:128:18)
]
@subahanumanth
Copy link

subahanumanth commented Sep 17, 2024

@bcherny May I help you on this? Looks like the issue was due to parsing, its forming circular dependency.

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

No branches or pull requests

3 participants