{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://api-evangelist.github.io/restful-services/schemas/rest-error",
  "title": "REST Error Response",
  "description": "Standard error response format for RESTful services, aligned with RFC 7807 Problem Details for HTTP APIs.",
  "type": "object",
  "properties": {
    "type": {
      "type": "string",
      "format": "uri",
      "description": "URI reference identifying the problem type (RFC 7807)"
    },
    "title": {
      "type": "string",
      "description": "Short, human-readable summary of the problem type"
    },
    "status": {
      "type": "integer",
      "description": "HTTP status code (e.g., 400, 404, 422, 500)"
    },
    "detail": {
      "type": "string",
      "description": "Human-readable explanation specific to this occurrence"
    },
    "instance": {
      "type": "string",
      "format": "uri",
      "description": "URI reference identifying the specific occurrence of the problem"
    },
    "errors": {
      "type": "array",
      "description": "Field-level validation errors",
      "items": {
        "type": "object",
        "properties": {
          "field": { "type": "string" },
          "message": { "type": "string" },
          "code": { "type": "string" }
        }
      }
    }
  },
  "required": ["status", "title"]
}
