What you will do
You will run the prepared expression in the playground above, change one input at a time, and explain the result. Start in CEL only, then repeat the same rule in CEL + JSON.
How it works
A CEL program is one expression that returns one value. In the first tab, cel.bind() gives a local name to a value for the duration of its final argument. In the second tab, the host supplies the same name through JSON. The rule uses name identically in both cases; only the source of the value changes.
Read the prepared example
The CEL + JSON rule is:
'Hello, ' + name + '!'Its input is:
{
"name": "Maya"
}The CEL only tab contains the values and the rule in one expression. The enabled cel.bind() extension keeps each name local to its final argument.
Evaluation step by step
namereceives the stringMaya.- The
+operator joins three strings. - The expression returns
"Hello, Maya!".
Your task
- Run CEL only and confirm the displayed result.
- Replace
Mayawith your name and run it again. - Switch to CEL + JSON, make the same change in JSON, and run the expression.
Expected observation: Both modes return the same greeting when they receive the same name.
Common mistake
Removing the definition of name does not create an empty string. Evaluation fails because CEL does not guess missing values.
Show the explanation
CEL + JSON. The expression contains the rule while JSON contains the input.
Knowledge check
Which tab keeps changing input data outside the CEL expression?
Key takeaway
An expression and its input are separate concerns. A value may be local or supplied by a host, but every referenced name must be defined.
Sources
CEL-DEV— official CEL overview.CEL-LANG— official CEL language definition.CEL-GO-BIND— official documentation for the optionalcel.bind()extension used by the self-contained tab.