-
Notifications
You must be signed in to change notification settings - Fork 51
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
is defined() always returns true #695
Comments
BackgroundThe engine's behavior changed with version Related issues:
|
WorkaroundThe //Check if a context contains a key
"x" in get entries({x:1}).key
-> true
"x" in get entries({x:null}).key
-> true
"y" in get entries({x:1}).key
-> false
// Or using the contains function
list contains(get entries({x:1}).key, "y")
-> false |
IdeaWith the new null-friendly behavior in version Instead, we could add a new function to check if a context contains an entry with a given key. // function signature
context contains(context: context, key: string): boolean
// examples
context contains({x:1}, "x")
-> true
context contains({x:null}, "x")
-> true
context contains({x:1}, "y")
-> false
context contains(null, "y")
-> false This function could be used together with Zeebe's expression context to check if a variable exists. context contains(camunda.variables, "x") |
cc: @camunda/zeebe-process-automation @aleksander-dytko |
The test case for the `is defined()` function doesn't work anymore because with the new behavior a non-existing context entry returns null. As a result, the function invocation returns `true` instead of `false`. There is an issue to deal with the changed behavior of the function. See more here: #695. Ignoring the test case until the issue is solved.
@saig0 could you maybe help us with planing by assigning a size to the issue? Thanks! |
@aleksander-dytko Philipp is FTO at this time. ZPA triage (on idea):
|
The test case for the `is defined()` function doesn't work anymore because with the new behavior a non-existing context entry returns null. As a result, the function invocation returns `true` instead of `false`. There is an issue to deal with the changed behavior of the function. See more here: #695. Ignoring the test case until the issue is solved.
The built-in function `is defined()` doesn't work anymore. By returning `null` for a non-existing variable, the function returns always `true`. Previously, the function was used to check if a variable or context entry exists. See the issue for details: #695.
The built-in function `is defined()` doesn't work anymore. By returning `null` for a non-existing variable, the function returns always `true`. Previously, the function was used to check if a variable or context entry exists. See the issue for details: #695.
The built-in function `is defined()` doesn't work anymore. By returning `null` for a non-existing variable, the function returns always `true`. Previously, the function was used to check if a variable or context entry exists. See the issue for details: #695.
Idea 2We can't restore the original behavior in version Instead of checking for a non-existing variable or context entry, we could check for
The regression would impact only users if a variable or context entry exists and is |
Describe the bug
The FEEL engine contains a function is defined(). It can be used to check if a variable or context entry/property exists.
The behavior of this function changed since version
1.17.0
.To Reproduce
Steps to reproduce the behavior:
is defined(non_existing_variable)
true
Expected behavior
The function
is defined()
behaves the same as in version1.16.0
Environment
1.17.0
(not yet released - on main branch)The text was updated successfully, but these errors were encountered: