bcherny/json-schema-to-typescript

Maximum call stack size exceeded

Open

#614 aperta il 7 ago 2024

Vedi su GitHub
 (1 commento) (0 reazioni) (0 assegnatari)TypeScript (449 fork)github user discovery
buggood first issuehelp wanted

Metriche repository

Star
 (3302 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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)
]

Guida contributor