-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Link does not resolve on Union types #149
Labels
Comments
example test case for
|
kindermax
pushed a commit
that referenced
this issue
Jun 5, 2024
… there is no such field in node There was a part of algo in nodes merging which will extract fields from fragment if same fields exist in node - this is to prevent same field to be resolved multiple times. The simplest example is `{ user { id ... on User { id } } }` would become `{ user { id } }` so `id` field will be resolved only once. But previous algo (before this fix) would merge eagerly, so even if no field exits in not, algo will try to eliminate fragment at all, for example `{ user { ... on User { id } } }` would become `{ user { id } }` - fragment is eliminated. This behavior breaks union queries and we must not touch union fragment, since this breaks unions. This fix tells algo to merge less eagerly, thas is - if fragment field not exist in node, we leave this field in fragment since there is nothing to optimize, no fields duplication will occur. Note that although we do not merge fragment field to node fields, we still merge fields for fragment field (see _merge_link).
kindermax
pushed a commit
that referenced
this issue
Jun 5, 2024
… there is no such field in node There was a part of algo in nodes merging which will extract fields from fragment if same fields exist in node - this is to prevent same field to be resolved multiple times. The simplest example is `{ user { id ... on User { id } } }` would become `{ user { id } }` so `id` field will be resolved only once. But previous algo (before this fix) would merge eagerly, so even if no field exits in not, algo will try to eliminate fragment at all, for example `{ user { ... on User { id } } }` would become `{ user { id } }` - fragment is eliminated. This behavior breaks union queries and we must not touch union fragment, since this breaks unions. This fix tells algo to merge less eagerly, thas is - if fragment field not exist in node, we leave this field in fragment since there is nothing to optimize, no fields duplication will occur. Note that although we do not merge fragment field to node fields, we still merge fields for fragment field (see _merge_link).
kindermax
added a commit
that referenced
this issue
Jun 10, 2024
[fix] [#149] do not merge/extract fragment fields into node fields
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When I tried to create a query with a link within a Union type, got an unexpected error
example query
example error
another libraries, like
strawberry
allow such a behavior, GraphQL doc also says it's validThe text was updated successfully, but these errors were encountered: