InputTypeComposer
InputTypeComposer
is a class which helps to create and modify GraphQLInputObjectType
.
Static methods
static create()
Create InputTypeComposer
with adding it by name to the SchemaComposer
.
static create(
opts: TypeAsString |
ComposeInputObjectTypeConfig |
GraphQLInputObjectType
): InputTypeComposer;
static createTemp()
Create InputTypeComposer
without adding it to the SchemaComposer
. This method may be usefull in plugins, when you need to create type temporary.
static createTemp(
opts: TypeAsString |
ComposeInputObjectTypeConfig |
GraphQLInputObjectType
): InputTypeComposer;
Properties
schemaComposer
Current SchemaComposer
instance which is used for storing types created by InputTypeComposer
.
SomeITC.schemaComposer: SchemaComposer;
Field methods
getFields()
getFields(): ComposeInputFieldConfigMap;
getFieldNames()
getFieldNames(): Array<string>;
hasField()
hasField(
fieldName: string
): boolean;
setFields()
setFields(
fields: ComposeInputFieldConfigMap
): InputTypeComposer;
setField()
setField(
fieldName: string,
fieldConfig: ComposeInputFieldConfig
): InputTypeComposer;
addFields()
Add new fields or replace existed in a GraphQL type.
addFields(
newFields: ComposeInputFieldConfigMap
): InputTypeComposer;
addNestedFields()
Add new fields or replace existed (where field name may have dots).
addNestedFields(
newFields: ComposeInputFieldConfigMap
): InputTypeComposer;
getField()
Get fieldConfig by name
getField(
fieldName: string
): ComposeInputFieldConfig;
removeField()
removeField(
fieldNameOrArray: string | Array<string>
): InputTypeComposer;
removeOtherFields()
removeOtherFields(
fieldNameOrArray: string | Array<string>
): InputTypeComposer;
extendField()
extendField(
fieldName: string,
parialFieldConfig: ComposeInputFieldConfig
): InputTypeComposer;
reorderFields()
reorderFields(
names: Array<string>
): InputTypeComposer;
isFieldNonNull()
isFieldNonNull(
fieldName: string
): boolean;
isRequired()
An alias for isFieldNonNull
.
isRequired(
fieldName: string
): boolean;
getFieldConfig()
getFieldConfig(
fieldName: string
): GraphQLInputFieldConfig;
getFieldType()
getFieldType(
fieldName: string
): GraphQLInputType;
getFieldTC()
getFieldTC(
fieldName: string
): InputTypeComposer;
makeFieldNonNull()
makeFieldNonNull(
fieldNameOrArray: string | Array<string>
): InputTypeComposer;
makeRequired()
An alias for makeFieldNonNull.
makeRequired(
fieldNameOrArray: string | Array<string>
): InputTypeComposer;
makeFieldNullable()
makeFieldNullable(
fieldNameOrArray: string | Array<string>
): InputTypeComposer;
makeOptional()
An alias for makeFieldNullable.
makeOptional(
fieldNameOrArray: string | Array<string>
): InputTypeComposer;
Type methods
getType()
getType(): GraphQLInputObjectType;
getTypePlural()
getTypePlural(): GraphQLList<GraphQLInputObjectType>;
getTypeNonNull()
getTypeNonNull(): GraphQLNonNull<GraphQLInputObjectType>;
getTypeName()
getTypeName(): string;
setTypeName()
setTypeName(
name: string
): InputTypeComposer;
getDescription()
getDescription(): string;
setDescription()
setDescription(
description: string
): InputTypeComposer;
clone()
clone(
newTypeName: string
): InputTypeComposer;
Misc methods
get()
get(
path: string | Array<string>
): any;
Internal type definitions
Flowtype definitions which are used in this class.
InputTypeComposerDefinition
type InputTypeComposerDefinition =
| TypeAsString
| ComposeInputObjectTypeConfig
| GraphQLInputObjectType
ComposeInputFieldConfigMap
type ComposeInputFieldConfigMap = ObjMap<ComposeInputFieldConfig>;
ComposeInputFieldConfig
type ComposeInputFieldConfig =
| ComposeInputFieldConfigAsObject
| ComposeInputType
| (() => ComposeInputFieldConfigAsObject | ComposeInputType);
ComposeInputFieldConfigAsObject
type ComposeInputFieldConfigAsObject = {
type: Thunk<ComposeInputType> | GraphQLInputType,
defaultValue?: mixed,
description?: ?string,
astNode?: ?InputValueDefinitionNode,
[key: string]: any,
};
ComposeInputType
type ComposeInputType =
| InputTypeComposer
| ScalarTypeComposer
| EnumTypeComposer
| GraphQLInputType
| TypeAsString
| Array<ComposeInputType>;
ComposeInputObjectTypeConfig
type ComposeInputObjectTypeConfig = {
name: string,
fields: Thunk<ComposeInputFieldConfigMap>,
description?: ?string,
};