How to use the openapi-schema-validator.default 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 wikimedia / restbase / test / features / schema_tests.js View on Github external
'use strict';

// mocha defines to avoid JSHint breakage
/* global it, before */

const parallel = require('mocha.parallel');
const assert = require('../utils/assert.js');
const Server = require('../utils/server.js');
const preq   = require('preq');
const Ajv = require('ajv');
const OpenAPISchemaValidator = require('openapi-schema-validator').default;
const validator = new OpenAPISchemaValidator({ version: 3 });

parallel('Responses should conform to the provided JSON schema of the response', () => {
    const ajv = new Ajv({});
    const server = new Server();
    function getToday() {
        function zeroPad(num) {
            if (num < 10) {
                return `0${num}`;
            return `${num}`;
        const now = new Date();
        return `${now.getUTCFullYear()}/${zeroPad(now.getUTCMonth() + 1)}/${zeroPad(now.getUTCDate())}`;

    before(() => server.start()


A validator for OpenAPI documents.

Latest version published 1 year ago

Package Health Score

75 / 100
Full package analysis

Popular openapi-schema-validator functions