function createTailoredParameterError()

in src/core/plugins/err/error-transformers/transformers/parameter-oneof.js [30:59]


function createTailoredParameterError(err, jsSpec) {
  let newErrs = []
  let parameter = get(jsSpec, err.get("path"))

  // find addressable cases
  if(parameter.in && VALID_IN_VALUES.indexOf(parameter.in) === -1) {
    let message = `Wrong value for the "in" keyword. Expected one of: ${VALID_IN_VALUES.join(", ")}.`
    newErrs.push({
      message,
      path: err.get("path") + ".in",
      type: "spec",
      source: "structural",
      level: "error"
    })
  }

  if(parameter.collectionFormat && VALID_COLLECTIONFORMAT_VALUES.indexOf(parameter.collectionFormat) === -1) {
    let message = `Wrong value for the "collectionFormat" keyword. Expected one of: ${VALID_COLLECTIONFORMAT_VALUES.join(", ")}.`
    newErrs.push({
      message,
      path: err.get("path") + ".collectionFormat",
      type: "spec",
      source: "structural",
      level: "error"
    })
  }

  return newErrs.length ? fromJS(newErrs) : err // fall back to making no changes

}