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

"createSubscriptionResolver" should be allowed to be overridden with a custom resolver as happens with "createResolver" function #1302

Closed
alexandra-c opened this issue Mar 25, 2020 · 5 comments

Comments

@alexandra-c
Copy link
Contributor

I'm working on a project with a multi-tenant micro-services architecture. I have a Main_GraphQL server which imports schemas from other GraphQL services using introspectSchema and makeRemoteExecutableSchema.
Let's assume that tenant1 wants to import schema from GraphQL_Service_1 and tenant2 from GraphQL_Service_2. The tricky thing is that both services have actually the same schema but the resolvers are different.
So what i need is when i get the call from tenant1 to run the resolvers from GraphQL_Service_1 and when i get a call from tenant2 to run the resolvers from GraphQL_Service_2.
I managed to achieve this for Query and Mutations by passing a customCreateResolver to makeRemoteExecutableSchema.
The problem is that makeRemoteExecutableSchema doesn’t use the customCreateResolver function when creating the resolvers for subscriptions but it uses the default one.

Is it possible to allow overriding the subscription resolvers with a custom one as it happens now with the ones for Query and Mutation?

Thank you! I really need this.

@yaacovCR
Copy link
Collaborator

In v5 makeRemoteExecutableSchema is deprecated in favor of wrapSchema which acts like transformSchema++, you can specify remote schema options and transforms. Missing piece is to pass a function to provide your own delegating resolver, just requires an additional argument. That would work for queries, mutations, subscriptions.

Folding into #1306

@yaacovCR yaacovCR mentioned this issue Mar 31, 2020
22 tasks
@alexandra-c
Copy link
Contributor Author

I'll be waiting for the custom delegating resolver parameter to come up then. Thank you. :)

@yaacovCR
Copy link
Collaborator

yaacovCR commented Apr 3, 2020

Moving to v5.1, reopening to move any relevant discussion here.

@yaacovCR yaacovCR reopened this Apr 3, 2020
yaacovCR added a commit that referenced this issue Apr 6, 2020
 = add support for custom subscription resolver generation to makeRemoteExecutableSchema
 = adds support for customizing resolver generation to schema config objects and thereby to wrapSchema/transformSchema, mergeSchemas
 = closes #1302
yaacovCR added a commit that referenced this issue Apr 6, 2020
= add support for custom subscription resolver generation to makeRemoteExecutableSchema
 = adds support for customizing resolver generation to schema config objects and thereby to wrapSchema/transformSchema, mergeSchemas
 = closes #1302
yaacovCR added a commit that referenced this issue Apr 7, 2020
 = finishes work in #1349 for #1302
  =  streamlines the CreateProxyingResolverFn signature as no further arguments expected, pass along all info to users for possible customization
  =  adds fix for nested root query object to makeRemoteExecutableSchema
  = actually export defaultCreateProxyingResolver
yaacovCR added a commit that referenced this issue Apr 7, 2020
finishes work in #1349 for #1302

= streamlines the CreateProxyingResolverFn signature as no further arguments expected, pass along all info to users for possible customization
= adds fix for nested root query object to makeRemoteExecutableSchema
= actually export defaultCreateProxyingResolver
= reorders properties of SubschemaConfig, removes some unused properties
yaacovCR added a commit that referenced this issue Apr 7, 2020
finishes work in #1349 for #1302

= streamlines the CreateProxyingResolverFn signature as no further arguments expected, pass along all info to users for possible customization
= adds fix for nested root query object to makeRemoteExecutableSchema
= actually export defaultCreateProxyingResolver
= reorders properties of SubschemaConfig, removes some unused properties
@yaacovCR
Copy link
Collaborator

yaacovCR commented Apr 7, 2020

Moved back into v5.0, track #1308

Thank you for pushing on this.

@yaacovCR yaacovCR closed this as completed Apr 7, 2020
@alexandra-c
Copy link
Contributor Author

Moved back into v5.0, track #1308

Thank you for pushing on this.

That's realy great! Thank you!!

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

No branches or pull requests

2 participants