No code generated for interface inline fragments
See original GitHub issueI can use objects as inline fragments, but for interface fragments no code is generated. Shouldn’t this be possible?
{
... on ClosedEvent {
# object, works
}
... on IssueEvent {
# interface, no code is generated
}
}
(Using Swift, but saw similar results with the other targets.)
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
[typescript-operations] operation type not restricted to inline ...
Describe the bug typescript-operations does not appear to take into account the specific inline fragments used, instead generating a type ...
Read more >Fragments - Apollo GraphQL Docs
A GraphQL fragment is a piece of logic that can be shared between multiple queries and mutations. Here's the declaration of a NameParts...
Read more >How resolve the right type in GraphQL when using interface ...
2) Yes, after struggling with the above interface + inline fragment solution, I tried to make a single type Entity. The query will...
Read more >Queries and Mutations - GraphQL
That's why GraphQL includes reusable units called fragments. Fragments let you construct sets of fields, and then include them in queries where you...
Read more >GraphQL Codegen deep-dive - Christian Budde Christensen
If the field type is a concrete type, we'll inline the fragment. In this case, since the intersection is not empty, we know...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I have an example for this:
Schema: zoo.graphql
root.graphql
And now I setup a very simple query with some fragments: zooQuery.graphql
FeedableFragment.graphql
And now I check the generated interfaces and I have this:
Notice the property duplication and the fact that all inline fragment information is missing.
I can confirm that using the TypeScript code generation, the fields coming from inline fragments with type conditions are missing from the interface that is supposed to describe the results of the query.