RFC 0 / Strawman

[LSP] Pluggable schema loading

Opened on
Closed on

At a glance

Project
GraphiQL
Identifier
ide-915
Stage
RFC 0 / Strawman
Champion
@Neitsch
Updated
2022-11-13
Latest activity
Issue closed on
Source

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() and async 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 init function, before the getSchema function is called for the first time.
    • (optional) a glob relative to the .graphqlrc that triggers the schema to be reloaded on file change.

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.

Timeline