Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce a flag for supporting 'null' as absent on optional field selection #938

Merged
merged 1 commit into from Apr 29, 2024

Conversation

TristonianJones
Copy link
Collaborator

@TristonianJones TristonianJones commented Apr 27, 2024

Due to a bug in the original implementation of optional values, a field selection
on a null value would produce optional.none() rather than an error. This
bug was fixed in #922; however, the bug has been relied upon as a feature
within upstream software.

To preserve the legacy behavior, configure the following option:

cel.NewEnv(cel.OptionalTypes(), cel.OptionalFieldSelectionNoneIfNull(true)))

Closes #937

Copy link

@mtaufen mtaufen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jcking
Copy link
Collaborator

jcking commented Apr 29, 2024

LGTM assuming we also add a conformance test to cel-spec

@TristonianJones TristonianJones merged commit 315a5cc into google:master Apr 29, 2024
2 checks passed
@TristonianJones TristonianJones deleted the presence-update branch April 29, 2024 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

field selection with ? on null now produces an error
3 participants