Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const values = Object.keys(args).map((key) => {
const name = args[key].name;
switch (args[key].in) {
case 'request':
return request;
case 'query':
return ValidateParam(args[key], request.query[name], models, name, fieldErrors);
case 'path':
return ValidateParam(args[key], request.params[name], models, name, fieldErrors);
case 'header':
return ValidateParam(args[key], request.header(name), models, name, fieldErrors);
case 'body':
return ValidateParam(args[key], request.body, models, name, fieldErrors, name + '.');
case 'body-prop':
return ValidateParam(args[key], request.body[name], models, name, fieldErrors, 'body.');
}
});
if (Object.keys(fieldErrors).length > 0) {
const values = Object.keys(args).map((key) => {
const name = args[key].name;
switch (args[key].in) {
case 'request':
return request;
case 'query':
return ValidateParam(args[key], request.query[name], models, name, fieldErrors);
case 'path':
return ValidateParam(args[key], request.params[name], models, name, fieldErrors);
case 'header':
return ValidateParam(args[key], request.header(name), models, name, fieldErrors);
case 'body':
return ValidateParam(args[key], request.body, models, name, fieldErrors, name + '.');
case 'body-prop':
return ValidateParam(args[key], request.body[name], models, name, fieldErrors, 'body.');
}
});
if (Object.keys(fieldErrors).length > 0) {
const values = Object.keys(args).map((key) => {
const name = args[key].name;
switch (args[key].in) {
case 'request':
return request;
case 'query':
return ValidateParam(args[key], request.query[name], models, name, fieldErrors);
case 'path':
return ValidateParam(args[key], request.params[name], models, name, fieldErrors);
case 'header':
return ValidateParam(args[key], request.header(name), models, name, fieldErrors);
case 'body':
return ValidateParam(args[key], request.body, models, name, fieldErrors, name + '.');
case 'body-prop':
return ValidateParam(args[key], request.body[name], models, name, fieldErrors, 'body.');
}
});
if (Object.keys(fieldErrors).length > 0) {
const values = Object.keys(args).map((key) => {
const name = args[key].name;
switch (args[key].in) {
case 'request':
return request;
case 'query':
return ValidateParam(args[key], request.query[name], models, name, fieldErrors);
case 'path':
return ValidateParam(args[key], request.params[name], models, name, fieldErrors);
case 'header':
return ValidateParam(args[key], request.header(name), models, name, fieldErrors);
case 'body':
return ValidateParam(args[key], request.body, models, name, fieldErrors, name + '.');
case 'body-prop':
return ValidateParam(args[key], request.body[name], models, name, fieldErrors, 'body.');
}
});
if (Object.keys(fieldErrors).length > 0) {
const values = Object.keys(args).map((key) => {
const name = args[key].name;
switch (args[key].in) {
case 'request':
return request;
case 'query':
return ValidateParam(args[key], request.query[name], models, name, fieldErrors);
case 'path':
return ValidateParam(args[key], request.params[name], models, name, fieldErrors);
case 'header':
return ValidateParam(args[key], request.header(name), models, name, fieldErrors);
case 'body':
return ValidateParam(args[key], request.body, models, name, fieldErrors, name + '.');
case 'body-prop':
return ValidateParam(args[key], request.body[name], models, name, fieldErrors, 'body.');
}
});
if (Object.keys(fieldErrors).length > 0) {