Warning
JSON Schema Draft 3 and older are not supported at this point in time.
jsonschema metaschema [schemas-or-directories...]
[--verbose/-v] [--http/-h] [--extension/-e <extension>]
[--ignore/-i <schemas-or-directories>] [--trace/-t]
Ensure that a schema or a set of schemas are considered valid with regards to their metaschemas.
For example, consider this fictitious JSON Schema that follows the Draft 4
dialect but sets the type
property to an invalid value:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": 1
}
Running the metaschema
command on it will surface an error:
$ jsonschema metaschema schema.json
error: The target document is expected to be one of the given values
at instance location "/type"
at evaluate path "/properties/type/anyOf/0/$ref/enum"
error: Mark the current position of the evaluation process for future jumps
at instance location "/type"
at evaluate path "/properties/type/anyOf/0/$ref"
error: The target document is expected to be of the given type
at instance location "/type"
at evaluate path "/properties/type/anyOf/1/type"
error: The target is expected to match at least one of the given assertions
at instance location "/type"
at evaluate path "/properties/type/anyOf"
error: The target is expected to match all of the given assertions
at instance location ""
at evaluate path "/properties"
jsonschema metaschema path/to/my/schema_1.json path/to/my/schema_2.json
jsonschema metaschema path/to/schemas/
jsonschema metaschema
jsonschema metaschema path/to/schemas/ --ignore path/to/schemas/nested
jsonschema metaschema --extension .schema.json
jsonschema metaschema path/to/my/schema.json --trace