With SDL officially 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.
With SDL officially 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/buildSchemalack several features that are otherwise available if constructed programmatically:resolvefunctions for fieldsresolveTypefunctions for unions and interfaces andisTypeOffunctions for typesWorkarounds 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
__typenameproperty, etc.). In practice, though, if I'm starting a new project and want to use SDL to define my schema, I'm forced to usegraphql-toolsor 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.