karenetheridge / JSON-Schema-Modern

Validate data against a schema using a JSON Schema
https://metacpan.org/release/JSON-Schema-Modern/
Other
10 stars 1 forks source link

new output_format: "terse" #32

Closed karenetheridge closed 4 years ago

karenetheridge commented 4 years ago

Create a new output format that is like "basic", but does not generate errors from applicator keywords whose subschema(s) failed. This is redundant information for a schema author -- he only wants to know where the original error occurred, and when that is fixed, all the subsequent errors that occurred as a direct consequence will be fixed as well. (That is, _eval should just return failure, without adding more error nodes to the result object.)

Likewise, omit generating errors from unevaluatedItems and unevaluatedProperties when there is already an error generated for this instanceLocation (or a child of it), as the unevaluated thingy is probably due to that existing error.

If this works out well, submit this to json-schema-spec as another standard output format.

karenetheridge commented 4 years ago

This should all be implemented in the ::Result class in the format method. Simply iterate through the errors in order; omit the inclusion of a particular error if it is from the applicator vocabulary and if there already exists an error at the identical instanceLocation (or for unevaluated*, at a child instance location).

karenetheridge commented 4 years ago

This will be especially helpful for keeping the count of errors down to a lower number for conch hardware validations, saving database space and hopefully alleviating some DC operator confusion.

karenetheridge commented 4 years ago

This is now done for release 0.013.