trustfall icon indicating copy to clipboard operation
trustfall copied to clipboard

Ability to `@tag` properties inside a `@fold`, then use the tags outside that `@fold`

Open obi1kenobi opened this issue 1 year ago • 1 comments

For example, on the "numbers" schema:

query {
    Four {
        # Get a list of prime factors and call it "primes".
        primeFactor @fold {
            primes: value @tag @output
        }

        # One of those primes is two less than this number.
        predecessor {
            predecessor {
                value @filter(op: "one_of", value: ["%primes"]) @output
            }
        }
    }
}

This should return:

{
    "primes": [2],
    "value": 2,
}

obi1kenobi avatar Jul 06 '23 15:07 obi1kenobi

when this is implemented, having only @tag inside the @fold body should also disable the optimization in https://github.com/obi1kenobi/trustfall/pull/423, the same as if we had an @output instead of the @tag

u9g avatar Aug 04 '23 03:08 u9g