Closed jbomer closed 5 years ago
@jbomer You need clarify what the problem is. Is this an issue with the JSON Schema specification, or a library that you're using?
Too complicated and large JSON Schema specification draft-8 output format for me. No problem, only my idea.
@jbomer I'm not sure what you mean by "output format". Where do you see that? Be specific.
https://json-schema.org/work-in-progress/WIP-jsonschema-core.html#rfc.section.12.2 https://json-schema.org/work-in-progress/WIP-jsonschema-core.html#rfc.section.12.2
Od: "Austin Wright" notifications@github.com Komu: "json-schema-org/json-schema-spec" json-schema-spec@noreply.github.com Datum: 24.06.2019 09:39 Předmět: Re: [json-schema-org/json-schema-spec] draft-8 otput fromat (#754)
@jbomer https://github.com/jbomer I'm not sure what you mean by "output format". Where do you see that? Be specific. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/json-schema-org/json-schema-spec/issues/754?email_source=notifications&email_token=ACQOT6SXQIB2XARZQIF7HZ3P4B22HA5CNFSM4H226EAKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYMBUJI#issuecomment-504896037, or mute the thread https://github.com/notifications/unsubscribe-auth/ACQOT6RW2MT72D3E6SLU3K3P4B22HANCNFSM4H226EAA.
@awwright, I think he means the new standard output format in draft 8.
@jbomer I wrote that part. There are four different output formats
Which one was too complicated for you?
In response to your suggestion of using a dictionary for the output, we needed something more complex because each keyword has several points of data to report on
$ref
sYou can easily transform this structure into whatever you need.
If you'd like to play around with it, my implementation, Manatee.Json (.Net), has a beta version that supports draft 8, including the output format.
Lastly, feel free to go read the issues that were opened to discuss a standardized output format. There's plenty of discussion there as to why we made the decisions we did.
detailed output (in draft-8 12.4.3):
{ "valid": false, "keywordLocation": "#", "instanceLocation": "#", "errors": [ { "valid": false, "keywordLocation": "#/items/$ref", "absoluteKeywordLocation": "http://example.com/polygon#/$defs/point", "instanceLocation": "#/1", "errors": [ { "valid": false, "keywordLocation": "#/items/$ref/required", "absoluteKeywordLocation": "http://example.com/polygon#/$defs/point/required", "instanceLocation": "#/1", "error": "Required property 'y' not found." }, { "valid": false, "keywordLocation": "#/items/$ref/additionalProperties", "absoluteKeywordLocation": "http://example.com/polygon#/$defs/point/additionalProperties", "instanceLocation": "#/1/z", "error": "Additional property 'z' found but was invalid." } ] }, { "valid": false, "keywordLocation": "#/minItems", "instanceLocation": "#", "error": "Expected at least 3 items but found 2" } ] }
my idea of this output:
{
"valid": false,
"shemaLocation": "#",
"instanceLocation": "#",
"error": "MinItems error. Items [1] subschema error.",
"keywords": [
["minItem"],
["items", [1]]
],
"errors": [
{
"valid": false,
"schemaLocation": "#/items/$ref/",
"instanceLocation": "#/1",
"error": "Required properties ['y'] not found. Additional propertis ['z'] subschema error",
"keywords": [
["required", ["y"]],
["additionalProperties", ["z"]]
]
}
]
}
Please format large code blocks. That's nearly impossible to read.
The issue I linked was opened almost exactly a year ago (1y1d). You've has plenty of time to suggest an alternative. We're in final approval and now you want to change it. It's just not going to happen.
Maybe in the next version, but you'll need to explain the logic you're using to build your output format and how it fulfills all of the same data points and requirements. (I suggest you read those issues to find out what the requirements are.)
Closing this issue because it sounds like you're asking for something which will be possible due to the different levels of output support.
output format is one(schema) to many(errors) type
better for me is one(schema) to one(error) type
type Error = { valid:boolean, schemaLocation:string,//keyword in description absoluteSchemaLocation:string description:[keyword, message, ?instanceProperties(Items)[]] //ex. for object description:[ ['properties', 'properties subschema error', ['bar', 'foo']] ['additionalProperties', 'additionalProperties subschema error', ['x', 'y']] ] //ex. for array description:[ ['items', 'items subschema error',[3, 5]] ['allOf', 'allOf logic subschema(s) error'] ] //ex. for string description:['maxLength', 'some constraint error message']
}