{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openyacht.org/schemas/v1/error.schema.json",
  "title": "OpenYacht Error",
  "description": "Error envelope for all federation endpoints. The prose spec (spec/api-design.md) is normative; this schema is normative for JSON shape only — on any conflict the prose wins and this schema is defective. HTTP status mappings are a prose rule.",
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "code": {
          "enum": [
            "SIGNATURE_INVALID",
            "TIMESTAMP_OUT_OF_RANGE",
            "PARTNER_UNKNOWN",
            "PARTNER_BLOCKED",
            "PARTNER_PROVISIONAL",
            "NOT_FOUND",
            "GONE",
            "RATE_LIMITED",
            "VALIDATION_ERROR",
            "VERSION_UNSUPPORTED"
          ]
        },
        "message": { "type": "string" },
        "details": {
          "type": ["object", "null"],
          "description": "Code-specific supplementary detail; shape is free-form."
        }
      },
      "required": ["code", "message"],
      "patternProperties": { "^x_": true },
      "additionalProperties": false
    },
    "meta": {
      "type": "object",
      "properties": {
        "request_id": { "type": "string" },
        "time": {
          "type": "string",
          "format": "date-time",
          "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]+)?Z$"
        }
      },
      "required": ["request_id", "time"],
      "patternProperties": { "^x_": true },
      "additionalProperties": false
    }
  },
  "required": ["error", "meta"],
  "patternProperties": { "^x_": true },
  "additionalProperties": false
}
