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 f062e2b37f - Show all commits

View File

@ -257,9 +257,9 @@ export const get = ({ server, model, prefix = '/', config }) => {
}, },
config: _.defaultsDeep(config, { config: _.defaultsDeep(config, {
validate: { validate: {
params: joi.object().keys({ params: {
id: joi.any(), id: joi.any(),
}), },
}, },
}), }),
}); });
@ -285,9 +285,9 @@ export const scope = ({ server, model, prefix = '/', config }) => {
}, },
config: _.defaultsDeep(config, { config: _.defaultsDeep(config, {
validate: { validate: {
params: joi.object().keys({ params: {
scope: joi.string().valid(...scopes), scope: joi.string().valid(...scopes),
}), },
}, },
}), }),
}); });
@ -372,9 +372,9 @@ export const destroyScope = ({ server, model, prefix = '/', config }) => {
}, },
config: _.defaultsDeep(config, { config: _.defaultsDeep(config, {
validate: { validate: {
params: joi.object().keys({ params: {
scope: joi.string().valid(...scopes), scope: joi.string().valid(...scopes),
}), },
}, },
}), }),
}); });
@ -400,9 +400,9 @@ export const update = ({ server, model, prefix = '/', config }) => {
config: _.defaultsDeep(config, { config: _.defaultsDeep(config, {
validate: { validate: {
payload: joi.object().required(), payload: joi.object().required(),
params: joi.object().keys({ params: {
id: joi.any(), id: joi.any(),
}), },
}, },
}), }),
}); });