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