You can order has() checks from the outer member to the inner member.
How is it checked?
Your one expression must produce the expected result for all four JSON inputs.
When am I done?
When all tests pass and you can explain every condition in your expression.
Word problem
An order qualifies only when its nested shipping address contains a country and that country is SK or CZ.
Exact requirements
Missing shipping returns false.
Missing address returns false.
Missing country returns false.
A present country must occur in the allowed list.
Required result
Write one CEL expression. It must return the expected value and type for all four prepared JSON inputs. Do not change the inputs to make an incomplete expression pass.
Recommended procedure
Translate each numbered requirement into one small boolean condition.
Run the starter expression and inspect which cases fail.
Add one condition at a time and run the complete suite again.
Mark the challenge complete only when you can explain every operator and every boundary.
Solve the challenge · browser test suite
Write one expression that passes every case
Edit the CEL expression, then run it against all prepared JSON inputs. A solution is complete only when every case passes.
4 test cases
Hint: Check every level before using it as the target of another has().
The same expression runs against every case. Test data is fixed so that boundary and failure scenarios cannot be skipped.
Explained solution
Show the complete expression
has(order.shipping) && has(order.shipping.address) && has(order.shipping.address.country) && order.shipping.address.country in ['SK', 'CZ']
Why the solution works
Presence checks follow the structure from the outside inward.
Each successful has() makes the target of the next check safe to access.
Only after all three levels exist does CEL read the country value.
in performs the final allow-list decision.
What the test cases prove
Allowed country: expected true (bool).
Disallowed country: expected false (bool).
Missing address: expected false (bool).
Missing shipping data: expected false (bool).
The cases are intentionally different. A solution that passes only the first case has not yet implemented the complete rule.
Common mistake
Do not optimise the expression for the first successful input. A requirement is implemented only when its positive case, negative case, and boundary case all produce the stated result.
Knowledge check
Can you point to the exact part of the solution that makes each false test case fail? If two different failures depend on the same condition, explain why.
Key takeaway
You can order has() checks from the outer member to the inner member.
Sources
CEL-DEV — official CEL overview.
CEL-LANG — official CEL language definition for operators, types, macros, presence, strings, and time values used in this challenge.