-
-
Notifications
You must be signed in to change notification settings - Fork 677
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
Dynamic schema generation #423
Comments
If you are sure that the
It should only apply to the "resolvers glob path" feature as I don't have any control even about which files will be required, so no array of class to compare and filter resolvers.
It's not as trivial, please discuss that first 😉 |
Good idea
I'm using an array of classes. The array is being updated (i.e. resolver removed), but the schema stays the same |
Show me how and when you are "updating" the array - when it's after the schema is built, it's too late 😕 |
https:/esunajs/esuna/blob/tgql-demo/packages/core/src/app.ts Brief overview of what's happening:
All of the logic for activating and deactivating seems to work on my end, but the generated schema still pulls in irrelevant resolvers |
This shouldn't happen, I can create two apollo server with different resolvers array and have no schema overlap.
Looks like you have a problem in your code - please log carefully the mapped resolvers array, maybe you are doing it too soon, some asynchronous goes into this, etc. |
🤦♂️I'm an idiot. This was an error on my part |
Thanks for the help! |
It would be great to be able to completely dynamically generate the schema. I am currently building a framework that allows users to add plugins which will add or remove parts of the schema, so I will never know what the schema will be at any given time. I have read through #110 and tested out the beta branch published with #415, however the feature set still seems limiting.
Currently (as of the
beta
version), the resolvers must be manually maintained as the type is[Function, ...Function[]]
. This doesn't allow for the resolvers array to be generated using.map()
or some other method. Also, once the resolver has been imported anywhere in the codebase, it automatically gets picked up bybuildSchema
and added to the final schema. I have managed to get around that final part by dynamically importing activated resolvers, but it only works one way, i.e. adding it to the schema works but removing it does not.I'm more than happy to submit a PR for this myself if it's trivial?
The text was updated successfully, but these errors were encountered: