Recursion
Hi,
Let me start by saying this is a awesome implementation of json-schema! Using generators for this is genius.
I have been in the field for decades and to me this looks like a work of art. Thank you.
fyi, I am playing around with this to turn it into a generic renderer.
However, while testing I used this code:
{
"definitions": {
"node": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"children": {
"type": "array",
"items": {
"$ref": "#/definitions/node"
}
}
}
}
},
"type": "object",
"properties": {
"tree": {
"title": "Recursive references",
"$ref": "#/definitions/node"
}
}
}
{
"tree": {
"children": [
{
"children": [],
"name": "leaf"
}
],
"name": "root"
}
}
From: https://rjsf-team.github.io/react-jsonschema-form/ The 'References' example.
It does not like that.
$ref: {
*valid(url, value, schema) {
const refSchema = schema[refKey];
For fun I put the $dynamicRef code there and changed dynamic to false const dynSchema = currentSchema.walk(url, { dynamic: false });
That worked 🤷
But honestly, I don't understand the fine balance of implementation and standard adherence here, so I dont even know it is a bug :)
I read you were asking for help, if there is any way I can contribute let me know.
🙇
Hello Gerbert
Wow, thanks for the praise, that motivates me!
Strange, your example doesn't use $dynamicRef at all.
Did this error occur? "dynamicRef: no schema found, deref() called?" I just saw in my code that the error message is not correct, it should be "ref: no schema..."
For fun I put the $dynamicRef code there and changed dynamic to false const dynSchema = currentSchema.walk(url, { dynamic: false });
So your example doesn't go to currentSchema.walk at all, or rather shouldn't...🤔
It would be good if you could run the code somewhere online (codepen, jsfiddle), then I can take a better look at it.
I read you were asking for help, if there is any way I can contribute let me know.
I would prefer if someone who is familiar with the standard and Javascript could work on this project.
To be honest, I don't use the code myself yet and rarely get feedback from others. I only programmed it because I think JSON Schema is very promising for the future and I wanted a lean implementation that is also browser friendly.
Sorry, at the moment i have not time to take a look. But I keep the issue open.