{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/stackit/main/json-schema/stackit-route-schema.json",
  "title": "Route",
  "description": "Object represents a network route.",
  "x-generated": "2026-10-18",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/stackit-iaas-openapi.yml#/components/schemas/Route",
  "properties": {
    "createdAt": {
      "allOf": [
        {
          "$ref": "#/$defs/CreatedAt"
        }
      ],
      "readOnly": true
    },
    "destination": {
      "oneOf": [
        {
          "$ref": "#/$defs/DestinationCIDRv4"
        },
        {
          "$ref": "#/$defs/DestinationCIDRv6"
        }
      ],
      "properties": {
        "type": {
          "$ref": "#/$defs/v2RouteDestinationType"
        }
      },
      "required": [
        "type"
      ],
      "type": "object",
      "x-stackit-logging": true
    },
    "id": {
      "allOf": [
        {
          "$ref": "#/$defs/UUID"
        }
      ],
      "readOnly": true
    },
    "labels": {
      "$ref": "#/$defs/Labels"
    },
    "nexthop": {
      "oneOf": [
        {
          "$ref": "#/$defs/NexthopIPv4"
        },
        {
          "$ref": "#/$defs/NexthopIPv6"
        },
        {
          "$ref": "#/$defs/NexthopInternet"
        },
        {
          "$ref": "#/$defs/NexthopBlackhole"
        }
      ],
      "properties": {
        "type": {
          "type": "string",
          "x-stackit-logging": true
        }
      },
      "required": [
        "type"
      ],
      "type": "object",
      "x-stackit-logging": true
    },
    "updatedAt": {
      "allOf": [
        {
          "$ref": "#/$defs/UpdatedAt"
        }
      ],
      "readOnly": true
    }
  },
  "required": [
    "destination",
    "nexthop"
  ],
  "type": "object",
  "$defs": {
    "CreatedAt": {
      "description": "Date-time when resource was created.",
      "format": "date-time",
      "type": "string"
    },
    "DestinationCIDRv4": {
      "description": "IPv4 Classless Inter-Domain Routing (CIDR) Object.",
      "properties": {
        "type": {
          "enum": [
            "cidrv4"
          ],
          "type": "string",
          "x-stackit-logging": true
        },
        "value": {
          "description": "An CIDRv4 string.",
          "pattern": "^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\\/(3[0-2]|2[0-9]|1[0-9]|[0-9]))$",
          "type": "string",
          "x-stackit-logging": true
        }
      },
      "required": [
        "type",
        "value"
      ],
      "type": "object"
    },
    "DestinationCIDRv6": {
      "description": "IPv6 Classless Inter-Domain Routing (CIDR) Object.",
      "properties": {
        "type": {
          "enum": [
            "cidrv6"
          ],
          "type": "string",
          "x-stackit-logging": true
        },
        "value": {
          "description": "An CIDRv6 string.",
          "pattern": "^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))(\\/((1(1[0-9]|2[0-8]))|([0-9][0-9])|([0-9])))?$",
          "type": "string",
          "x-stackit-logging": true
        }
      },
      "required": [
        "type",
        "value"
      ],
      "type": "object"
    },
    "Labels": {
      "description": "Object that represents the labels as key-value pairs of a resource.\nKey constraints: - May contain an optional domain prefix separated by a slash (`/`). - Domain prefix must be less than or equal to 250 characters. - Domain prefix must ba a valid DNS subdomain containing only lowercase alphanumerics (`[a-z0-9]`) and dashes (`-`), separated by dots (`.`). - Length (excluding the domain prefix) must be between 1 and 63 characters. - Must begin and end with an alphanumerical character (`[a-z0-9A-Z]`). - May contain dashes (`-`), underscores (`_`), dots (`.`), and alphanumerics in between. - Keys starting with the prefix `stackit-` or having a domain prefix of `stackit.cloud` (including its subdomains, e.g., `*.stackit.cloud/`) are reserved for system use.\nValue constraints: - Must be less than or equal to 63 characters long (can be empty). - If not empty it must begin and end with an alphanumeric character (`[a-z0-9A-Z]`). - May contain dashes (`-`), underscores (`_`), dots (`.`), and alphanumerics in between.\nA resource can have a maximum of 64 labels. Reserved labels are excluded from this count. Providing a `null` value for a key will remove that key.",
      "format": "json",
      "type": "object"
    },
    "NexthopBlackhole": {
      "description": "Object that represents a blackhole route.",
      "properties": {
        "type": {
          "enum": [
            "blackhole"
          ],
          "type": "string",
          "x-stackit-logging": true
        }
      },
      "required": [
        "type"
      ],
      "type": "object"
    },
    "NexthopIPv4": {
      "description": "Object that represents an IPv4 address.",
      "properties": {
        "type": {
          "enum": [
            "ipv4"
          ],
          "type": "string",
          "x-stackit-logging": true
        },
        "value": {
          "description": "An IPv4 address.",
          "pattern": "^\\s*((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))\\s*$",
          "type": "string",
          "x-stackit-logging": true
        }
      },
      "required": [
        "type",
        "value"
      ],
      "type": "object"
    },
    "NexthopIPv6": {
      "description": "Object that represents an IPv6 address.",
      "properties": {
        "type": {
          "enum": [
            "ipv6"
          ],
          "type": "string",
          "x-stackit-logging": true
        },
        "value": {
          "description": "An IPv6 address.",
          "pattern": "^\\s*((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:)))(%.+)?\\s*$",
          "type": "string",
          "x-stackit-logging": true
        }
      },
      "required": [
        "type",
        "value"
      ],
      "type": "object"
    },
    "NexthopInternet": {
      "description": "Object that represents a route to the internet.",
      "properties": {
        "type": {
          "enum": [
            "internet"
          ],
          "type": "string",
          "x-stackit-logging": true
        }
      },
      "required": [
        "type"
      ],
      "type": "object"
    },
    "UUID": {
      "description": "Universally Unique Identifier (UUID).",
      "format": "uuid",
      "maxLength": 36,
      "minLength": 36,
      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
      "type": "string"
    },
    "UpdatedAt": {
      "description": "Date-time when resource was last updated.",
      "format": "date-time",
      "type": "string"
    },
    "v2RouteDestinationType": {
      "description": "Possible values: `cidrv4`, `cidrv6`.",
      "type": "string"
    }
  }
}