How to use the openapi-schema-validator function in openapi-schema-validator

To help you get started, we’ve selected a few openapi-schema-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 marblejs / marble / packages / testing / src / spec / testing.spec.ts View on Github external
).collect(peopleCollection);
    (
      await testApi.post('/notes')
        .withBody({
          author: 'Cathy',
          date: '2019-06-11T09:30:00.000Z',
          note: 'This is a sample note.'
        })
        .send()
    ).collect(notesCollection);

    testApi.finish();

    const openApiDoc = doc.generate();

    const validator = new OpenAPIValidator({
      version: '3.0',
    });
    expect(validator.validate(openApiDoc).errors).toEqual([]);
  });
});
github kogosoftwarellc / open-api / packages / openapi-framework / index.ts View on Github external
this.loggingPrefix
        }args.paths and args.operations must not both be empty`
      );
    }

    this.enableObjectCoercion = !!args.enableObjectCoercion;
    this.originalApiDoc = handleYaml(handleFilePath(args.apiDoc));
    this.apiDoc = copy(this.originalApiDoc);
    this.basePaths = this.apiDoc.openapi
      ? getBasePathsFromServers(this.apiDoc.servers)
      : [
          new BasePath({ url: (this.apiDoc.basePath || '').replace(/\/$/, '') })
        ];
    this.validateApiDoc =
      'validateApiDoc' in args ? !!args.validateApiDoc : true;
    this.validator = new OpenAPISchemaValidator({
      version:
        (this.apiDoc as OpenAPIV3.Document).openapi ||
        (this.apiDoc as OpenAPIV2.Document).swagger,
      extensions: this.apiDoc[`x-${this.name}-schema-extension`]
    });
    this.customFormats = args.customFormats;
    this.dependencies = args.dependencies;
    this.errorTransformer = args.errorTransformer;
    this.externalSchemas = args.externalSchemas;
    this.operations = args.operations;
    this.paths = args.paths;
    this.pathsIgnore = args.pathsIgnore;
    this.pathSecurity = Array.isArray(args.pathSecurity)
      ? args.pathSecurity
      : [];
    this.routesGlob = args.routesGlob;

openapi-schema-validator

A validator for OpenAPI documents.

MIT
Latest version published 1 year ago

Package Health Score

75 / 100
Full package analysis

Popular openapi-schema-validator functions