We need the possibility to validate the incoming payload.
Popular valdiation librarys:
https://github.com/rjrodger/parambulator
https://github.com/hapijs/joi
We could use the same approach as in seneca.
//parambulator
.define(
{
a: 1,
b: {required$: true}
},
function (msg, done) {
done(null, {c: msg.b})
})
//Joi
.define(
{
a: 1,
b: Joi.required()
},
function (msg, done) {
done(null, {c: msg.b})
})