Skip to content

Fix verbose example to use $defs #785

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 20, 2019

Conversation

garethsb
Copy link
Contributor

Follows on from 5b08871.

@garethsb
Copy link
Contributor Author

This Verbose example is also missing the "error" messages given in the matching Basic and Detailed examples, e.g.

{
"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"
}
]
}
. Is that an oversight? Potentially a little confusing for a Verbose example to not be as verbose as it could be?

@handrews handrews requested a review from gregsdennis August 20, 2019 03:41
@handrews
Copy link
Contributor

This looks great to me- I'm just leaving it open to make sure @gregsdennis sees the question about "error"

Although for something like "error": "Additional property 'z' found but was invalid." we recently discussed on slack that for this sort of low-level output, it would be more accurate for the error to be about the field matching additionalProperties but failing the false schema.

The idea being that people will probably write more human-friendly tools for analyzing verbose output rather than reading raw JSON, so they could render that error however they like. But noting the error against the false schema is more consistent with how additionalProperties is actually supposed to function as an applicator keyword.

@gregsdennis what are your feelings on this? We can open a separate issue if needed and merge this for now.

@handrews handrews added this to the draft-08 milestone Aug 20, 2019
@gregsdennis
Copy link
Member

Probably an oversight. I have no strong feels about fixing it here or in another PR. Additionally, I don't think that I required having an error property for applicators. Maybe I did; I don't recall, and I can't be bothered to go look it up right now.

it would be more accurate for the error to be about the field matching additionalProperties but failing the false schema

👍

@handrews handrews merged commit 84778d1 into json-schema-org:master Aug 20, 2019
@gregsdennis gregsdennis added clarification Items that need to be clarified in the specification and removed Type: Bug labels Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clarification Items that need to be clarified in the specification
Projects
Development

Successfully merging this pull request may close these issues.

3 participants