{"section":"error-handling","title":"Error Handling Rules","description":"Rules for error response formats","totalRules":3,"spectralRules":[{"name":"error-response-structure","severity":"info","message":"Error responses should follow RFC 7807 Problem Details format","description":"Validates that 4xx and 5xx responses include problem detail fields","given":"$.paths[*][*].responses[?(@property >= '400' && @property <= '599')].content['application/json'].schema","then":{"function":"schema","functionOptions":{"schema":{"type":"object","properties":{"properties":{"type":"object","anyOf":[{"required":["type"]},{"required":["title"]},{"required":["status"]}]}}}}}},{"name":"error-content-type","severity":"info","message":"Error responses should use application/problem+json content type","given":"$.paths[*][*].responses[?(@property >= '400' && @property <= '599')].content","then":{"field":"application/problem+json","function":"truthy"}}],"rules":[{"id":"rfc7807-format","requirement":"SHOULD","rule":"Error responses should follow RFC 7807 Problem Details format","severity":"info","spectralRule":"error-response-structure","examples":{"recommended":["{\n  \"type\": \"https://api.example.com/errors/validation\",\n  \"title\": \"Validation Error\",\n  \"status\": 422,\n  \"detail\": \"The request body contains invalid data.\"\n}\n"]}},{"id":"problem-json-content-type","requirement":"SHOULD","rule":"Use application/problem+json content type for errors","severity":"info","spectralRule":"error-content-type"},{"id":"no-stack-traces","requirement":"MUST NOT","rule":"Include stack traces in production error responses","severity":"error","rationale":"Stack traces expose internal implementation details and security vulnerabilities"}]}