Check yaml with check-metaschema option
Closed this issue · 3 comments
Version of check-jsonschema
: 0.28.0
When I run check-jsonschema
against yaml with check-metaschema
option, result is always ok.
With json - works as expected:
check-jsonschema --check-metaschema ./target-file.json
{
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"property": "not-existing-type"
}
}
result:
Schema validation errors were encountered.
./json-schema/some-package/invalid-schema.json::$.definitions.EnvConfigV1Properties.type: 'str' is not valid under any of the given schemas
Underlying errors caused this.
Best Match:
$.definitions.EnvConfigV1Properties.type: 'str' is not one of ['array', 'boolean', 'integer', 'null', 'number', 'object', 'string']
1 other errors were produced. Use '--verbose' to see all errors.
With yaml - does not work as expected:
check-jsonschema --check-metaschema ./target-file.yaml
$schema: "http://json-schema.org/draft-07/schema#"
properties:
property: "not-existing-type"
result:
ok -- validation done
I'm not able to reproduce this, so there has to be some element at play here other than just the check-jsonschema
behavior and version.
$ check-jsonschema --check-metaschema ./target.yaml
Schema validation errors were encountered.
./target.yaml::$.properties.property: 'not-existing-type' is not of type 'object', 'boolean'
$ cat target.yaml
$schema: "http://json-schema.org/draft-07/schema#"
properties:
property: "not-existing-type"
I don't have a theory about how or why this would happen yet, so for right now I'm marking this as needs-investigation
.
During creating minimal project simulating described behavior I discovered that I have actually another problem:
When check-metaschema parameter is used, validation is processed against json schema, not schema in $schema
property. See https://github.com/jakoubektom/check-jsonschema-issue-400
Should be asked on stack overflow