The problem
Inconsistent error payloads force client integrations to write custom, brittle try-catch parsers for every API endpoint.
AvoidThe anti-pattern
JSONbad-pattern.json
{
"error": "something failed",
"code": 500
}Inconsistent error format returning plain text or non-standard keys.
PreferThe refactored version
YAMLgood-pattern.yaml
components:
schemas:
ProblemDetails:
type: object
required: [type, title, status]
properties:
type:
type: string
format: uri
example: https://api.example.com/errors/invalid-input
title:
type: string
example: Invalid Input Parameter
status:
type: integer
example: 400
detail:
type: string
example: The provided email address is already registered.RFC 7807 compliant reusable OpenAPI problem details component.
How APIForge checks this
- Evaluates error response declarations across operations
- Ensures 4xx and 5xx status codes are explicitly covered