graphql-code-generator: Enums are generated incorrectly
Describe the bug Graphql Enums have keys and values. Seems graphql-codegen uses only keys for generaring enums in typescript.
See example below:
// Such GQL enum
new GraphQLEnumType({
name: 'FvFormFillerServiceControlTypes',
values: {
Text1: {
value: 'lala'
}
}
})
// will be converted into such typescript enum:
export enum GQLFvFormFillerServiceControlTypes {
Text1 = 'Text1',
}
// Expected typescript enum is:
export enum GQLFvFormFillerServiceControlTypes {
Text1 = 'lala',
}
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 4
- Comments: 23 (1 by maintainers)
This is obviously incorrect behavior. GraphQL has in its enum key and value. Typescript has in its enum key and value. It seems logically correct to map key to key and value to value. Codegen should generate code rather than make me insert manually such enums 😃 I believe I can even create pull for that:)
@ardatan , Firstly - thanks a lot 😃 Secondly - yes, I’ll try 1.9.2-alpha-1455536b.55+1455536b. Will respond soon