Open Finkman opened 4 years ago
Do you have the issue on other node versions? The code that is failing looks like this:
function keyword(str) {
used.add(str[0]);
return str.join('');
}
and I'm having a very hard time visualizing what might cause the issue.
I've added a speculative fix in the max-call-stack
branch. Can you try this and report back?
Same, but looks like different location throwing:
loading 1 schemas
(node:8415) UnhandledPromiseRejectionWarning: RangeError: Maximum call stack size exceeded
at Set.add (<anonymous>)
at keyword (/home/fins/Development/jsonschema2md/lib/keywords.js:15:8)
at Object.meta.(anonymous function) (/home/fins/Development/jsonschema2md/lib/schemaProxy.js:41:23)
at Object.get (/home/fins/Development/jsonschema2md/lib/schemaProxy.js:104:26)
at Object.meta.(anonymous function) (/home/fins/Development/jsonschema2md/lib/schemaProxy.js:46:20)
at Object.get (/home/fins/Development/jsonschema2md/lib/schemaProxy.js:104:26)
at Object.meta.(anonymous function) (/home/fins/Development/jsonschema2md/lib/schemaProxy.js:46:20)
at Object.get (/home/fins/Development/jsonschema2md/lib/schemaProxy.js:104:26)
at Object.meta.(anonymous function) (/home/fins/Development/jsonschema2md/lib/schemaProxy.js:46:20)
at Object.get (/home/fins/Development/jsonschema2md/lib/schemaProxy.js:104:26)
(node:8415) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:8415) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Can you reproduce the error?
I haven't been able to look into this in depth, sorry.
Same issue with schemas including multiple objects in "definitions". With those files I have found a workaround by removing the "$id" keyword. Any hint?
@trieloff I have discovered that removing the recursive references in my code fixed the stack overflow.
This issue may be related to another issue #234
I've had this bug, too, and I think it's because I have an object type that may contain itself. Recursion bad. Deleting the recursive property made it run fine. Probably need to handle recursive references.
Recursion references are perfectly legit in JSON Schema. jsonschema2md should be smart enough to handle this
Also just encountered this issue with recursion. Don't really want to change my schema because of this :/
What did you do
What did you expect to happen
Conversion to mark down without errors
What happened
Since v4.0.4 it fails with an exception:
(Figured out, that it is not guaranteed to fail, sometimes it just works; I know, those are the worst bugs ever)
converter failed with exception
``` [build] (node:19698) UnhandledPromiseRejectionWarning: RangeError: Maximum call stack size exceeded [build] at Array.join (native) [build] at keyword (/usr/lib/node_modules/@adobe/jsonschema2md/lib/keywords.js:16:14) [build] at Object.meta.(anonymous function) (/usr/lib/node_modules/@adobe/jsonschema2md/lib/schemaProxy.js:42:28) [build] at Object.get (/usr/lib/node_modules/@adobe/jsonschema2md/lib/schemaProxy.js:104:26) [build] at Object.meta.(anonymous function) (/usr/lib/node_modules/@adobe/jsonschema2md/lib/schemaProxy.js:46:20) [build] at Object.get (/usr/lib/node_modules/@adobe/jsonschema2md/lib/schemaProxy.js:104:26) [build] at Object.meta.(anonymous function) (/usr/lib/node_modules/@adobe/jsonschema2md/lib/schemaProxy.js:46:20) [build] at Object.get (/usr/lib/node_modules/@adobe/jsonschema2md/lib/schemaProxy.js:104:26) [build] at Object.meta.(anonymous function) (/usr/lib/node_modules/@adobe/jsonschema2md/lib/schemaProxy.js:46:20) [build] at Object.get (/usr/lib/node_modules/@adobe/jsonschema2md/lib/schemaProxy.js:104:26) ```What's your environment
Do you have example files:
For this schema