Support alternative type coercion mode in recursive traversals
obi1kenobi opened this issue · 0 comments
obi1kenobi commented
Fully analogous to #784, except for type coercions:
{
Foo {
out_Foo_Bar @recurse(depth: 3) {
... on Baz {
name @output(out_name: "name")
}
}
}
}
The ... on Baz
type coercion could either be applied fully after expanding the recursion (option 1) or could be applied at each step of the recursion (option 2).
Here we unfortunately don't have the freedom of simply adding a field to an existing directive, as in the @filter
case in #784. We may need to define a custom directive (e.g. @type_coercion_mode
) that only applies to type coercions. We can set it to be only valid on INLINE_FRAGMENT
AST locations, but we'll need to validate that the inline fragment in question is immediately within a @recurse
.