in packages/rulesets/src/spectral/functions/error-response.ts [164:190]
function errorResponse(responses:any, _opts:any, paths:any) {
const errors = [];
const path = paths.path || [];
// Note: az-default-response rule will flag missing default response
if (responses.default) {
errors.push(
...validateErrorResponse(responses.default, [...path, 'default']),
);
}
Object.keys(responses).filter((code) => code.match(/[45]\d\d/)).forEach((code) => {
errors.push(
...validateErrorResponse(responses[code], [...path, code]),
);
// The error response should contain x-ms-error-response: true
if (!(responses[code]['x-ms-error-response'])) {
errors.push({
message: 'Error response should contain x-ms-error-response.',
path: [...path, code],
});
}
});
return errors;
}