-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Pass schema into api extension definition #3261
base: master
Are you sure you want to change the base?
Pass schema into api extension definition #3261
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Please let me know where to add tests for this. I will add them if necessary. |
*/ | ||
resolvers?: Array<Type<any>> | (() => Array<Type<any>>); | ||
resolvers?: Array<Type<any>> | ((schema?: GraphQLSchema) => Array<Type<any>>); |
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.
I am not quire sure where the schema can be passed here.
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.
That's a tough one. The resolvers()
function is called from here and ultimately the call comes from here:
/**
* The internal module containing the Shop GraphQL API resolvers
*/
@Module({
imports: [ApiSharedModule, ...createDynamicGraphQlModulesForPlugins('shop')],
providers: [...shopResolvers, ...entityResolvers],
exports: [...shopResolvers],
})
export class ShopApiModule {}
which means at that point we don't have access to the schema object at all. There might be some way to refactor this by using some kind of dynamic module pattern. This would be quite advanced but I think should be possible.
Hi, thanks for the contribution. This is a good addition. Is the schema also needed in the |
@michaelbromley thanks for the insights on the resolvers! I think for my specific use-case it would be sufficient to just pass the current schema to the I will remove the changes to the |
Quality Gate passedIssues Measures |
Description
See #3165
Breaking changes
As JavaScript behaves this way, no breaking changes should be included:
Checklist
📌 Always:
👍 Most of the time: