json-schema
json-schema copied to clipboard
Add :property_fragment to errors hash, to show which required property was missing
I understand the reasoning behind :fragment => "#/" for a required property that is missing from the root object. But I really needed to know which required property is missing, and I didn't want to parse it out of the message string.
I've added a new :property_fragment to the validation error hash, and this is a more consistent way of detecting which field is causing the validation error. For required fields, it will show the property that is missing. And it will be the same for fields that have the wrong data type, etc (because it falls back to :fragment by default.)
This change should be fully backwards compatible, since it just adds a new key to the error hash.
LGTM
plz2merge @iainbeeston
https://github.com/ruby-json-schema/json-schema/issues/423#issuecomment-634811990