I use graphql-codegen to generate type files.
As an example, let's say I have the following in my schema.graphql
file:
enum cities {
JOHANNESBURG
CAIRO
NEW_YORK
LONDON
BEIJING
}
The output in my generated-types.ts
file is as follows:
export enum cities {
Johannesburg = 'JOHANNESBURG'
Cairo = 'CAIRO'
NewYork = 'NEW_YORK'
London = 'LONDON'
Beijing = 'BEIJING'
}
Is there a way for me to 'override' the value of the enum before codegen runs? Perhaps something as follows (which I obviously tried):
enum cities {
JOHANNESBURG: 'JNB'
CAIRO: 'CAI'
NEW_YORK: 'NYC'
LONDON: 'LON'
BEIJING: 'BEI'
}
which in turn should produce:
export enum cities {
Johannesburg = 'JNB'
Cairo = 'CAI'
NewYork = 'NYC'
London = 'LON'
Beijing = 'BEI'
}