You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to be able to check fully recursively the schema main.json but it seems that check-jsonchema --check-metaschema main.json doesn't traverse references.
In this case, props1.json schema contains an error. "type" can't be "BADstring" (according to the metaschema". However, the check of main.json returns an ok -- validation done
Am I doing something wrong, there is a bug, or it is feature that could be proposed for enhancement?
thanks in advance!!
The text was updated successfully, but these errors were encountered:
This is not expected to work in the way you were hoping, but I'm not sure if it's a feature request that I'd be willing to support/add.
Let me explain, and I'll have to take more time to think about the correct path forward.
Under the metaschema check, your schema is data being checked against a JSON Schema.
Conceptually, if every schema evaluation looks like
validate($SCHEMA, $DATA)
then we can translate the following two invocations thusly:
That is, it gets no special treatment, and normal JSON Schema checking rules apply. Since it's being evaluated as an ordinary document, there's no expectation that $refs are followed. Ref resolution applies "when you are the schema", not "when you are the data".
That explains why your $refs aren't followed. It doesn't exactly help you do metaschema checking on the contents of those refs.
I'm giving thought to whether or not following refs (opt-in?) would be appropriate for the metaschema check. It certainly would be nice and it makes perfect sense! But it also breaks the symmetry between normal schema evaluation and metaschema evaluation, and that makes me a little uneasy.
For right now, you can pull your $ref contents manually and check them with the metaschema check as well. I know that's not what you're looking for, but it's the solution which is available today.
I understand your concerns about breaking the symmetry. I just can argue that from an schema developer point of view it would be very useful and it will simplify the metaschema validation both manually and in cicd pipelines :)
Considering the next json schema definition:
I'd like to be able to check fully recursively the schema main.json but it seems that
check-jsonchema --check-metaschema main.json
doesn't traverse references.In this case, props1.json schema contains an error. "type" can't be "BADstring" (according to the metaschema". However, the check of main.json returns an
ok -- validation done
Am I doing something wrong, there is a bug, or it is feature that could be proposed for enhancement?
thanks in advance!!
The text was updated successfully, but these errors were encountered: