Validate query and payload #20

Merged
joeybaker merged 14 commits from error-on-invalid-where into master 2016-09-06 18:29:40 +00:00
Showing only changes of commit b35bd23c91 - Show all commits

View File

@ -110,13 +110,13 @@ export const get = ({ server, model, prefix = '/', config }) => {
reply(instance);
},
config: _.defaultsDeep({
config: _.defaultsDeep(config, {
validate: {
params: joi.object().keys({
id: joi.any(),
}),
},
}, config),
}),
});
};
@ -138,13 +138,13 @@ export const scope = ({ server, model, prefix = '/', config }) => {
reply(list);
},
config: _.defaultsDeep({
config: _.defaultsDeep(config, {
validate: {
params: joi.object().keys({
scope: joi.string().valid(...scopes),
}),
},
}, config),
}),
});
};
@ -225,13 +225,13 @@ export const destroyScope = ({ server, model, prefix = '/', config }) => {
reply(list);
},
config: _.defaultsDeep({
config: _.defaultsDeep(config, {
validate: {
params: joi.object().keys({
scope: joi.string().valid(...scopes),
}),
},
}, config),
}),
});
};
@ -256,11 +256,11 @@ export const update = ({ server, model, prefix = '/', config }) => {
reply(instance);
},
config: _.defaultsDeep({
config: _.defaultsDeep(config, {
validate: {
payload: joi.object().required(),
},
}, config),
}),
});
};