-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
When federation is enabled for a type, its resolvers have a wrong ParentType #4722
Comments
If this function returns There are no related tests. Should I add one to ensure my use case passes? EDIT: I found them. |
I added this comment to #4724 but I'll post it here as well: I see that you're using mapped types. I didn't address the mapped type case at all when working on adding this federation functionality, so it may be buggy and there is definitely room for improvement there. For your extend type User @key(fields: "id") {
id: ID! @external
firstName: String! @external
lastName: String! @external
fullName: String! @requires(fields: "firstName lastName")
} (You will need to add all required external fields to your extended type, otherwise the Apollo Gateway will throw an error, hence why I've added them here). If you don't specify that these fields are required, then the Apollo Gateway may not provide them to you for certain requests. For example, what if I requested the following: {
getUser(...) {
id
firstName
fullName
}
} In this case, the Apollo Gateway will only request Since |
Discussion continues on #4724. |
The goal of
__resolveReference
is to return a model object which is internal to the current service. Its return type is then the parent type of related resolver functions. However the current parent type for resolvers is an extract of the real parent type (viaGraphQLRecursivePick
). It shouldn't.To Reproduce
See https://codesandbox.io/s/bitter-https-7yboj
None
codegen.yml
config file:Expected behavior
This file (
user-resolvers.ts
) should compile:But it does not. The cause is
UserResolvers
is:whereas it should be
Environment:
@graphql-codegen/...
: latest as of writingThe text was updated successfully, but these errors were encountered: