Validation schema - only defined elements
presto41 opened this issue · comments
presto41 commented
Hi,
I wonder if exists any way to return error if user will try to put into json-editor not defined schema element?
For example this is some schema:
var job = {
"title": "Job description",
"type": "object",
"required": ["address"],
"properties": {
"company": {
"type": "string",
"examples": [
"ACME",
"Dexter Industries"
]
},
"role": {
"description": "Job title.",
"type": "string",
"examples": [
"Human Resources Coordinator",
"Software Developer"
],
"default": "Software Developer"
},
"address": {
"type": "string"
},
"salary": {
"type": "number",
"minimum": 120,
"examples": [100, 110, 120]
}
}
};
and now user into json-editor is writing: "asd": "asd".
"asd" is not defined element of schema so I want to get a error of that.
Any ideas?
presto41 commented
I found the answer. I should to use "additionalProperties": false in schema 👍