{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/google-firebase/json-schema/google-firebase-traffic-schema.json",
  "title": "Traffic",
  "description": "Controls traffic configuration for the backend.",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/google-firebase-firebaseapphosting-projects-api-openapi.yml#/components/schemas/Traffic",
  "type": "object",
  "properties": {
    "rolloutPolicy": {
      "$ref": "#/$defs/RolloutPolicy",
      "description": "A rollout policy specifies how new builds and automatic deployments are created."
    },
    "labels": {
      "additionalProperties": {
        "type": "string"
      },
      "type": "object",
      "description": "Optional. Unstructured key value map that can be used to organize and categorize objects."
    },
    "uid": {
      "type": "string",
      "description": "Output only. System-assigned, unique identifier.",
      "readOnly": true
    },
    "createTime": {
      "description": "Output only. Time at which the backend was created.",
      "readOnly": true,
      "format": "google-datetime",
      "type": "string"
    },
    "annotations": {
      "additionalProperties": {
        "type": "string"
      },
      "description": "Optional. Unstructured key value map that may be set by external tools to store and arbitrary metadata. They are not queryable and should be preserved when modifying objects.",
      "type": "object"
    },
    "name": {
      "description": "Identifier. The resource name of the backend's traffic. Format: `projects/{project}/locations/{locationId}/backends/{backendId}/traffic`.",
      "type": "string"
    },
    "etag": {
      "type": "string",
      "description": "Output only. Server-computed checksum based on other values; may be sent on update or delete to ensure operation is done on expected resource.",
      "readOnly": true
    },
    "reconciling": {
      "type": "boolean",
      "description": "Output only. A field that, if true, indicates that the system is working to make the backend's `current` match the requested `target` list.",
      "readOnly": true
    },
    "updateTime": {
      "readOnly": true,
      "type": "string",
      "format": "google-datetime",
      "description": "Output only. Time at which the backend was last updated."
    },
    "current": {
      "$ref": "#/$defs/TrafficSet",
      "description": "Output only. Current state of traffic allocation for the backend. When setting `target`, this field may differ for some time until the desired state is reached."
    },
    "target": {
      "$ref": "#/$defs/TrafficSet",
      "description": "Set to manually control the desired traffic for the backend. This will cause `current` to eventually match this value. The percentages must add up to 100%."
    }
  },
  "$defs": {
    "Path": {
      "description": "A file path pattern to match against.",
      "type": "object",
      "properties": {
        "pattern": {
          "description": "Optional. The pattern to match against.",
          "type": "string"
        },
        "type": {
          "enum": [
            "PATTERN_TYPE_UNSPECIFIED",
            "RE2",
            "GLOB",
            "PREFIX"
          ],
          "description": "Optional. The type of pattern to match against.",
          "type": "string"
        }
      }
    },
    "RolloutPolicy": {
      "type": "object",
      "description": "The policy for how automatic builds and rollouts are triggered and rolled out.",
      "properties": {
        "disabled": {
          "description": "Optional. A flag that, if true, prevents automatic rollouts from being created via this RolloutPolicy.",
          "type": "boolean"
        },
        "disabledTime": {
          "description": "Output only. If `disabled` is set, the time at which the automatic rollouts were disabled.",
          "format": "google-datetime",
          "readOnly": true,
          "type": "string"
        },
        "ignoredPaths": {
          "items": {
            "$ref": "#/$defs/Path"
          },
          "description": "Optional. A list of file paths patterns to exclude from triggering a rollout. Patterns in this list take precedence over required_paths. **Note**: All paths must be in the ignored_paths in order for the rollout to be skipped. Limited to 100 paths. Example: ``` ignored_paths: { pattern: \"foo/bar/excluded/*\", type: \"GLOB\" } ```",
          "type": "array"
        },
        "requiredPaths": {
          "items": {
            "$ref": "#/$defs/Path"
          },
          "type": "array",
          "description": "Optional. A list of file paths patterns that trigger a build and rollout if at least one of the changed files in the commit are present in this list. This field is optional; the rollout policy will default to triggering on all paths if both ignored_paths and required_paths are not populated. Limited to 100 paths. Example: ``` required_paths: { pattern: \"foo/bar/*\", type: \"GLOB\" } ```"
        },
        "codebaseBranch": {
          "description": "If set, specifies a branch that triggers a new build to be started with this policy. Otherwise, no automatic rollouts will happen.",
          "type": "string"
        }
      }
    },
    "TrafficSet": {
      "description": "A list of traffic splits that together represent where traffic is being routed.",
      "type": "object",
      "properties": {
        "splits": {
          "items": {
            "$ref": "#/$defs/TrafficSplit"
          },
          "description": "Required. The list of traffic splits.",
          "type": "array"
        }
      }
    },
    "TrafficSplit": {
      "properties": {
        "build": {
          "description": "Required. The build that traffic is being routed to.",
          "type": "string"
        },
        "percent": {
          "description": "Required. The percentage of traffic to send to the build. Currently must be 100% or 0%.",
          "format": "int32",
          "type": "integer"
        }
      },
      "description": "The traffic allocation for the backend.",
      "type": "object"
    }
  }
}