import { GraphQLEnumType } from "https://dotland.deno.dev/x/graphql_deno@v15.0.0/lib/index.d.ts";
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.
Constructors
new
GraphQLEnumType(config: Readonly<GraphQLEnumTypeConfig>)Properties
astNode: Maybe<EnumTypeDefinitionNode>
extensionASTNodes: Maybe<ReadonlyArray<EnumTypeExtensionNode>>
Methods
getValue(name: string): Maybe<GraphQLEnumValue>
getValues(): Array<GraphQLEnumValue>
inspect(): string
parseLiteral(valueNode: ValueNode, _variables: Maybe<{ [key: string]: any; }>): Maybe<any>
parseValue(value: any): Maybe<any>
serialize(value: any): Maybe<string>
toConfig(): GraphQLEnumTypeConfig & { extensions: Maybe<Readonly<Record<string, any>>>; extensionASTNodes: ReadonlyArray<EnumTypeExtensionNode>; }
toJSON(): string
toString(): string