-
Notifications
You must be signed in to change notification settings - Fork 30
Description
Question
Hi,
I am playing with playground to scope what is achievable or not with CEL
and to spot what is valid CEL syntax or not.
Further Information
I try to implement an expression that return an object base on name
This example is for simplicity purpose only.
input: person: name: 'sam'
expression KO person.name == 'sam' ? { 'status': 'adult', 'age': 39} : { 'status': 'unknown', 'age': 0} is failing to compile
but as soon as I change "age" and "adult" properties to string
expression OKperson.name == 'sam' ? { "status": "adult", "age": "39"} : { "status": "adult", "age": "0"} it compiles and is evaluated
and even inconsistent object shape return is fine as long as all properties does have the same type
expression OK2 person.name == 'sam' ? { 'status': 'adult', 'age': '39'} : { 'status': 'unknown'}
Why is there such constraint?
Screenshots
System Information
- OS: MacOS
- OS Version: Latest
Additional Context
I dont know if the issue is specific to cel-playground or to the underlying used implementation
Thank for your time or for that online tool, it is so helpful to ramp-up ๐
