EnumTypeComposer
EnumTypeComposer
is a class which helps to create and modify GraphQLEnumType
.
Static methods
static create()
Create EnumTypeComposer
with adding it by name to the SchemaComposer
. This type became avaliable in SDL by its name.
static create(
opts: TypeAsString | GraphQLEnumTypeConfig | GraphQLEnumType
): EnumTypeComposer
static createTemp()
Create EnumTypeComposer
without adding it to the SchemaComposer
. This method may be usefull in plugins, when you need to create type temporary.
static createTemp(
opts: TypeAsString | GraphQLEnumTypeConfig | GraphQLEnumType
): EnumTypeComposer
Properties
schemaComposer
Current SchemaComposer
instance which is used for storing types created by EnumTypeComposer
.
SomeETC.schemaComposer: SchemaComposer;
Value methods
For similar naming with TypeComposer
and InputTypeComposer
for working with Enum values used methods with name *field*
instead of *value*
.
hasField()
hasField(
name: string
): boolean
getFields()
getFields(): GraphQLEnumValueConfigMap
getField()
getField(
name: string
): GraphQLEnumValueConfig;
getFieldNames()
getFieldNames(): Array<string>;
setFields()
Completely replace all values in the type with a new set.
setFields(
values: GraphQLEnumValueConfigMap
): EnumTypeComposer;
setField()
setField(
name: string,
valueConfig: GraphQLEnumValueConfig
): EnumTypeComposer;
addFields()
Add new fields or replace existed, rest fields keep untouched.
addFields(
newValues: GraphQLEnumValueConfigMap
): EnumTypeComposer;
removeField()
Remove one value by its name, or by array of field names.
removeField(
nameOrArray: string | Array<string>
): EnumTypeComposer;
removeOtherFields()
Keep only provided fields in type, other fields will be removed.
removeOtherFields(
fieldNameOrArray: string | Array<string>
): EnumTypeComposer;
reorderFields()
reorderFields(
names: Array<string>
): EnumTypeComposer;
extendField()
extendField(
name: string,
partialValueConfig: $Shape<GraphQLEnumValueConfig>
): EnumTypeComposer;
deprecateFields()
Mark value or map of values as deprecated
deprecateFields(
fields: { [fieldName: string]: string } | Array<string> | string
): EnumTypeComposer
Type methods
getType()
getType(): GraphQLEnumType;
getTypePlural()
getTypePlural(): GraphQLList<GraphQLEnumType>;
getTypeNonNull()
getTypeNonNull(): GraphQLNonNull<GraphQLEnumType>;
getTypeName()
getTypeName(): string;
setTypeName()
setTypeName(
name: string
): EnumTypeComposer;
getDescription()
getDescription(): string;
setDescription()
setDescription(
description: string
): EnumTypeComposer;
clone()
Create a new Enum type with provided name.
clone(
newTypeName: string
): EnumTypeComposer;
Internal type definitions
Flowtype definitions which are used in this class.
EnumTypeComposerDefinition
type EnumTypeComposerDefinition =
| TypeAsString
| GraphQLEnumTypeConfig
| GraphQLEnumType;