-
-
Notifications
You must be signed in to change notification settings - Fork 290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
metaschema permissiveness (why are unsupported keywords allowed?) #577
Comments
TL;DR: Why isn't |
Not to take away from an independent question that it sounds like you're asking ("should the meta schema disallow additionalProperties by default", which I believe has some previous discussion somewhere that I'm sure @handrews will know about), but I'd say if you didn't have unit tests for your schema you have got some issues that defaults won't fix :). They can make it slightly harder, but I'd still always recommend personally that you have a suite that's testing examples of instances you expect to be valid and invalid. |
That is also an excellent point, not to be discounted. While the schema did undergo testing, this was clearly a miss... in part because the intention was clear in the schema and we all know the spiel about assumptions. It would be nice, though, to have an additional layer, especially one that would allow simply pulling referenced meta-schema to do validation of the actual schema at runtime ;) |
@russwe JSON Schema is specifically designed as an extensible system. Per JSON Schema Core §4.3.1:
Setting You can, of course, write your own meta-schema, add With #561 (vocabulary support, targeted for draft-08) it will be easier to write your own meta-schema but still have implementations recognize the underlying standard vocabulary. Once draft-08 is published and implemented you could use that plus #556 ( |
@russwe hopefully this makes sense- it's done this way because schemas are a constraint system, and once you add a constraint to a schema, no one else who re-uses a schema can remove that constraint. Once we have |
That absolutely makes sense. I missed 4.3.1, though I was looking for something similar. I'll look over the links you've provided and determine the best path forward for us... certainly it is no real hardship to add the Thanks! |
I've recently written (and validated) a schema that contained
"requiredProperties": []
rather than"required": []
and accidentally let a much more permissive schema into the wild than intended. Is there a reason this sort of error should be allowed, or is this simply an oversight in the existing drafts?Maybe I'm missing a use-case that "free-form" keywords in the schema allow?
The text was updated successfully, but these errors were encountered: