import Validator from '@syncano/validate'
const validator = new Validator({args, meta, config})
Installing from NPM
npm i @syncano/validate --save
validator.validateRequest(ctx)
| Type |
Name |
Default |
Description |
| object |
ctx |
{} |
Object containing args, meta and config |
export default ctx => {
validator.validateRequest(ctx)
}
validator.validateResponse(responseType, response)
| Type |
Name |
Default |
Description |
| string |
responseType |
|
Name of response defined in syncano.yml |
| mixed |
response |
|
Endpoint response |
export default ctx => {
validator.validateResponse('success', {
messsage: 'Action was successful'
})
}