bcherny/json-schema-to-typescript

Maximum call stack size exceeded

Open

#614 ouverte le 7 août 2024

Voir sur GitHub
 (1 commentaire) (0 réactions) (0 assignés)TypeScript (449 forks)github user discovery
buggood first issuehelp wanted

Métriques du dépôt

Stars
 (3 302 stars)
Métriques de merge PR
 (Aucune PR mergée en 30 j)

Description

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

Guide contributeur