Description
Specification section
This is about the "Basic" output description: "https://json-schema.org/draft/2020-12/json-schema-core#section-12.4.2"
What is unclear?
Given this example for the "Basic" format:
{
"valid": false,
"errors": [
{
"keywordLocation": "",
"instanceLocation": "",
"error": "A subschema had errors."
},
{
"keywordLocation": "/items/$ref",
"absoluteKeywordLocation":
"https://example.com/polygon#/$defs/point",
"instanceLocation": "/1",
"error": "A subschema had errors."
},
{
"keywordLocation": "/items/$ref/required",
"absoluteKeywordLocation":
"https://example.com/polygon#/$defs/point/required",
"instanceLocation": "/1",
"error": "Required property 'y' not found."
},
{
"keywordLocation": "/items/$ref/additionalProperties",
"absoluteKeywordLocation":
"https://example.com/polygon#/$defs/point/additionalProperties",
"instanceLocation": "/1/z",
"error": "Additional property 'z' found but was invalid."
},
{
"keywordLocation": "/minItems",
"instanceLocation": "",
"error": "Expected at least 3 items but found 2"
}
]
}
I feel like it should be valid against {"$ref": "https://json-schema.org/draft/2020-12/output/schema#/$defs/basic"}
, but it is not. It is only valid agains {"$ref": "https://json-schema.org/draft/2020-12/output/schema"}
which is expected.
But if you remove {"$ref": "#/$defs/flag"}
in https://json-schema.org/draft/2020-12/output/schema#/anyOf
then it is no more valid against {"$ref": "https://json-schema.org/draft/2020-12/output/schema"}
Validation passes if we add the "keywordLocation": "", "instanceLocation": ""
at the top level.
And now the following is valid against ...#/$defs/basic
:
{
"valid": false,
"keywordLocation": "",
"instanceLocation": "",
"errors": [
{
"valid": 123,
"some": "thing"
}
]
}
Because, if I understand correctly, it still validates flag only.
Proposal
Do you have an idea to make the text more clear?
It's probably the wrong place for this issue because I'd prefer to change the spec itself:
- Define "Flag" format for the top level of the ouput only
- Do not require instanceLocation and keywordLocation for the top level
Thank you
Do you think this work might require an [Architectural Decision Record (ADR)]? (significant or noteworthy)
Not sure
Metadata
Metadata
Assignees
Type
Projects
Status