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

Handle recursive types #324 #383

Merged

Conversation

darkowic
Copy link
Contributor

@darkowic darkowic commented Nov 21, 2020

Please:

  • Make your pull request atomic, fixing one issue at a time unless there are many relevant issues that cannot be decoupled.
  • Provide a test case & update the documentation in the Readme.md

Fixes #324, #339, #246 -> Hopefully ;) Tested on examples from this repository https://github.com/Guidewire/ts-to-json-schema-tests (The ExampleProps).

Feedback appreciated.

@darkowic
Copy link
Contributor Author

CI fails on TS 3.7:

    typeof globalThis
      1) type-globalThis should create correct schema

Tips appreciated ;)

@domoritz
Copy link
Collaborator

Awesome. Thank you so muchy. What's the diff for the globalThis test?

@darkowic
Copy link
Contributor Author

Well, type error...

  1 failing
  1) schema
       typeof globalThis
         type-globalThis should create correct schema:
     TypeError: Cannot read property '0' of undefined
      at JsonSchemaGenerator.getClassDefinition (typescript-json-schema.ts:890:63)
      at JsonSchemaGenerator.getTypeDefinition (typescript-json-schema.ts:1247:26)
      at JsonSchemaGenerator.getSchemaForSymbol (typescript-json-schema.ts:1288:26)
      at Object.generateSchema (typescript-json-schema.ts:1515:26)
      at Context.<anonymous> (test/schema.test.ts:27:28)
      at processImmediate (internal/timers.js:443:21)

I will try to fix it on Monday...

@domoritz
Copy link
Collaborator

🤦‍♂️ right, the stacktrace.

@darkowic darkowic force-pushed the 324-maximum-call-stack-size-exceeded branch from 858698e to 65904f4 Compare November 24, 2020 15:16
@darkowic
Copy link
Contributor Author

Well @domoritz, you solved my problem by removing typescript 3.7 from tests :P Ready to merge 🚀

@domoritz
Copy link
Collaborator

Thank you

@darkowic darkowic deleted the 324-maximum-call-stack-size-exceeded branch November 24, 2020 16:50
"prev",
"propA",
"propB"
],
"type": "object"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the type still be here? We already have a $ref property so I think this is wrong.

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

Successfully merging this pull request may close these issues.

Maximum call stack size exceeded
2 participants