For this kinds of enum creation:
import { registerEnumType } from '@nestjs/graphql';
export enum ColorEnum {
RED = 'red one',
BLUE = 'blue two',
GREEN = 'green three',
}
registerEnumType(ColorEnum, {
name: 'ColorEnum',
description: 'Color Types',
});
I want to set RED
as key and red one
as value. However, after it generated to GraphQL docs, it showed Enums as
ColorEnum
Color Types
Kind of type: Enum
Values
RED
BLUE
GREEN
It’s using key as value directly.
Something like data in Enums menu of ApolloGraphQL Studio:
Is it possible to transfer the value to GraphQL docs without resolver?
enum AuthType {
GOOGLE = 'google-auth',
GITHUB = 'github-auth',
OUTLOOK = 'outlook-auth',
}
interface UsersArgs {
first: number,
from?: string,
status?: String,
authType?: AuthType,
}
export const resolvers = {
AuthType,
Query: {
users: (_record: never, args: UsersArgs, _context: never) {
// args.authType will always be 'google-auth' or 'github-auth' or 'outlook-auth'
// ...
}
}
}