resthub / resthub-backbone-stack

RESThub Backbone.js stack
http://resthub.org/docs/backbone/
Other
56 stars 26 forks source link

resthub-validation: add the capacity to define custom messages per property and type #113

Closed bmeurant closed 11 years ago

bmeurant commented 11 years ago

resthub-validation allows to define custom messages for constraint types per model or globally.

e.g. for a given model setting custom Min message :

...
messages: {
    'validation.Min.message': 'should be greater than {value} or equals'
}
...

this PR adds the capacity to customize a message for a constraint type AND a property :

e.g. for a given model AND property 'size' setting custom Min message :

...
messages: {
    'validation.size.Min.message': ' size should be greater than {value} or equals'
}
...

The first customization option is obviously still allowed.