GraphQLSchema
Index
Constructors
constructor
Parameters
config: Readonly<GraphQLSchemaConfig>
Returns GraphQLSchema
Properties
__validationErrors
astNode
description
extensionASTNodes
extensions
Accessors
[toStringTag]
Returns string
Methods
getDirective
Parameters
name: string
Returns Maybe<GraphQLDirective>
getDirectives
Returns readonly GraphQLDirective[]
getField
This method looks up the field on the given type definition. It has special casing for the three introspection fields,
__schema
,__type
and__typename
.__typename
is special because it can always be queried as a field, even in situations where no other fields are allowed, like on a Union.__schema
and__type
could get automatically added to the query type, but that would require mutating type definitions, which would cause issues.Parameters
parentType: GraphQLCompositeType
fieldName: string
Returns undefined | GraphQLField<unknown, unknown, any>
getImplementations
Parameters
interfaceType: GraphQLInterfaceType<any, any>
Returns { interfaces: readonly GraphQLInterfaceType<any, any>[]; objects: readonly GraphQLObjectType<any, any>[] }
interfaces: readonly GraphQLInterfaceType<any, any>[]
objects: readonly GraphQLObjectType<any, any>[]
getMutationType
Returns Maybe<GraphQLObjectType<any, any>>
getPossibleTypes
Parameters
abstractType: GraphQLAbstractType
Returns readonly GraphQLObjectType<any, any>[]
getQueryType
Returns Maybe<GraphQLObjectType<any, any>>
getRootType
Parameters
operation: OperationTypeNode
Returns Maybe<GraphQLObjectType<any, any>>
getSubscriptionType
Returns Maybe<GraphQLObjectType<any, any>>
getType
Parameters
name: string
Returns undefined | GraphQLNamedType
getTypeMap
Returns TypeMap
isSubType
Parameters
abstractType: GraphQLAbstractType
maybeSubType: GraphQLObjectType<any, any> | GraphQLInterfaceType<any, any>
Returns boolean
toConfig
Returns GraphQLSchemaNormalizedConfig
Schema Definition
A Schema is created by supplying the root types of each type of operation, query and mutation (optional). A schema definition is then supplied to the validator and executor.
Example:
Note: When the schema is constructed, by default only the types that are reachable by traversing the root types are included, other types must be explicitly referenced.
Example:
Note: If an array of
directives
are provided to GraphQLSchema, that will be the exact list of directives represented and allowed. Ifdirectives
is not provided then a default set of the specified directives (e.g.@include
and@skip
) will be used. If you wish to provide additional directives to these specified directives, you must explicitly declare them. Example: