{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://splitclubapp.com/schemas/v1/error.json",
  "title": "Error",
  "description": "Every failure. `error` is the first problem (with the request_id to quote); `errors` lists every validation problem when there are several.",
  "x-doc": "schema-error",
  "type": "object",
  "required": [
    "error"
  ],
  "properties": {
    "error": {
      "type": "object",
      "required": [
        "code",
        "message",
        "request_id"
      ],
      "properties": {
        "code": {
          "type": "string",
          "examples": [
            "invalid_type"
          ]
        },
        "message": {
          "type": "string",
          "examples": [
            "`/tiers/0/amount` must be an integer in minor units (e.g. 14500 for $145.00); you sent 145.5."
          ]
        },
        "field": {
          "type": "string",
          "description": "RFC 6901 JSON pointer into the request body; \"\" is the body itself.",
          "examples": [
            "/tiers/0/amount"
          ]
        },
        "expected": {
          "type": "string"
        },
        "example_fix": {
          "type": "string",
          "examples": [
            "\"amount\": 14500"
          ]
        },
        "doc_url": {
          "type": "string",
          "format": "uri",
          "examples": [
            "https://splitclubapp.com/developers#schema-price-tier"
          ]
        },
        "request_id": {
          "type": "string",
          "format": "uuid"
        }
      }
    },
    "errors": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/api_error"
      }
    }
  },
  "$defs": {
    "api_error": {
      "type": "object",
      "additionalProperties": true,
      "required": [
        "code",
        "message",
        "field",
        "expected",
        "example_fix",
        "doc_url"
      ],
      "properties": {
        "code": {
          "type": "string",
          "examples": [
            "invalid_type"
          ]
        },
        "message": {
          "type": "string",
          "examples": [
            "`/tiers/0/amount` must be an integer in minor units (e.g. 14500 for $145.00); you sent 145.5."
          ]
        },
        "field": {
          "type": "string",
          "description": "RFC 6901 JSON pointer into the request body; \"\" is the body itself.",
          "examples": [
            "/tiers/0/amount"
          ]
        },
        "expected": {
          "type": "string"
        },
        "example_fix": {
          "type": "string",
          "examples": [
            "\"amount\": 14500"
          ]
        },
        "doc_url": {
          "type": "string",
          "format": "uri",
          "examples": [
            "https://splitclubapp.com/developers#schema-price-tier"
          ]
        }
      }
    }
  }
}
