5 ms·
A good json schema validator will usually reject excess fields.
by Taywee 4y ago
A good json schema validator will usually reject excess fields.
- relequestual 4y agoActually, currently, this is not the case. The specification explicitly allows for additional fields for the purposes of extensions. We are considering changing that, and only allowing pre-defined fields, or having a way to mark specific fields as limited extensions.
- Taywee 4y agoHuh, you're right. There is additionalProperties, but I mistakenly thought `"additionalProperties": false` was the default.
- relequestual 4y agoIt is not =] Additionally, the value is a "schema" as opposed to a boolean, meaning you can apply a subschema to any additional fields. Useful if you for instance want to make sure any additional fields start with a specific prefix. Booleans are valid schemas. It's subschemas all the way down! I wrote an article around this topic: https://json-schema.org/blog/posts/applicability-json-schema-fundamentals-part-1 https://json-schema.org/blog/posts/applicability-json-schema...