graphql / graphql/graphql-js

Add utility function function for generating fully-featured schema from SDL

Open
#1,858 3 comments 4 reactions 0 assignees View on GitHub
needs exploration
Dominant language
TypeScript
Stars
20.3k
Forks
2.1k
Avg merge
44m
Merged PRs (30d)
6

Description

With SDL [officially](https://github.com/graphql/graphql-spec/pull/90) part of the specification, would it be worthwhile to provide a way to build a build a fully-featured schema from a Document AST?

Currently, schemas built using `buildASTSchema`/`buildSchema` lack several features that are otherwise available if constructed programmatically:

* Specifying `resolve` functions for fields
* Specifying `resolveType` functions for unions and interfaces and `isTypeOf` functions for types
* Specifying enum value values
* Adding custom scalars

Workarounds exist for some of these limitations (functions can be passed through the root object for root type fields, abstract types can be handled by explicitly providing a `__typename` property, etc.). In practice, though, if I'm starting a new project and want to use SDL to define my schema, I'm forced to use `graphql-tools` or another third-party package. This was completely understandable prior to the 2018 version of the spec, but now it may be appropriate for this functionality to be part of the core library.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.