At a glance
Issue description
Hi all,
Here at FB we have some schema extensions that live in a separate file and are applied during the build. While this is not particularly relevant for GraphiQL, we really want to have this as part of the LSP. Therefore I propose the following:
- In the configuration of the LSP (
.graphqlrc), the user can specify the following:- (required) a package that provides two functions:
async init()andasync getSchema(). The latter returns the latest GraphQLSchema. Hopefully this can work in a similar way to babel plugins or webpack loaders. - (optional) arguments that are provided to the
initfunction, before thegetSchemafunction is called for the first time. - (optional) a glob relative to the
.graphqlrcthat triggers the schema to be reloaded on file change.
- (required) a package that provides two functions:
With this, I believe we can provide a very flexible schema loading experience. The first schema loaders we implement should probably be: a file schema loader to provide the current LSP experience and an introspection query schema loader to make it work with GraphiQL.