-
Notifications
You must be signed in to change notification settings - Fork 150
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
Version 4 cyclic refs freezes without any error #185
Comments
Hi Andy, the external refs shouldn't be the problem, as
|
Hi @trieloff , thank you for your quick answer.
We use our schemas to describe a generic component-tree, which may have arbitrarily nested components. |
Could you try to create a minimal example, just to validate the assumption that it has something to do with the recursion? e.g. three schemas that form a cycle. |
@trieloff here you go :) Please let me know if you need any more data |
@AndyOGo the next release should have a fix. At least a fix that works with the example you've shared. |
@trieloff sounds great, thank you very much for your quick handling. |
🎉 This issue has been resolved in version 4.0.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
@trieloff Thanks for the release. We heavily rely on recursion in array items mostly with |
I'll have a look, but it might not get done in this decade 😉 expect a fix in the early 2020s. |
still happens for me, too. |
@trieloff, the problem happens, like @AndyOGo said, with a recursive ref. for example:
By looking at the code, I don't now how this should work, as the proxy resolves the it might be possible to try to detect a circular reference, and only avoid the mixin in this case, but I think, also for readability of the MD, having a link to the referenced schema is good enough. alternatively, we could just not write the schemas JSON, and ensure that the markdown renders the $ref correctly. |
hmh, I think a lazy cache should handle the complexity 🤔
|
the is not the problem. the |
Hmh, maybe I miss some info. |
look at the example above...the maybe you have a different example of a also note: the error only occurs when writing the |
Thanks for the hint. At which point is the cache hot? |
Ah, then the fix should be relatively easy. We write the JSON again so that @AndyOGo a quick workaround for you might be to disable the JSON output. @tripodsan I think our error is that the The markdown processing doesn't get caught in an endless loop, because we generate one output for each schema, and the schema identity is independent from the depth in the recursive tree. |
but you would only do this on the toplevel, right? so wouldn't it be enough to disable the jsonschema2md/lib/schemaProxy.js Lines 104 to 115 in d6a7cb9
|
Yes, the merging only happens on the top level, but I can take the issue from here. |
ok. thanks. |
## [4.0.3](v4.0.2...v4.0.3) (2020-01-09) ### Bug Fixes * **schema:** do not recurse endlessly when writing cyclic schemas ([297f0d5](297f0d5)), closes [#185](#185)
🎉 This issue has been resolved in version 4.0.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Thanks for your help. |
What did you do
I just upgraded to version 4 from verison 3 and tried to generate md files by running my NPM
docs
script:npm run docs # which executs: jsonschema2md -o docs/ -x docs/ -d schemas/ -e json
What did you expect to happen
All markdown files to be generated
What happened
The CLI programm freezes without any error.
Last log is:
What's your environment
10.15.2
(19C57)v10.15.0
Do you have example files:
https://github.com/axa-ch/cyclic-schemas-test
The text was updated successfully, but these errors were encountered: