How to use openapi-request-validator - 1 common examples

To help you get started, we’ve selected a few openapi-request-validator examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kogosoftwarellc / open-api / packages / openapi-framework / index.ts View on Github external
)
            );
            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;

openapi-request-validator

Validate request properties against an OpenAPI spec.

MIT
Latest version published 2 years ago

Package Health Score

59 / 100
Full package analysis

Popular openapi-request-validator functions