I use networknt:json-schema-validator 1.0.42.
I have been given a (intended) jsonschema with “repuired” (in stead of “required”) as a top property key, in stead of a topmost key.
The schema factory (V7) happily ignores this and the validator then, of course, allows instance json not have the keys that were intended required.
I am surprised it can happen unless it is a bug.
I corrected the jsonschema concerning these two problems and added "additionalProperties": false
just after the corrected and replaced line.
May be this part (the line I added) is missing in the metaschema but I suspect it may be for good, but don’t know why, as I am new to JSON schema.
I prefer asking before filing a bug.
Advertisement
Answer
The JSON Schema spec (all drafts) says that unknown keywords are to be ignored. The meta-schema not having "additionalProperties": false
is correct.
I can’t speak to this implementation specifically, but this is likely what’s happening.