feathers-validate-hook
This is experiment. Work in progress!
Feathers hook for validate json-schema with is-my-json-valid
const validateHook = // Define schema const schema = // Required attribute 'text' with type 'string' text: required: true type: 'string' app
Example
Look example folder for more information.
Test request:
curl -H "Accept: application/json" -X POST http://localhost:3030/messages
Server response example:
{
"name": "BadRequest",
"message": "Validation failed",
"code": 400,
"className": "bad-request",
"data": {},
"errors": [
{
"field": "data.text",
"message": "is required",
"type": "string"
}
]
}