-
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
Support undefined
keyword
#622
Comments
@korthout thank you for raising this up. This is an interesting use case. 👍 According to the DMN spec, FEEL doesn't differ between a variable/property that is
Note that the FEEL engine behaves currently differently if the variable/property doesn't exist. It just fails but this is a subject of change (see the discussion here). Additionally, the One alternative solution for the use case with the REST API could be a filter on the context. For example, filtering all
Or, filtering by selected keys:
With the current behavior, you may need to use
This context expression would look better with the planned get or else() function. @korthout do you think that the alternative would work for the use case? |
Thanks @saig0 That's an interesting alternative 👏 I think it works for most situations, but things get tricky when both Having said that, I think this alternative is better than what I came up with. So thank you. I'm fine with closing this for now, as it's unlikely we'll support the |
Is your feature request related to a problem? Please describe.
It may be useful to express the difference between a missing value
null
and an undefined valueundefined
. For example, when a FEEL context is used to express a JSON object as the body of a PUT request.In REST APIs, behaving differently when a value is missing or undefined is common practice. For example, in a PUT request:
null
, the PUT request may be interpreted to UPDATE the property's value tonull
undefined
, the PUT request may be interpreted to ignore the propertyCurrently with FEEL
One way that I could find to leave out properties of a FEEL context is to build the context dynamically using
context put(context, key, value)
, when the valueis defined(value)
. However, this may be cumbersome to use:Composing multiple calls becomes tedious, but it can be simplified slightly using a function property.
However, this is still more cumbersome than using an
undefined
keyword:Describe the solution you'd like
Add support for an
undefined
keyword that can be used to indicate that a value is undefined.Related issues
The text was updated successfully, but these errors were encountered: