Skip to content

Error message is not parsed properly #38

@nav16

Description

@nav16

I am using it in a engine core, on Rails 5.2.0

validates :children, json: { schema: CHILDREN_SCHEMA }

I am not getting proper error message

"children": [
            "translation missing: en.activerecord.errors.models.core/user.attributes.children.invalid_json"
        ]

After adding :message option

validates :children, json: { message: ->(errors) { errors }, schema: CHILDREN_SCHEMA }

The error message is:

"children": [
            "The property '#/0' did not contain a required property of 'gender' in schema file:///Users/navneet/rails_app/components/core/app/models/schemas/children.json"
        ]

Is there any way to change the message format similar to:

"children": [
        "0": {
            "gender property missing"
        }
    ]

Any suggestions will be helpful.

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