Open Vampire opened 2 months ago
AFAIR I wanted to make type
to be specified explicitly as much as possible. The idea behind it was to make the writing schema more straightforward, without a lot of references between subschemas, to let people read schema from top to bottom without a lot of jumps between schemas. I think it can be improved though 😄.
Yeah it's a shortcoming of the metaschema. In my opinion this is is a bug because it doesn't improve the text to be more readable or correct, since it does not change how the object is interpreted. (since for drafts 4-7, objects with $ref
s are treated like references and not schemas). And this makes the AJV schemaPath
misleading. Doing this also makes the schemas less DRY and prone to go out of sync (and detecting this mismatch does not seem to be detectable with AJV strict mode).
Area with issue?
JSON Schema
✔️ Expected Behavior
This might either just be a question, or a bug report. Sorry if it turns out to just be a question, but I didn't find a more appropriate place to ask as discussions are not enabled and no chat or similar is linkes anywhere.
I'm writing a schema right now. I've sent it through the
metaschema-draft-07-unofficial-strict.json
. This complained at some places that thetype
is missing.I for example have
All those ref-ed schemas define the
type
to beobject
. If I validate a file against the schema wherelist-item
is set to astring
I correctly get a complaint from Ajv and IntelliJ that thetype
must beobject
.But the
metaschema-draft-07-unofficial-strict.json
requires me to change this toThis does not change much, except that the
schemaPath
in the Ajv output is different.Is this expected and intentional? Is this a shortcoming of the meta schema? Can it just not know that the type would be coming from the ref-ed schema and thus has to complain to not miss other cases?
Are you making a PR for this?
No, someone else must create the PR.