Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
)
);
operationContext.methodParameters = methodParameters;
if (methodParameters.length || operationDoc.requestBody) {
// defaults, coercion, and parameter validation middleware
if (
allowsValidationFeature(
this,
this.apiDoc,
pathModule,
pathDoc,
operationDoc
)
) {
const requestValidator = new OpenAPIRequestValidator({
errorTransformer: this.errorTransformer,
logger: this.logger,
parameters: methodParameters,
schemas: this.apiDoc.definitions, // v2
componentSchemas: this.apiDoc.components // v3
? this.apiDoc.components.schemas
: undefined,
externalSchemas: this.externalSchemas,
customFormats: this.customFormats,
requestBody: resolveRequestBodyRefs(
this,
operationDoc.requestBody,
this.apiDoc
) as OpenAPIV3.RequestBodyObject
});
operationContext.features.requestValidator = requestValidator;