-
Notifications
You must be signed in to change notification settings - Fork 330
Closed
Labels
Description
For other types I can add path manually to custom message, but for arrays I need its index to be printed as well.
Schema Example:
"requestedItems": {
"type": "array",
"minItems": 1,
"items": {
"properties": {
"item": {
"type": "string",
"minLength": 1,
"message": {
"minLength": "Item should not be empty"
}
}
}
}
}
As per the above code when I do not put any value in the item field in the request I get below custom message as specified
"Item should not be empty"
But I want custom message to be printed along with its path, for ex:
"$.requestedItems[0].item: Item should not be empty"
Path gets printed if I remove custom message. A dynamic message created by library would be printed along with field path as shown below.
"$.requestedItems[0].item: must be at least 1 characters long"
But I want the path with custom message. I can add the path along with custom message but for array I can not pass its index. Please help