{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:orbiplex:schema:bounded-http-fetch-request:v1",
  "title": "Bounded HTTP Fetch Request v1",
  "type": "object",
  "additionalProperties": false,
  "required": ["schema", "schema/v", "request/id", "consumer/action", "method", "url", "budgets"],
  "properties": {
    "schema": { "const": "bounded-http-fetch-request.v1" },
    "schema/v": { "const": 1 },
    "request/id": { "type": "string", "minLength": 1, "maxLength": 512, "pattern": "^[^\\s\\u0000]+$" },
    "consumer/action": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128,
      "pattern": "^[a-z][a-z0-9]*(?:[._:-][a-z0-9]+)*$"
    },
    "method": { "enum": ["GET", "HEAD"] },
    "url": { "type": "string", "minLength": 1, "maxLength": 4096, "pattern": "^https?://" },
    "budgets": {
      "type": "object",
      "additionalProperties": false,
      "required": ["redirects/max", "compressed-bytes/max", "decompressed-bytes/max", "header-bytes/max", "total-timeout/ms", "connect-timeout/ms", "hop-timeout/ms", "inline-bytes/max"],
      "properties": {
        "redirects/max": { "type": "integer", "minimum": 0, "maximum": 10 },
        "compressed-bytes/max": { "type": "integer", "minimum": 1, "maximum": 16777216 },
        "decompressed-bytes/max": { "type": "integer", "minimum": 1, "maximum": 67108864 },
        "header-bytes/max": { "type": "integer", "minimum": 1, "maximum": 65536 },
        "total-timeout/ms": { "type": "integer", "minimum": 1, "maximum": 120000 },
        "connect-timeout/ms": { "type": "integer", "minimum": 1, "maximum": 30000 },
        "hop-timeout/ms": {
          "type": "integer",
          "minimum": 1,
          "maximum": 30000,
          "description": "Maximum wall-clock duration of one HTTP request hop, including response-body transfer; this is not an idle-read timeout."
        },
        "inline-bytes/max": { "type": "integer", "minimum": 0, "maximum": 1048576 }
      }
    }
  }
}
