reactjs – GraphQL and React – Set default enum values in graphQL schema so the enum’s are generated with said values
I’m using React Typescript front end with a GraphQL backend. Currently I have a .schema.ts file that contains:
import gql from 'graphql-tag';
export default gql`
enum MyEnum {
First
Second
Third
}
`
I then have a .resolver.ts file that contains:
export default {
Mutation: {
//mutations here
},
MyEnum: {
First: 10,
Second: 12,
Third: 15
}
}
However when I run generate in the api folder, the generated GraphQL enum in generated/graphql.ts
is:
export enum MyEnum {
First = "First",
Second = "Second",
Third = "Third"
}
Is there something that I am missing to get the enum to generate with the specified default values?
Read more here: Source link