Major
Nice to have
Bugfix
Major
Enhancement
Detail
#23108
Search expressions: Implicit flat map semantics from .get(...) to collections
If you want to navigate multi-level, then you can do it with search expressions like this:
x -> $x.get(`myModule:MyType#ref1`).get(`myModule:MyType#ref2`)
The requirement is that the first attribute ref1 is not "multiple", i.e. does not return a collection but only a scalar value. If ref1 is declared as "multiple", you have to write relative awkward:
x -> $x.get(`myModule:MyType#ref1`).foreach(y -> $y.get(`myModule:MyType#ref2`))
If ref2 is also "multiple", you even have to write the following to avoid getting a collection of collections that the framework can't handle at all:
x -> $x.get(`myModule:MyType#ref1`).foreach(y -> $y.get(`myModule:MyType#ref2`)).flatten()
With the automatic flat-map semantics of get(...), you can now simply use the first variant in all cases and get the expected result.
Test
- Attribute derivedPath in tl-demo.