graphql-go / graphql

An implementation of GraphQL for Go / Golang
MIT License
9.87k stars 839 forks source link

How can i declare enum argument with customized value #570

Open wshuhd opened 4 years ago

wshuhd commented 4 years ago

in typescript , if i declare a enum and want to use customized value ,i can use like this

enum RelationEnum{
        A = 2
        B = 3
        C = 4
        D = 5
}

but i foud it's not supported in graphql, how can i do in graphql ?

bhoriuchi commented 3 years ago

you need to define an EnumConfig to do that. You can also use https://github.com/bhoriuchi/graphql-go-tools to define custom values for your enums