Code Interface: Allow defining ?
functions that return the unwrapped boolean result
#1696
Labels
enhancement
New feature or request
Is your feature request related to a problem? Please describe.
There isn't a way to define a question mark function on code interfaces that return a boolean. All code interface functions auto-generate the non-bang (tuple wrapped result) and bang (unwrapped result) versions today.
If you want to define a resource action that returns a boolean typically suffixed with a question mark, you end up with a non-bang and bang-version of it.
For example
Question mark functions aren't written this way by convention since they operate like the bang version.
Describe the solution you'd like
A clear and concise description of what you want to happen.
When a code interface function has a question mark suffix, generate one function that works like the bang version, returning only the result.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Express the feature either with a change to resource syntax, or with a change to the resource interface
The current alternative is not to use the code interface to define the function; instead, the question mark function is created in the domain directly.
Or
Combine with a generic action in the resource.
This is a simple example of checking where a record exists but applies to any action that returns a boolean, which should be suffixed with a question mark.
Additional context
This isn't a critical issue and has an easy workaround with defining functions inside the domain. However, this helps keep the resource's actions inside the resource and the use of the domain to expose them.
The text was updated successfully, but these errors were encountered: