Skip to content
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

Add :property_fragment to errors hash, to show which required property was missing #420

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ndbroadbent
Copy link
Contributor

@ndbroadbent ndbroadbent commented Oct 14, 2018

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.

@RST-J
Copy link
Contributor

RST-J commented Nov 17, 2018

LGTM

@RST-J RST-J requested a review from iainbeeston November 17, 2018 12:57
@ssrihari
Copy link

plz2merge @iainbeeston

@pboling
Copy link

pboling commented Feb 14, 2021

#423 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants