lib/validators/spec.js
function validatePathParameters (params, pathId, operationId) {
  // Find all {placeholders} in the path string
  var placeholders = pathId.match(util.swaggerParamRegExp) || [];

  // Check for duplicates
  for (var i = 0; i < placeholders.length; i++) {
    for (var j = i + 1; j < placeholders.length; j++) {
      if (placeholders[i] === placeholders[j]) {
        throw ono.syntax(
          "Validation failed. %s has multiple path placeholders named %s", operationId, placeholders[i]);
      }
    }
  }

  params
    .filter(function (param) { return param.in === "path"; })
    .forEach(function (param) {
      if (param.required !== true) {
        throw ono.syntax(
          'Validation failed. Path parameters cannot be optional. Set required=true for the "%s" parameter at %s',
          param.name,
          operationId
        );
      }
      var match = placeholders.indexOf("{" + param.name + "}");
      if (match === -1) {
        throw ono.syntax(
          'Validation failed. %s has a path parameter named "%s", ' +
          "but there is no corresponding {%s} in the path string",
          operationId,
          param.name,
          param.name
        );
      }
      placeholders.splice(match, 1);
    });

  if (placeholders.length > 0) {
    throw ono.syntax("Validation failed. %s is missing path parameter(s) for %s", operationId, placeholders);
  }
}
function validatePathParameters (params, pathId, operationId) {
  // Find all {placeholders} in the path string
  var placeholders = pathId.match(util.swaggerParamRegExp) || [];

  // Check for duplicates
  for (var i = 0; i < placeholders.length; i++) {
    for (var j = i + 1; j < placeholders.length; j++) {
      if (placeholders[i] === placeholders[j]) {
        throw ono.syntax(
          "Validation failed. %s has multiple path placeholders named %s", operationId, placeholders[i]);
      }
    }
  }

  params
    .filter(function (param) { return param.in === "path"; })
    .forEach(function (param) {
      if (param.required !== true) {
        throw ono.syntax(
          'Validation failed. Path parameters cannot be optional. Set required=true for the "%s" parameter at %s',
          param.name,
          operationId
        );
      }
      var match = placeholders.indexOf("{" + param.name + "}");
      if (match === -1) {
        throw ono.syntax(
          'Validation failed. %s has a path parameter named "%s", ' +
          "but there is no corresponding {%s} in the path string",
          operationId,
          param.name,
          param.name
        );
      }
      placeholders.splice(match, 1);
    });

  if (placeholders.length > 0) {
    throw ono.syntax("Validation failed. %s is missing path parameter(s) for %s", operationId, placeholders);
  }
}
function validatePathParameters ( params , pathId , operationId ) { // Find all {placeholders} in the path string var placeholders = pathId . match ( util . swaggerParamRegExp ) || [ ] ; // Check for duplicates for ( var i = 0 ; i < placeholders . length ; i ++ ) { for ( var j = i + 1 ; j < placeholders . length ; j ++ ) { if ( placeholders [ i ] === placeholders [ j ] ) { throw ono . syntax ( "Validation failed. %s has multiple path placeholders named %s" , operationId , placeholders [ i ] ) ; } } } params . filter ( function ( param ) { return param . in === "path" ; } ) . forEach ( function ( param ) { if ( param . required !== true ) { throw ono . syntax ( 'Validation failed. Path parameters cannot be optional. Set required=true for the "%s" parameter at %s' , param . name , operationId ) ; } var match = placeholders . indexOf ( "{" + param . name + "}" ) ; if ( match === - 1 ) { throw ono . syntax ( 'Validation failed. %s has a path parameter named "%s", ' + "but there is no corresponding {%s} in the path string" , operationId , param . name , param . name ) ; } placeholders . splice ( match , 1 ) ; } ) ; if ( placeholders . length > 0 ) { throw ono . syntax ( "Validation failed. %s is missing path parameter(s) for %s" , operationId , placeholders ) ; } }
Validates path parameters for the given path.

@param   {object[]}  params        - An array of Parameter objects
@param   {string}    pathId        - A value that uniquely identifies the path
@param   {string}    operationId   - A value that uniquely identifies the operation
Validates path parameters for the given path .