This uses all adjacent (same schema) results to calculate unevaluated keys/items, whether the keywords validated successfully or not. Previously, it only considered valid results, which causes confusing errors:
schemer = JSONSchemer.schema({
'properties' => {
'x' => {
'type' => 'integer'
}
},
'unevaluatedProperties' => false
})
schemer.validate({ 'x' => 'invalid' }).map { _1.fetch_values('schema_pointer', 'error') }
# =>
# [["/properties/x", "value at `/x` is not an integer"],
# ["/unevaluatedProperties", "value at `/x` does not match schema"]]
The overall validation result shouldn't be affected, since the only additional keywords that it considers are failed ones (meaning the entire schema fails regardless of the unevaluated keys/items). Duplicate/unhelpful error messages are reduced, though, which is the main reason for making this change.
Generally, this interpretation doesn't align with my reading of the spec, but there's been a lot of discussion around it and I think it makes sense from a user experience perspective. Hopefully it will get clarified in a future draft.
This uses all adjacent (same schema) results to calculate unevaluated keys/items, whether the keywords validated successfully or not. Previously, it only considered valid results, which causes confusing errors:
The overall validation result shouldn't be affected, since the only additional keywords that it considers are failed ones (meaning the entire schema fails regardless of the unevaluated keys/items). Duplicate/unhelpful error messages are reduced, though, which is the main reason for making this change.
Generally, this interpretation doesn't align with my reading of the spec, but there's been a lot of discussion around it and I think it makes sense from a user experience perspective. Hopefully it will get clarified in a future draft.
Closes: https://github.com/davishmcclurg/json_schemer/issues/157
Related: