Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (operationContext.allowsFeatures) {
// add features
if (
operationDoc.responses &&
allowsResponseValidationFeature(
this,
this.apiDoc,
pathModule,
pathDoc,
operationDoc
)
) {
// add response validation feature
// it's invalid for a method doc to not have responses, but the post
// validation will pick it up, so this is almost always going to be added.
const responseValidator = new OpenAPIResponseValidator({
loggingKey: `${this.name}-response-validation`,
components: this.apiDoc.components,
definitions: this.apiDoc.definitions,
externalSchemas: this.externalSchemas,
errorTransformer: this.errorTransformer,
responses: resolveResponseRefs(
this,
operationDoc.responses,
this.apiDoc,
route
),
customFormats: this.customFormats
});
operationContext.features.responseValidator = responseValidator;
}