{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/blockvectra/json-schema/blockvectra-subscription-patch-schema.json",
  "title": "SubscriptionPatch",
  "x-generated": "2026-11-02",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/push.yaml#/components/schemas/SubscriptionPatch",
  "type": "object",
  "additionalProperties": false,
  "minProperties": 1,
  "properties": {
    "url": {
      "$ref": "#/$defs/Url"
    },
    "status": {
      "type": "string",
      "enum": [
        "online",
        "offline"
      ]
    },
    "key_id": {
      "$ref": "#/$defs/KeyId"
    },
    "chains": {
      "type": "object",
      "minProperties": 1,
      "propertyNames": {
        "$ref": "#/$defs/ChainName"
      },
      "description": "Merge patch keyed by chain: an object adds the chain or changes its N, null removes it.",
      "additionalProperties": {
        "oneOf": [
          {
            "$ref": "#/$defs/ChainSettings"
          },
          {
            "type": "null"
          }
        ]
      }
    }
  },
  "$defs": {
    "ChainName": {
      "type": "string",
      "pattern": "^[a-z][a-z0-9]*(_[a-z0-9]+)+$",
      "description": "lower(chain_slug), ES-030 rule 10."
    },
    "ChainSettings": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "confirmations": {
          "type": "integer",
          "minimum": 1,
          "description": "N for this chain, from min_confirmations to max_confirmations; omitted means default_confirmations."
        }
      }
    },
    "KeyId": {
      "type": "string",
      "pattern": "^k_[0-9a-f]{12}$"
    },
    "Url": {
      "type": "string",
      "maxLength": 2048,
      "pattern": "^https://",
      "description": "https, port 443, a host name (no IP literal), no userinfo or fragment; stored and returned normalized."
    }
  }
}