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

It would be very useful if the required property name was included in the error object #417

Closed
ndbroadbent opened this issue Oct 14, 2018 · 1 comment

Comments

@ndbroadbent
Copy link
Contributor

ndbroadbent commented Oct 14, 2018

=> [{:schema=>#<Addressable::URI:0x3ffe4475df78 URI:https://example.com/schema.json>,
  :fragment=>"#/",
  :message=>"The root object did not contain a required property of 'title'",
  :failed_attribute=>"Required"}]

I'm using the errors_as_objects: true option, and was hoping that this would give me "title" somewhere as a value, which would make it easier to work with the errors. With the current data, I need to manually construct a regex to match title in the :message string, which is pretty ugly.

I will work on a PR to add this as a new :failed_property field.

@ndbroadbent
Copy link
Contributor Author

Opened a PR:

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

No branches or pull requests

1 participant