EvaluationSpec

EvaluationSpec holds rules for evaluating the value of a flag.

JSON representation
{
  "variants": [
    {
      object (Variant)
    }
  ],
  "defaultTarget": string,
  "allocations": [
    {
      object (Allocation)
    }
  ],
  "rules": [
    {
      object (EvaluationRule)
    }
  ],
  "attributes": [
    string
  ]
}
Fields
variants[]
(deprecated)

object (Variant)

Optional. A list of variants.

defaultTarget

string

Required. Default variant or allocation of the flag.

allocations[]

object (Allocation)

Optional. A list of allocations.

rules[]

object (EvaluationRule)

Optional. Evaluation rules define the logic for evaluating the flag against a given context. The rules are evaluated sequentially in their specified order.

attributes[]

string

Optional. Names of the context attributes that are used in the evaluation rules and allocations.

Variant

Variant is an identifier for a value (name assigned to a value). DEPRECATED: Use Flag.Variants instead.

JSON representation
{
  "name": string,

  // Union field value can be only one of the following:
  "boolValue": boolean,
  "intValue": string,
  "stringValue": string,
  "doubleValue": number
  // End of list of possible types for union field value.
}
Fields
name

string

Required. Name of the variant. Max length: 128 bytes.

Union field value. value is a single flag value for the variant. value can be only one of the following:
boolValue

boolean

Optional. Boolean flag value.

intValue

string (int64 format)

Optional. Integer flag value.

stringValue

string

Optional. String flag value.

doubleValue

number

Optional. Double flag value.

Allocation

Allocation defines a set of weighted flag variants, specifying how traffic is split based on the randomization unit.

JSON representation
{
  "id": string,
  "randomizedOn": string,
  "description": string,
  "slots": [
    {
      object (AllocationSlot)
    }
  ]
}
Fields
id

string

Required. Allocation ID. Max length: 128 bytes.

randomizedOn

string

Required. Key of the context attribute that is used for traffic splitting.

description

string

Optional. Description of the allocation. Max length: 500 bytes.

slots[]

object (AllocationSlot)

Required. Slots defines the weighted distribution of variants.

AllocationSlot

AllocationSlot specifies a variant and the proportion of traffic allocated to it.

JSON representation
{
  "variant": string,
  "weight": integer
}
Fields
variant

string

Required. Variant of the allocation slot.

weight

integer

Required. Weight defines the proportion of traffic to allocate to the variant, relative to other slots in the same allocation.

EvaluationRule

EvaluationRule defines a single rule for evaluating a feature flag. A rule consists of a condition that, if met, assigns a specific variant or allocation to the user.

JSON representation
{
  "id": string,
  "condition": string,
  "target": string
}
Fields
id

string

Required. Evaluation rule ID. Max length: 128 bytes.

condition

string

Required. A Common Expression Language (CEL) expression that evaluates to a boolean. The expression is evaluated against the provided context. If it returns true, the rule's target is applied.

target

string

Required. The target variant or allocation to apply if the condition is met. This should match the name of a defined variant or allocation's ID.