Skip to content

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

@ndbroadbent

Description

@ndbroadbent
=> [{: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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions