Skip to content

Add "messages" property #148

@johnmanko

Description

@johnmanko

A continuation of json-schema/json-schema#183

Add a "messages" property to define custom messages for validation keys.

Example:

{
    title: "Name",
    type: "String",
    minLength: 4,
    maxLength: 6,
    messages: {
        minLength: "Your name must be at least four characters long.",
        maxLengh: "Your name must be no more than six characters long"
    }
}

Custom messages of an implementation could allow for template vars. Also consider:

{
    title: "Password",
    type: "pattern",
    pattern: '^[a-zA-Z0-9@#\\$%]{8,20}$',
    messages: {
        pattern: "%title% must be 8-20 characters and must contain only alpha-numeric character or the following @, #, $, %"
    }
}

Related:
geraintluff/tv4#115
geraintluff/tv4#206
json-schema/json-schema#183

Metadata

Metadata

Assignees

No one assigned

    Labels

    clarificationItems that need to be clarified in the specificationvalidation

    Type

    No type

    Projects

    Status

    Closed

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions