Skip to content

Allow specifying custom message at the attribute level #563

@Tim-fors

Description

@Tim-fors

Continuation of discussion from #440 (comment)

The custom message feature allows a user to specify a custom validation message based on the type of validation. However, this is limited in that you can only have one message per type.

It would be nice if it was possible to specify this at each attribute, for example

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "properties": {
    "firstName": {
      "type": "string",
      "description": "The person's first name.",
      "message": {
        "type": "Invalid type, should be string"}
    },
    "foo": {
      "type": "array",
      "maxItems": 3,
      "message": {
        "maxItems" : "MaxItem must be 3 only",
        "type" : "Invalid type, should be array"
      }
    }
  }
}

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