-
Notifications
You must be signed in to change notification settings - Fork 257
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
Move __resolveReference
resolvers on to extensions
(version-0.x
)
#1747
Move __resolveReference
resolvers on to extensions
(version-0.x
)
#1747
Conversation
✅ Deploy Preview for apollo-federation-docs ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
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.
🐐
this is a breaking change, right? how does that play with our versioning? i guess we just cut another experimental minor? |
I don't think this would be a breaking change unless users are for some reason reaching into what is already a hack and definitely not in a recommended public API way. This is strictly an implementation detail with no effect on the public API, users should never know any different. I know @martijnwalraven may have thought otherwise (ardatan/graphql-tools#2857 (comment)) but I'm not sure this affects anything public. |
The entity __resolveReference resolver is currently placed directly on to GraphQL*Type objects. This breaks the API, as the expectation is to put things like this on to the `extensions` field of objects contained within a GraphQLSchema. This moves the resolver off of the object and into the extensions where it belongs. Fixes: #1131 Fixes: ardatan/graphql-tools#2687 Fixes: ardatan/graphql-tools#2857
62c05de
to
8d0153a
Compare
Also including relevant work from #1658 to remove uses of __resolveObject
Includes relevant work from #1658 to remove uses of `__resolveObject`
I'm not positive, but it seems that this commit broke our usage of federation v1. Should an equivalent change have been made in
I believe this is (or was) standard usage, see here for example: https://www.apollographql.com/docs/federation/api/apollo-subgraph/ |
We are still using @apollo/[email protected] and @apollo/[email protected] because we are blocked from upgrading to federation v2 by type-graphql's incompatibility w/ GraphQL v16. |
@dobrynin I'm not sure I follow. Can you please share a reproduction of the issue you're seeing now? Either:
I don't know what it means that "the code no longer runs". Is there a useful error message? Does it blow up at runtime? I also don't understand why you're constructing an object of resolvers whose types consist only of a |
@trevor-scheer, I will look more into this tomorrow. On our latest deploy to a development environment some of our queries broke w/ errors like By "the code no longer runs", I mean that we are not seeing the console logs I posted above in our Accounts service. Seemingly We dynamically add federation resolvers to our service schemas, so that is why we have those types w/ just
Hope this helps in understanding our usage. |
@dobrynin I think I understand the issue. Is the I don't think this is a subgraph issue. By adding We could update the gateway to look in both places (requiring a |
@trevor-scheer appreciate your thoughts, I'll take another look at our code w/ this in mind and report back if the issue persists. |
Just reporting back that the issue disappeared when reverting to "@apollo/subgraph": "0.3.3" and "@apollo/gateway": "0.49.0". We'll pin these package versions for now until we have time to figure out how to make our code play nicely with the changes in Apollo's code. At the moment, I'm not sure how to adapt our code. We used the |
@MichalLytek FYI^ |
@dobrynin
Replace your current import { addResolversToSchema } from '@apollo/subgraph/dist/schema-helper'; The example you provided from I would advise moving to the Note: the workaround I've recommended should only be migrated to in tandem with the upgrade of both packages. |
Thank you @trevor-scheer! Will go with the workaround for the moment; your recommended solution goes a bit beyond my comprehension 😅 Shouldn't |
Yeah, I'm not that familiar with In any case, let us know here if that workaround works for you or not. |
@trevor-scheer your workaround appears to working w/ the latest of the federation v1 packages. I'll make an issue in the |
@dobrynin thanks for following up! |
The location of `resolveReference` was updated in the `@apollo/subgraph` library to live on a type's `extensions` object. Reference: apollographql/federation#1746 apollographql/federation#1747
Backport of #1746