google / cel-spec

Common Expression Language -- specification and binary representation
https://cel.dev
Apache License 2.0
2.67k stars 216 forks source link

has() macro for complicated map key #268

Closed papazloynt closed 1 year ago

papazloynt commented 1 year ago

Hi evereyone! Is it possible to use has() macro for map's keys with dots f.e. : "ECS.Host.Name". When i use template like this: "has(events["ECS.Host.Name"])" i got error like this:

"ERROR: <input>:1:4: invalid argument to has() macro
 | has(events["ECS.Host.Name"]) && events["ECS.Host.Name"] == "myName"
 | ...^"
TristonianJones commented 1 year ago

@papazloynt for complex map keys, prefer the in syntax: "ECS.Host.Name" in events.

-Tristan