{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/confighub/json-schema/confighub-function-invocations-request-schema.json",
  "title": "FunctionInvocationsRequest",
  "description": "FunctionInvocationsRequest represents a request to invoke a list of functions on the configuration data of the matching Units or Revision.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/confighub-function-api-openapi.yml#/components/schemas/FunctionInvocationsRequest",
  "type": "object",
  "properties": {
    "BridgeWorkerID": {
      "type": "string",
      "description": "BridgeWorkerID is the identifier of the associated worker that will execute these functions.",
      "format": "uuid"
    },
    "ChangeDescription": {
      "type": "string",
      "description": "ChangeDescription is a description of the change being made, if any.",
      "x-go-type-skip-optional-pointer": true
    },
    "ChannelID": {
      "type": "string",
      "format": "uuid"
    },
    "FunctionInvocations": {
      "$ref": "#/$defs/FunctionInvocationList"
    },
    "IncludeConflicts": {
      "type": "boolean",
      "description": "Put the Unit's outstanding merge conflicts in the FunctionContext, for functions that reason about them. A request that runs Triggers gets them regardless",
      "x-go-type-skip-optional-pointer": true
    },
    "IncludeLinkFindings": {
      "type": "boolean",
      "description": "Put what the resolves of the Unit's Links could not do in the FunctionContext, for functions that reason about it. A request that runs Triggers gets them regardless",
      "x-go-type-skip-optional-pointer": true
    },
    "Invocations": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/UUID"
      },
      "description": "Invocations is a list of Invocation IDs to execute. The invocations must be within the same Organization. Invocations will be executed after the FunctionInvocations list. Functions are grouped by executor (built-in vs bridge worker) and executed in phases: general mutating functions first, then final mutating functions (like ensure-context), then validating functions. Functions that don't match the unit's toolchain type are ignored.",
      "x-go-type-skip-optional-pointer": true
    },
    "NumFilters": {
      "type": "integer",
      "description": "NumFilters is the number of validating functions from the FunctionInvocations to treat as filters for the remaining functions in the list. In the case that the validation function does not pass, stop and don't execute the remaining functions, but don't report an error.",
      "x-go-type-skip-optional-pointer": true
    },
    "ParameterizedInvocations": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ParameterizedInvocationRef"
      },
      "x-go-type-skip-optional-pointer": true
    },
    "StopOnError": {
      "type": "boolean",
      "description": "StopOnError indicates whether to stop executing functions from the FunctionInvocations list on the first error, or to execute all of the functions and return all of the errors. Note that this applies to each Unit or Revision individually rather than all of the entities on which the functions are being invoked.",
      "x-go-type-skip-optional-pointer": true
    },
    "ToolchainType": {
      "type": "string",
      "description": "ToolchainType specifies the type of toolchain for these function invocations. This determines which configuration formats the functions can process. It must match the ToolchainType of the Units.",
      "x-go-type-skip-optional-pointer": true
    },
    "Triggers": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/UUID"
      },
      "description": "Triggers is a list of Trigger IDs to execute. The triggers must be within the same Organization. Triggers will be executed after the FunctionInvocations list. Functions are grouped by executor (built-in vs bridge worker) and executed in phases: general mutating functions first, then final mutating functions (like ensure-context), then validating functions. Functions that don't match the unit's toolchain type are ignored.",
      "x-go-type-skip-optional-pointer": true
    },
    "UpdateApplyGates": {
      "type": "boolean",
      "description": "Deprecated: use UpdateValidationResults, which this means the same thing as. Setting either has the same effect.",
      "deprecated": true,
      "x-go-type-skip-optional-pointer": true
    },
    "UpdateValidationResults": {
      "type": "boolean",
      "description": "UpdateValidationResults indicates that the results of Trigger execution should be used to update ValidationErrors and ValidationWarnings on the affected Units. Requires Triggers to be specified.",
      "x-go-type-skip-optional-pointer": true
    },
    "WhereResource": {
      "type": "string",
      "description": "WhereResource restricts which resources functions operate on using ConfigHub metadata path expressions (ConfigHub.ResourceName, ConfigHub.ResourceNameWithoutScope, ConfigHub.ResourceType, ConfigHub.ResourceCategory).",
      "x-go-type-skip-optional-pointer": true
    }
  },
  "$defs": {
    "Clearance": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ClearanceRequirement"
      }
    },
    "ClearanceRequirement": {
      "type": "object",
      "properties": {
        "Key": {
          "type": "string",
          "description": "The guard key this requirement is about",
          "x-go-type-skip-optional-pointer": true
        },
        "Operator": {
          "type": "string",
          "description": "Exists, In, NotIn, or DoesNotExist",
          "x-go-type-skip-optional-pointer": true
        },
        "Values": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "The values In and NotIn compare against; unused by Exists and DoesNotExist",
          "x-go-type-skip-optional-pointer": true
        }
      }
    },
    "FunctionArgument": {
      "type": "object",
      "properties": {
        "Evaluator": {
          "type": "string"
        },
        "ParameterName": {
          "type": "string"
        },
        "Value": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "integer",
              "format": "int64"
            },
            {
              "type": "boolean"
            }
          ]
        }
      }
    },
    "FunctionInvocation": {
      "type": "object",
      "properties": {
        "Arguments": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/$defs/FunctionArgument"
          },
          "description": "Function arguments",
          "x-go-type-skip-optional-pointer": true
        },
        "Clearance": {
          "allOf": [
            {
              "$ref": "#/$defs/Clearance"
            }
          ],
          "description": "Classes of guarded reason this invocation is cleared for; combined by union with the clearance of whatever drove the execution"
        },
        "FunctionName": {
          "type": "string",
          "description": "Function name",
          "x-go-type-skip-optional-pointer": true
        },
        "Guards": {
          "allOf": [
            {
              "$ref": "#/$defs/GuardStamp"
            }
          ],
          "description": "Guards to record on the paths this invocation writes, so a later operation must be cleared for them; combined with the guards of whatever drove the execution, later winning per key"
        },
        "Params": {
          "type": "object",
          "additionalProperties": {},
          "description": "Caller-supplied parameter values for expanding templated argument Values; transient, not persisted",
          "x-go-type-skip-optional-pointer": true
        },
        "WhereResource": {
          "type": "string",
          "description": "Per-invocation resource filter. AND-combined with the request-level WhereResource. Same path syntax as the request-level field (see ParseAndValidateWhereResource).",
          "x-go-type-skip-optional-pointer": true
        }
      }
    },
    "FunctionInvocationList": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "$ref": "#/$defs/FunctionInvocation"
      }
    },
    "GuardStamp": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "ParameterizedInvocationRef": {
      "type": "object",
      "properties": {
        "InvocationID": {
          "type": "string",
          "format": "uuid",
          "x-go-type-skip-optional-pointer": true,
          "x-omitzero": true
        },
        "Parameters": {
          "type": "object",
          "additionalProperties": {},
          "x-go-type-skip-optional-pointer": true
        }
      }
    },
    "UUID": {
      "type": "string",
      "format": "uuid"
    }
  }
}