lib/validators/spec.js
function validateRequiredPropertiesExist (schema, schemaId) {
  /**
   * Recursively collects all properties of the schema and its ancestors. They are added to the props object.
   */
  function collectProperties (schemaObj, props) {
    if (schemaObj.properties) {
      for (var property in schemaObj.properties) {
        if (schemaObj.properties.hasOwnProperty(property)) {
          props[property] = schemaObj.properties[property];
        }
      }
    }
    if (schemaObj.allOf) {
      schemaObj.allOf.forEach(function (parent) {
        collectProperties(parent, props);
      });
    }
  }

  if (schema.required && Array.isArray(schema.required)) {
    var props = {};
    collectProperties(schema, props);
    schema.required.forEach(function (requiredProperty) {
      if (!props[requiredProperty]) {
        throw ono.syntax("Validation failed. Property '%s' listed as required but does not exist in '%s'",
          requiredProperty, schemaId);
      }
    });
  }
}
function validateRequiredPropertiesExist (schema, schemaId) {
  /**
   * Recursively collects all properties of the schema and its ancestors. They are added to the props object.
   */
  function collectProperties (schemaObj, props) {
    if (schemaObj.properties) {
      for (var property in schemaObj.properties) {
        if (schemaObj.properties.hasOwnProperty(property)) {
          props[property] = schemaObj.properties[property];
        }
      }
    }
    if (schemaObj.allOf) {
      schemaObj.allOf.forEach(function (parent) {
        collectProperties(parent, props);
      });
    }
  }

  if (schema.required && Array.isArray(schema.required)) {
    var props = {};
    collectProperties(schema, props);
    schema.required.forEach(function (requiredProperty) {
      if (!props[requiredProperty]) {
        throw ono.syntax("Validation failed. Property '%s' listed as required but does not exist in '%s'",
          requiredProperty, schemaId);
      }
    });
  }
}
function validateRequiredPropertiesExist ( schema , schemaId ) { /**
   * Recursively collects all properties of the schema and its ancestors. They are added to the props object.
   */ function collectProperties ( schemaObj , props ) { if ( schemaObj . properties ) { for ( var property in schemaObj . properties ) { if ( schemaObj . properties . hasOwnProperty ( property ) ) { props [ property ] = schemaObj . properties [ property ] ; } } } if ( schemaObj . allOf ) { schemaObj . allOf . forEach ( function ( parent ) { collectProperties ( parent , props ) ; } ) ; } } if ( schema . required && Array . isArray ( schema . required ) ) { var props = { } ; collectProperties ( schema , props ) ; schema . required . forEach ( function ( requiredProperty ) { if ( ! props [ requiredProperty ] ) { throw ono . syntax ( "Validation failed. Property '%s' listed as required but does not exist in '%s'" , requiredProperty , schemaId ) ; } } ) ; } }
Validates that the declared properties of the given Swagger schema object actually exist.

@param {object}    schema      - A Schema object, from the Swagger API
@param {string}    schemaId    - A value that uniquely identifies the schema object
Validates that the declared properties of the given Swagger schema object actually exist .