SchemaUtils

SchemaUtils

new SchemaUtils()

The SchemaUtils is used by tools such as GQLExpressMiddleware in order to
apply GraphQL Lattice specifics to the build schema.

Source:

Methods

(static) ⌾⠀createMergedRoot(Classes, requestData) → {Promise.<Object>}

An asynchronous function used to parse the supplied classes for each
ones resolvers and mutators. These are all combined into a single root
object passed to express-graphql.

Source:
Parameters:
Name Type Description
Classes Array.<GQLBase>

the GQLBase extended class objects or
functions from which to merge the RESOLVERS and MUTATORS functions.

requestData Object

for Express apss, this will be an object
containing { req, res, gql } where those are the Express request and
response object as well as the GraphQL parameters for the request.

Returns:
Type:
Promise.<Object>

a Promise resolving to an Object containing all
the functions described in both Query and Mutation types.

(static) ⌾⠀injectComments(schema, Classes)

Until such time as I can get the reference Facebook GraphQL AST parser to
read and apply descriptions or until such time as I employ the Apollo
AST parser, providing a static get apiDocs() getter is the way to get
your descriptions into the proper fields, post schema creation.

This method walks the types in the registered classes and the supplied
schema type. It then injects the written comments such that they can
be exposed in graphiql and to applications or code that read the meta
fields of a built schema

Since:
  • 2.7.0
Source:
Parameters:
Name Type Description
schema Object

a built GraphQLSchema object created via buildSchema
or some other alternative but compatible manner

Classes Array.<function()>

these are GQLBase extended classes used to
manipulate the schema with.

(static) ⌾⠀injectEnums(schema, Classes)

Somewhat like injectComments and other similar methods, the
injectInterfaceResolvers method walks the registered classes and
finds GQLInterface types and applies their resolveType()
implementations.

Source:
Parameters:
Name Type Description
schema Object

a built GraphQLSchema object created via buildSchema
or some other alternative but compatible manner

Classes Array.<function()>

these are GQLBase extended classes used to
manipulate the schema with.

(static) ⌾⠀injectInterfaceResolvers(schema, Classes)

Somewhat like injectComments and other similar methods, the
injectInterfaceResolvers method walks the registered classes and
finds GQLInterface types and applies their resolveType()
implementations.

Source:
Parameters:
Name Type Description
schema Object

a built GraphQLSchema object created via buildSchema
or some other alternative but compatible manner

Classes Array.<function()>

these are GQLBase extended classes used to
manipulate the schema with.

(static) ⌾⠀injectScalars(schema, Classes)

GQLScalar types must define three methods to have a valid implementation.
They are serialize, parseValue and parseLiteral. See their docs for more
info on how to do so.

This code finds each scalar and adds their implementation details to the
generated schema type config.

Source:
Parameters:
Name Type Description
schema Object

a built GraphQLSchema object created via buildSchema
or some other alternative but compatible manner

Classes Array.<function()>

these are GQLBase extended classes used to
manipulate the schema with.