bcherny/json-schema-to-typescript

Maximum call stack size exceeded

Open

#614 opened on 2024年8月7日

GitHub で見る
 (1 comment) (0 reactions) (0 assignees)TypeScript (449 forks)github user discovery
buggood first issuehelp wanted

Repository metrics

Stars
 (3,302 stars)
PR merge metrics
 (30d に merged PR はありません)

説明

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

コントリビューターガイド