strawberry
strawberry copied to clipboard
Lazy loading schema
Feature Request Type
- [ ] Core functionality
- [ ] Alteration (enhancement/optimization) of existing feature(s)
- [x] New behavior
Description
It would be useful for people to be able to load schemas on the fly (lazily at runtime) instead of binding them in a view. This could be used for dynamic graphql servers, when you need to serve a different schema per user context.
express-graphql
does this by allowing the schema to be resolved lazily.
Similar to this example:
https://github.com/graphql/express-graphql/issues/791
Note that in this case the options: Options
is either an Object or a promise returning an object.
Apollo does not offer this by default, only by using a dangerous hack (which unfortunately is used in production in a few places that I've seen):
https://github.com/apollographql/apollo-server/issues/2010#issuecomment-800218792