In my model, I have defined a model schema. One of the property is the name which is a required field and minimum character should be of length 5.
@property({
type: 'string',
required: true,
jsonSchema: {
title: 'name',
minLength: 5,
maxLength: 64,
},
})
name: string;
But the issue is the error message I get if validation for name fails is (i.e. I pass less than 5 characters),
{
"error": {
"statusCode": 422,
"name": "UnprocessableEntityError",
"message": "should NOT be shorter than 5 characters"
}
}
How can I define a custom error message?