-
Notifications
You must be signed in to change notification settings - Fork 275
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
fix: __typename
when formatting response in some @interfaceObject
cases
#2530
fix: __typename
when formatting response in some @interfaceObject
cases
#2530
Conversation
2a2c417
to
5872d0e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one println to remove, otherwise it's good, thanks
apollo-router/src/spec/query.rs
Outdated
@@ -150,6 +150,7 @@ impl Query { | |||
variables: Object, | |||
schema: &Schema, | |||
) -> Vec<Path> { | |||
println!("Formatting: {response:?}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
println!("Formatting: {response:?}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry about that. I've removed it and rebased (and updated to the new changelog thingy).
…oducted by `@interfaceObject` The introduction of `@interfaceObject` in federation 2.3 has for consequence that a subgraph (that uses an `@interfaceObject`) may return in its response a `__typename` that corresponds to an interface type in the supergraph (but which, locally to that subgraph, is an object type). The idea is that if that `__typename` is requested, then the query planner will ensure that another follow-up fetch will override that value so it maps to a proper object type. However, in some cases, that `__typename` is not queried, nor is there another reason to resolve the actual underlying implementation type of the underlying object (meaning that only fields of the interface are queried), and in that case the `__typename` may still point to the interface type when `format_response` is called. Unfortunately, that method currently nullify the whole object in such case, which is not the behaviour we want and was not caught in apollographql#2489.
5872d0e
to
4d6b600
Compare
__typename
when formatting response in some @interfaceObject
cases
The introduction of
@interfaceObject
in federation 2.3 has for consequence that a subgraph (that uses an@interfaceObject
) may return in its response a__typename
that corresponds to an interface type in the supergraph (but which, locally to that subgraph, is an object type).The idea is that if that
__typename
is requested, then the query planner will ensure that another follow-up fetch will override that value so it maps to a proper object type.However, in some cases, that
__typename
is not queried, nor is there another reason to resolve the actual underlying implementation type of the underlying object (meaning that only fields of the interface are queried), and in that case the__typename
may still point to the interface type whenformat_response
is called. Unfortunately, that method currently nullify the whole object in such case, which is not the behaviour we want and was not caught in #2489.Complete the checklist (and note appropriate exceptions) before a final PR is raised.
Notes
[^1]. It may be appropriate to bring upcoming changes to the attention of other (impacted) groups. Please endeavour to do this before seeking PR approval. The mechanism for doing this will vary considerably, so use your judgement as to how and when to do this.
[^2]. Configuration is an important part of many changes. Where applicable please try to document configuration examples.
[^3]. Tick whichever testing boxes are applicable. If you are adding Manual Tests:
- please document the manual testing (extensively) in the Exceptions.
- please raise a separate issue to automate the test and label it (or ask for it to be labeled) as
manual test