var Joi = require('joi'); | |
exports = { | |
path: '/foo/{bar}', | |
method: 'post', | |
config: { | |
validate: { | |
params: { | |
// only allow integers between 5 and 10 (inclusive) | |
bar: Joi.number().integer().min(5).max(10) | |
}, | |
payload: { | |
// only allow two character strings | |
foo: Joi.string().length(2) | |
}, | |
query: { | |
// an integer OR a string containing only digit characters | |
fizz: Joi.alternatives().try( | |
Joi.number().integer(), | |
Joi.string().regex(/^\d+$/) | |
) | |
} | |
} | |
} | |
}; |