Skip to main content

GraphQLEnumType

Enum Type Definition

Some leaf values of requests and input values are Enums. GraphQL serializes Enum values as strings, however internally Enums can be represented by any kind of type, often integers.

Example:

const RGBType = new GraphQLEnumType({
name: 'RGB',
values: {
RED: { value: 0 },
GREEN: { value: 1 },
BLUE: { value: 2 }
}
});

Note: If a value is not provided in a definition, the name of the enum value will be used as its internal value.

Index

Constructors

constructor

Properties

astNode

astNode: Maybe<EnumTypeDefinitionNode>

description

description: Maybe<string>

extensionASTNodes

extensionASTNodes: readonly EnumTypeExtensionNode[]

extensions

extensions: Readonly<GraphQLEnumTypeExtensions>

name

name: string

Accessors

[toStringTag]

  • get [toStringTag](): string
  • Returns string

Methods

getValue

getValues

parseLiteral

  • parseLiteral(valueNode: ValueNode, _variables: Maybe<ObjMap<unknown>>): any
  • Parameters

    • valueNode: ValueNode
    • _variables: Maybe<ObjMap<unknown>>

    Returns any

parseValue

  • parseValue(inputValue: unknown): any
  • Parameters

    • inputValue: unknown

    Returns any

serialize

  • serialize(outputValue: unknown): Maybe<string>
  • Parameters

    • outputValue: unknown

    Returns Maybe<string>

toConfig

  • toConfig(): GraphQLEnumTypeNormalizedConfig
  • Returns GraphQLEnumTypeNormalizedConfig

toJSON

  • toJSON(): string
  • Returns string

toString

  • toString(): string
  • Returns string