Skip to content
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(subgraph): Preserve resolveReference fns during schema transforms #1131

Closed
trevor-scheer opened this issue Nov 3, 2021 · 4 comments · Fixed by #1746
Closed

fix(subgraph): Preserve resolveReference fns during schema transforms #1131

trevor-scheer opened this issue Nov 3, 2021 · 4 comments · Fixed by #1746
Assignees

Comments

@trevor-scheer
Copy link
Member

Currently resolveReference and resolveObject are special properties on GraphQLObjectTypes which don't obey the type system / public API. We should investigate moving these properties to the extensions object so they are preserved through normal usage of the public API (i.e. calling toConfig() on the object.

Ref: ardatan/graphql-tools#2687

@trevor-scheer trevor-scheer self-assigned this Nov 3, 2021
@glasser
Copy link
Member

glasser commented Nov 3, 2021

@martijnwalraven pointed out in ardatan/graphql-tools#2857 (comment) that this would be a backwards-incompatible change, but I suspect it is fine to make it (and bump the 0.x version). If for some reason that's not ok, we could put the fields on both places and just document the old way as deprecated and not preserved by things like mapSchema.

We should consider taking the advice on the doc comment on graphql-js GraphQLObjectTypeExtensions and put these functions not directly on extensions but on an object like extensions.apolloSubgraph, for later extensibility.

@trevor-scheer
Copy link
Member Author

I haven't validated the workaround myself, but I figure it's worth sharing if anyone finds themselves running into this issue - could be worth a shot.

https://community.apollographql.com/t/are-object-resolvers-broken-with-custom-schema-directives/1578/3

Thanks to @vad3x for providing it.

@vad3x
Copy link

vad3x commented Dec 1, 2021

Hi @trevor-scheer, any updates?

@trevor-scheer
Copy link
Member Author

@vad3x no update yet. This is one of those things I'd love to get to, but no idea when. Open to assisting with a PR though!

@hwillson hwillson removed the 2021-11 label Mar 31, 2022
trevor-scheer added a commit that referenced this issue Apr 19, 2022
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
trevor-scheer added a commit that referenced this issue Apr 20, 2022
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
trevor-scheer added a commit that referenced this issue Apr 20, 2022
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
trevor-scheer added a commit that referenced this issue Apr 20, 2022
#1747)

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants