Nested meta schema validates with unexpected errors (no additional properties allowed)
See original GitHub issueDear json-editors,
Expected Behaviour
I try implementing the meta schema into my project as part of the user interface. In this case, the meta schema is nested in another schema.
To be able to reference the definitions as a mayor part of the meta schema from the original json-editor files, I moved the definitions to the schemas top.
Actual Behaviour
For reasons I don’t understand the validation fails for most properties with the “no additional properties allowed” error.
Maybe you have an idea what exactly changes once the definitions are not on the same level as the meta schema property.
Steps to reproduce the behavior
I got rid of all the rest of the my schema and the problem persists. Here is the most basic example validating with the above error:
this is how the meta schema was modified in short:
{
"type": "object",
"title": "Devices",
"properties": {
"device_schema": {
"title": "Device Schema",
"$ref": "#/definitions/schema",
"properties": {
"definitions": {
"type": "object",
"patternProperties": {
".*": {
"$ref": "#/definitions/schema"
}
}
}
}
}
},
"definitions": { ... } // all the definitions see json-editor meta schema
}
I use the meta_schema.json from the docs folder in json-editor version: 1.3.5
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (2 by maintainers)
Top GitHub Comments
Hi, sorry for the huge delay, I saw one thing I don’t quite understand: In the schema you used for the json editor there is:
why did you put this fragment of schema before the metaschema? If I remove it, and then fill the json-editor with the json you used, it validates correctly.
As per the commit you referenced. I moved the
additionalProperties: false
into the oneOf branches, because having it in the schemaBase didn’t work, i.e. using unknown directives in the json-editor to create a schema was allowed, and I wanted to prevent things like this to validate:This schema uses the fictitious ujfallusa directive, which is not one of the directives listed in the Schema standard I referred to.
Hey! Thanks for having a look into this. Now its me being late, sorry.
I want to allow using the editor to create a schema for (inside) each “device” instance, that’s why I nested the meta schema into an object type.
Maybe in the end that’s not practical anyhow from a user point of view and creating the schema should be its own editor.
The way I did it just seemed more straightforward.