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
TypeScript Resolvers - Apollo Federation Broken #4493
Comments
#4232 seems to be the PR that broke my situation |
We have the same issue, coming from 1.17.4 |
Same issue here, had to revert to v1.17.3 until this issue is solved. IMO #4232 needs to be reverted and fixed to only apply the |
@jakeblaxon any idea why it happens? it seems like the changes we recently merged in #4232 causes it. |
It looks like @DouglasGabr pinpointed the issue. The requires/key logic should only apply to extended parent types (i.e. types from external schemas), but it's being applied to non-extended types as well. This is because the if statement in the |
I've been looking into how to solve this. It seems that GraphQL doesn't preserve the Because of this, the simplest solution I can think of would be to check if any of the type's fields contain an |
I think it solves the problem, relying on the |
Fixed in #4542 by @jakeblaxon - thanks! |
I suppose that the RoomType interface in service 1 is essentially: interface RoomType {
id: string;
propertyId: string;
...
} and that service 2 has a export const resolvers = {
Property: {
__resolveReference: (keys, _args, { propertyRepository }) => propertyRepository.tryGet(keys.id),
...
},
...
}; @rherber can you confirm this? |
Describe the bug
Upgraded from 1.16.3 to 1.17.7 and all resolvers resolving a federated type broke.
To Reproduce
Steps to reproduce the behavior:
Attempt to compile TypeScript files using generated types and resolvers.
Schema from service 1
Schema from service 2
N/A. Issue is on TypeScript compilation
codegen.yml
config file:Expected behavior
TypeScript files should compile as they did with version 1.16.3
Environment:
@graphql-codegen/...
: 1.17.7Additional context
Example resolver causing problems for service with schema 1:
Error:
interfaces for mappers:
The text was updated successfully, but these errors were encountered: