How to use the express-openapi-validate.OpenApiValidator function in express-openapi-validate

To help you get started, we’ve selected a few express-openapi-validate 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 hevans90 / oa3-api-defender / src / spec-validator.ts View on Github external
constructor(
    specPath: string,
    apiUrl: string,
    auth?: string,
    endPointValidator?: EndPointValidator, // simple DI
  ) {
    this.specPath = specPath;
    this.apiUrl = apiUrl;
    this.auth = auth ? auth : undefined;

    if (endPointValidator) {
      this.endPointValidator = endPointValidator;
    }

    this._document = this.loadOpenApiSpec();
    this._oa3Validator = new OpenApiValidator(this.document, {
      ajvOptions: { allErrors: true, verbose: true },
    });
  }

express-openapi-validate

Express middleware to validate request based on an OpenAPI 3 document

Apache-2.0
Latest version published 4 years ago

Package Health Score

50 / 100
Full package analysis