Skip to content

Restructure build for building GraphQLSchema #5

@migueloller

Description

@migueloller

There are various problems when trying to build a schema that make the API more confusing.

  • Inferring a schema comes with the problem of it not being intuitive where build will check for the operations. Can they all be type dependencies? Do they all have to be in the AST?
  • Schema must declare directives and types and these cannot be lazily evaluated, meaning that for this particular use case build wouldn't support thunks for type dependencies. This is inconsistent.
  • Finally, because a GraphQL schema does not have a name, it's impossible to deterministically set the schema config via the config argument of build.

Perhaps it would be best to delegate schema creation to a separate function and use build only for types. While it adds an extra function it reduces complexity by separating concerns.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions