So came across an interesting error from Themis today. Here is a gist (https://gist.github.com/NathanRSmith/e09d671f0a72b43b781b) which illustrates the problem. It may seem contrived, but it reflects another schema that I was originally working on for declaratively building a tree-like structure.
Here is the error stack trace for the case that fails.
RangeError: Maximum call stack size exceeded
at String.replace (native)
at buildError (/Users/nathansmith/dev/tmp/node_modules/themis/src/themis.js:627:51)
at ValidationGenerators.type (/Users/nathansmith/dev/tmp/node_modules/themis/src/themis.js:708:7)
at generateSchema (/Users/nathansmith/dev/tmp/node_modules/themis/src/themis.js:1749:26)
at Object.0#/definitions/stuff/anyStuff (/Users/nathansmith/dev/tmp/node_modules/themis/src/themis.js:1694:31)
at generateSchema (/Users/nathansmith/dev/tmp/node_modules/themis/src/themis.js:1794:64)
at generateSchema (/Users/nathansmith/dev/tmp/node_modules/themis/src/themis.js:1872:24)
at generateSchema (/Users/nathansmith/dev/tmp/node_modules/themis/src/themis.js:1878:26)
at Object.0#/definitions/stuff/stuff1 (/Users/nathansmith/dev/tmp/node_modules/themis/src/themis.js:1694:31)
at generateSchema (/Users/nathansmith/dev/tmp/node_modules/themis/src/themis.js:1794:64)
I am not intimately familiar with the themis core, but it appears to be coming from where it builds error messages to throw if data fails validation. This error seems to be building a message that has the path of the circular "$ref" and there is a recursion error. But what is interesting is that it only does this when I have my definitions grouped and not when things are a bit flatter, despite there still being cycles...
Anyone have any insight as to why this is happening? I think I can work around it in my real schema for now by keeping things flat, but other validators (tv4, is-my-json-valid) are able to validate without issue.
Hi all,
So came across an interesting error from Themis today. Here is a gist (https://gist.github.com/NathanRSmith/e09d671f0a72b43b781b) which illustrates the problem. It may seem contrived, but it reflects another schema that I was originally working on for declaratively building a tree-like structure.
Here is the error stack trace for the case that fails.
I am not intimately familiar with the themis core, but it appears to be coming from where it builds error messages to throw if data fails validation. This error seems to be building a message that has the path of the circular "$ref" and there is a recursion error. But what is interesting is that it only does this when I have my definitions grouped and not when things are a bit flatter, despite there still being cycles...
Anyone have any insight as to why this is happening? I think I can work around it in my real schema for now by keeping things flat, but other validators (tv4, is-my-json-valid) are able to validate without issue.