Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const errorTransformer =
typeof args.errorTransformer === 'function' && args.errorTransformer;
const errorMapper = errorTransformer
? extendedErrorMapper(errorTransformer)
: toOpenapiValidationError;
let bodyValidationSchema;
let bodySchema;
let headersSchema;
let formDataSchema;
let pathSchema;
let querySchema;
let isBodyRequired;
if (args.parameters !== undefined) {
if (Array.isArray(args.parameters)) {
const schemas = convertParametersToJSONSchema(args.parameters);
bodySchema = schemas.body;
headersSchema = lowercasedHeaders(schemas.headers);
formDataSchema = schemas.formData;
pathSchema = schemas.path;
querySchema = schemas.query;
isBodyRequired =
// @ts-ignore
args.parameters.filter(byRequiredBodyParameters).length > 0;
} else {
throw new Error(`${loggingKey}args.parameters must be an Array`);
}
}
const v = new Ajv({
useDefaults: true,
allErrors: true,