google / cel-go

Fast, portable, non-Turing complete expression evaluation with gradual typing (Go)
https://cel.dev
Apache License 2.0
2.31k stars 225 forks source link

field selection with ? on null now produces an error #937

Closed mtaufen closed 7 months ago

mtaufen commented 7 months ago

Describe the bug I think this change happened in https://github.com/google/cel-go/pull/922.

For example, given yaml like:

foo:
  bar: null

and CEL like:

foo.?bar.?baz.orValue("not there")

behavior changes from returning "not there" to throwing a no such key error.

To Reproduce Check which components this affects:

Expected behavior Expected "not there" to be returned.

Additional context

I tried reverting the change from https://github.com/google/cel-go/pull/922 and it makes things work the way I expect.

TristonianJones commented 7 months ago

Thanks for the report. I'll give it a look.