You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would be great to be able to specify custom error message for each property constraint so that jassi would use it as message instead of the default text.
This is handy when developing REST services and want to use custom messages being returned to the caller.
The text was updated successfully, but these errors were encountered:
However, I've been thinking about this issue a bit now and I can see a showstopper.
To be able to specify an error message per each validation keyword, it would mean to extend validation keywords. Either it would contain a value so that default error message is returned, or it would contain an object with value and message to return in case of validation error.
Example:
{
"type": "object",
"properties": {
"firstName": {
"type": {
"value": "string",
"message": "STRING type required"
},
"minLength": {
"value": "6",
"message": "First name must be 6 characters long at least"
}
},
"lastName": {
"type": "string"
},
},
"required": [
{
"value": "firstName",
"message": "First name is required"
},
{
"value": "lastName",
"message": "Last name is mandatory"
}
]
}
The problem is, that this is not a valid JSON schema according to v4 spec.
Would be great to be able to specify custom error message for each property constraint so that
jassi
would use it asmessage
instead of the default text.This is handy when developing REST services and want to use custom messages being returned to the caller.
The text was updated successfully, but these errors were encountered: