agrosner
10/22/2025, 2:15 PMregisterForeignSchemas to define a custom directive. Is this the right approach? or do i also need to define it in my repos extra.graphqls file?agrosner
10/22/2025, 2:16 PMagrosner
10/22/2025, 2:20 PMregisterSchemaCodeGenerator the better approach? i want ide autocomplete on the directive toombonnin
10/22/2025, 2:26 PMmbonnin
10/22/2025, 2:26 PMKotlinPoet specsagrosner
10/22/2025, 2:52 PMquery MyQuery @split(dataFieldNames: "foo") {
title
subtitle
foo {
id
dataBar
}
}
then outputs two queries:
1. transform original query to include a variable called includeData ,
query MyQuery($includeData: Boolean! = true) {
someUIComponent {
title
subtitle
foo @include(if: $includeData) {
id
dataBar
}
}
}
this enables clients to call query with all data foo or just configuration data which we can cache separately
2. output a data only query (TBD on proper format yet):
query MyQueryData {
foo {
id
dataBar
}
}mbonnin
10/22/2025, 3:01 PMregisterExecutableDocumentTransform()mbonnin
10/22/2025, 3:02 PMGQLDocument with all your queries and fragments as input and you can return a new document that, for each query generates 2 version of themmbonnin
10/22/2025, 3:02 PMagrosner
10/22/2025, 3:04 PMmbonnin
10/22/2025, 3:07 PMmbonnin
10/22/2025, 3:07 PMagrosner
10/22/2025, 3:36 PMextra.graphqls .agrosner
10/22/2025, 3:43 PM@include/@skip with the variable in the fragment body (since fragment arguments are not officially supported yet in graphql) . but since they are identical,
im looking to try to remap them to reuse the same generated types (since the data field from another subgraph is nullable enforced at router level)agrosner
10/22/2025, 3:44 PMagrosner
10/22/2025, 3:45 PMfragment FooFragment {
foo {
id
dataBar
}
}
vs:
fragment FooFragmentSplit {
foo @include(if: $includeData) {
id
dataBar
}
}agrosner
10/22/2025, 3:47 PMFooFragmentSplit to just reuse FooFragment ?agrosner
10/22/2025, 3:48 PMmbonnin
10/22/2025, 3:56 PMIDE support for the providing directiveI'm not sure if the IDE plugin can read the directives provided by the compiler plugins? Summon @bod
mbonnin
10/22/2025, 3:57 PMis there a way to then intercept code gen for theI think the sameto just reuseFooFragmentSplit?FooFragment
ExecutableDocumentTransform should work?bod
10/22/2025, 3:58 PMmbonnin
10/22/2025, 3:59 PMfragment FooFragment on Foo {
foo {
id
dataBar
}
}
fragment FooFragmentSplit on Foo {
...FooFragment @include(if: $includeData)
}bod
10/22/2025, 4:00 PMagrosner
10/22/2025, 4:02 PMmbonnin
10/22/2025, 4:03 PMagrosner
10/22/2025, 4:03 PMmbonnin
10/22/2025, 4:03 PMmbonnin
10/22/2025, 4:04 PMmbonnin
10/22/2025, 4:04 PMmbonnin
10/22/2025, 4:05 PMagrosner
10/22/2025, 4:05 PMmbonnin
10/22/2025, 4:06 PMmbonnin
10/22/2025, 4:06 PMagrosner
10/22/2025, 4:06 PMmbonnin
10/22/2025, 4:07 PMin language like typescript this would be easy and straightforward due to duck typingYea, for this reason GraphQL is a lot easier in TS
mbonnin
10/22/2025, 4:07 PMmbonnin
10/22/2025, 4:08 PMmbonnin
10/22/2025, 4:08 PMagrosner
10/22/2025, 4:08 PMmbonnin
10/22/2025, 4:08 PMmbonnin
10/22/2025, 9:52 PMagrosner
10/23/2025, 12:43 AM