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

Fails to generate a schema for code referring to a circular dependency #298

Open
andreashuber69 opened this issue Jun 9, 2019 · 6 comments

Comments

@andreashuber69
Copy link

Please see the following repo to reproduce the problem:

https://github.com/andreashuber69/typescript-json-schema-bug

P.S.: @domoritz @YousefED typescript-json-schema is a very valuable tool! Many thanks for your efforts!

@domoritz
Copy link
Collaborator

domoritz commented Jun 9, 2019

I think https://github.com/vega/ts-json-schema-generator will work for you. Can you give it a try?

@andreashuber69
Copy link
Author

I think https://github.com/vega/ts-json-schema-generator will work for you. Can you give it a try?

Sure, I tried with the following command line:

ts-json-schema-generator --path 'src/schemas/*.ts' --expose 'export' --jsDoc 'extended'

which fails with the following error:

NoRootTypeError: No root type "undefined" found

It does work when I mention one of the types with the --type argument, but I need a single file containing all the schema definitions. Is there any way to achieve that?

@andreashuber69
Copy link
Author

andreashuber69 commented Jun 10, 2019

It does work when I mention one of the types with the --type argument, but I need a single file containing all the schema definitions. Is there any way to achieve that?

I guess there isn't currently: vega/ts-json-schema-generator#117

@domoritz
Copy link
Collaborator

Not yet but I'd be happy to review a PR towards that feature.

@andreashuber69
Copy link
Author

Not yet but I'd be happy to review a PR towards that feature.

If you had to implement that feature right now, what time do you estimate would it take you?

@domoritz
Copy link
Collaborator

An hour if there are no major complications. Here is the corresponding issue vega/ts-json-schema-generator#117.

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

No branches or pull requests

2 participants