lib/mock/semantic-response.js
function schemasMatch (schemasToMatch, schemaToTest) {
  let propertiesToTest = 0;
  if (schemaToTest.properties) {
    propertiesToTest = Object.keys(schemaToTest.properties).length;
  }

  return schemasToMatch.some((schemaToMatch) => {
    let propertiesToMatch = 0;
    if (schemaToMatch.properties) {
      propertiesToMatch = Object.keys(schemaToMatch.properties).length;
    }

    // Make sure both schemas are the same type and have the same number of properties
    if (schemaToTest.type === schemaToMatch.type && propertiesToTest === propertiesToMatch) {
      // Compare each property in both schemas
      return _.every(schemaToMatch.properties, (propertyToMatch, propName) => {
        let propertyToTest = schemaToTest.properties[propName];
        return propertyToTest && propertyToMatch.type === propertyToTest.type;
      });
    }
  });
}
function schemasMatch (schemasToMatch, schemaToTest) {
  let propertiesToTest = 0;
  if (schemaToTest.properties) {
    propertiesToTest = Object.keys(schemaToTest.properties).length;
  }

  return schemasToMatch.some((schemaToMatch) => {
    let propertiesToMatch = 0;
    if (schemaToMatch.properties) {
      propertiesToMatch = Object.keys(schemaToMatch.properties).length;
    }

    // Make sure both schemas are the same type and have the same number of properties
    if (schemaToTest.type === schemaToMatch.type && propertiesToTest === propertiesToMatch) {
      // Compare each property in both schemas
      return _.every(schemaToMatch.properties, (propertyToMatch, propName) => {
        let propertyToTest = schemaToTest.properties[propName];
        return propertyToTest && propertyToMatch.type === propertyToTest.type;
      });
    }
  });
}
function schemasMatch ( schemasToMatch , schemaToTest ) { let propertiesToTest = 0 ; if ( schemaToTest . properties ) { propertiesToTest = Object . keys ( schemaToTest . properties ) . length ; } return schemasToMatch . some ( ( schemaToMatch ) => { let propertiesToMatch = 0 ; if ( schemaToMatch . properties ) { propertiesToMatch = Object . keys ( schemaToMatch . properties ) . length ; } // Make sure both schemas are the same type and have the same number of properties if ( schemaToTest . type === schemaToMatch . type && propertiesToTest === propertiesToMatch ) { // Compare each property in both schemas return _ . every ( schemaToMatch . properties , ( propertyToMatch , propName ) => { let propertyToTest = schemaToTest . properties [ propName ] ; return propertyToTest && propertyToMatch . type === propertyToTest . type ; } ) ; } } ) ; }
Determines whether the given JSON schema matches any of the given JSON schemas.

@param   {object[]}  schemasToMatch - An array of JSON schema objects
@param   {object}    schemaToTest   - The JSON schema object to test against the other schemas
@returns {boolean}                  - Returns true if the schema matches any of the other schemas
Determines whether the given JSON schema matches any of the given JSON schemas .