lib/validators/schema.js
function validateSchema (api) {
  // Choose the appropriate schema (Swagger or OpenAPI)
  var schema = api.swagger
    ? require("swagger-schema-official/schema.json")
    : require("openapi-schema-validation/schema/openapi-3.0.json");

  var isValid = ZSchema.validate(api, schema);

  if (!isValid) {
    var err = ZSchema.getLastError();
    var message = "Swagger schema validation failed. \n" + formatZSchemaError(err.details);
    throw ono.syntax(err, { details: err.details }, message);
  }
}
function validateSchema (api) {
  // Choose the appropriate schema (Swagger or OpenAPI)
  var schema = api.swagger
    ? require("swagger-schema-official/schema.json")
    : require("openapi-schema-validation/schema/openapi-3.0.json");

  var isValid = ZSchema.validate(api, schema);

  if (!isValid) {
    var err = ZSchema.getLastError();
    var message = "Swagger schema validation failed. \n" + formatZSchemaError(err.details);
    throw ono.syntax(err, { details: err.details }, message);
  }
}
function validateSchema ( api ) { // Choose the appropriate schema (Swagger or OpenAPI) var schema = api . swagger ? require ( "swagger-schema-official/schema.json" ) : require ( "openapi-schema-validation/schema/openapi-3.0.json" ) ; var isValid = ZSchema . validate ( api , schema ) ; if ( ! isValid ) { var err = ZSchema . getLastError ( ) ; var message = "Swagger schema validation failed. \n" + formatZSchemaError ( err . details ) ; throw ono . syntax ( err , { details : err . details } , message ) ; } }
Validates the given Swagger API against the Swagger 2.0 or 3.0 schema.

@param {SwaggerObject} api
Validates the given Swagger API against the Swagger 2 . 0 or 3 . 0 schema .