Definitions
GraphQLSchema
A representation of the capabilities of a GraphQL Server.
class GraphQLSchema {
constructor(config: GraphQLSchemaConfig)
}
type GraphQLSchemaConfig = {
query: GraphQLObjectType;
mutation?: ?GraphQLObjectType;
}
GraphQLScalarType
A scalar type within GraphQL.
class GraphQLScalarType<InternalType> {
constructor(config: GraphQLScalarTypeConfig<InternalType>)
}
type GraphQLScalarTypeConfig<InternalType> = {
name: string;
description?: ?string;
serialize: (value: mixed) => ?InternalType;
parseValue?: (value: mixed) => ?InternalType;
parseLiteral?: (valueAST: Value) => ?InternalType;
}
GraphQLInterfaceType
An interface type within GraphQL that defines field implementations will contain.
class GraphQLInterfaceType {
constructor(config: GraphQLInterfaceTypeConfig)
}
type GraphQLInterfaceTypeConfig = {
name: string,
fields: GraphQLFieldConfigMapThunk | GraphQLFieldConfigMap,
resolveType?: (value: any, info?: GraphQLResolveInfo) => ?GraphQLObjectType,
description?: ?string
};
GraphQLUnionType
A union type within GraphQL that defines a list of implementations.
class GraphQLUnionType {
constructor(config: GraphQLUnionTypeConfig)
}
type GraphQLUnionTypeConfig = {
name: string,
types: GraphQLObjectsThunk | Array<GraphQLObjectType>,
resolveType?: (value: any, info?: GraphQLResolveInfo) => ?GraphQLObjectType;
description?: ?string;
};
type GraphQLObjectsThunk = () => Array<GraphQLObjectType>;
GraphQLEnumType
An enum type within GraphQL that defines a list of valid values.
class GraphQLEnumType {
constructor(config: GraphQLEnumTypeConfig)
}
type GraphQLEnumTypeConfig = {
name: string;
values: GraphQLEnumValueConfigMap;
description?: ?string;
}
type GraphQLEnumValueConfigMap = {
[valueName: string]: GraphQLEnumValueConfig;
};
type GraphQLEnumValueConfig = {
value?: any;
deprecationReason?: string;
description?: ?string;
}
type GraphQLEnumValueDefinition = {
name: string;
value?: any;
deprecationReason?: string;
description?: ?string;
}
GraphQLInputObjectType
An input object type within GraphQL that represents structured inputs.
class GraphQLInputObjectType {
constructor(config: GraphQLInputObjectConfig)
}
type GraphQLInputObjectConfig = {
name: string;
fields: GraphQLInputObjectConfigFieldMapThunk | GraphQLInputObjectConfigFieldMap;
description?: ?string;
}
type GraphQLInputObjectConfigFieldMapThunk = () => GraphQLInputObjectConfigFieldMap;
type GraphQLInputObjectFieldConfig = {
type: GraphQLInputType;
defaultValue?: any;
description?: ?string;
}
type GraphQLInputObjectConfigFieldMap = {
[fieldName: string]: GraphQLInputObjectFieldConfig;
};
type GraphQLInputObjectField = {
name: string;
type: GraphQLInputType;
defaultValue?: any;
description?: ?string;
}
type GraphQLInputObjectFieldMap = {
[fieldName: string]: GraphQLInputObjectField;
};
GraphQLList
A type wrapper around other types that represents a list of those types.
class GraphQLList {
constructor(type: GraphQLType)
}
GraphQLNonNull
A type wrapper around other types that represents a non-null version of those types.
class GraphQLNonNull {
constructor(type: GraphQLType)
}
Predicates
isInputType
Returns if a type can be used as input types for arguments and directives.
function isInputType(type: ?GraphQLType): boolean
isOutputType
Returns if a type can be used as output types as the result of fields.
function isOutputType(type: ?GraphQLType): boolean
isLeafType
Returns if a type can be a leaf value in response.
function isLeafType(type: ?GraphQLType): boolean
isCompositeType
Returns if a type can be the parent context of a selection set.
function isCompositeType(type: ?GraphQLType): boolean
isAbstractType
Returns if a type is a combination of object types.
function isAbstractType(type: ?GraphQLType): boolean
Un-modifiers
getNullableType
Strips any non-null wrappers from a type.
function getNullableType(type: ?GraphQLType): ?GraphQLNullableType
getNamedType
Strips any non-null or list wrappers from a type.
function getNamedType(type: ?GraphQLType): ?GraphQLNamedType
Scalars
GraphQLInt
A scalar type representing integers.
var GraphQLInt: GraphQLScalarType;
GraphQLFloat
A scalar type representing floats.
var GraphQLFloat: GraphQLScalarType;
GraphQLString
A scalar type representing strings.
var GraphQLString: GraphQLScalarType;
GraphQLBoolean
A scalar type representing booleans.
var GraphQLBoolean: GraphQLScalarType;
GraphQLID
A scalar type representing IDs.
var GraphQLID: GraphQLScalarType;