function validateErrorResponse()

in functions/error-response.js [137:156]


function validateErrorResponse(errorResponse, responsePath) {
  const errors = [];

  // The error response schema should conform to Microsoft API Guidelines
  if (!errorResponse.schema) {
    const method = responsePath[responsePath.length - 3];
    if (method !== 'head') {
      errors.push({
        message: 'Error response should have a schema.',
        path: responsePath,
      });
    }
  } else {
    errors.push(
      ...validateErrorResponseSchema(errorResponse.schema, [...responsePath, 'schema']),
    );
  }

  return errors;
}