Skip to content

[Feature Request] Adding custom error message for each json field #517

@antonkhmara

Description

@antonkhmara

It would be helpful to have a way to override the default error message, either through interceptors or by specifying it within the JSON schema.

For example, consider this object:

           "reference": {
              "maxLength": 2147483647,
              "minLength": 6,
              "pattern": "^[A-Za-z0-9 /.-]*$",
              "type": "string",
              "description": "Reference Data.",
              "example": "Az074-124",
              "errorMessage": [
                {
                  "pattern": "must be alphanumeric and can contain only the following special characters: /.-"
                }
              ]
            }

In this case, instead of displaying the default error message:
#/payoutDefaults/compliance/reference: string [@#] does not match pattern ^[A-Za-z0-9 /.-]*$,
we would see the message defined in the errorMessage property:
#/payoutDefaults/compliance/reference: must be alphanumeric and can contain only the following special characters: /.-.

It would be greatly appreciated if there’s already a way to override the default error message! 🙏

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