Generating key-val enums from a Graphene API #4685
-
I'm not sure if this is an issue with graphene or with codegen, but I am unable to generate key-val enums as described in this issue. No matter which configuration of graphene.Enum I use, the codegen always creates an enum with the key as the value. Would appreciate any suggestion on how to resolve. Example
generates
when I want
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Have you tried |
Beta Was this translation helpful? Give feedback.
-
@ardatan my understanding is that option provides you the ability to override enum values in your config, which would mean copying all of my key-value pairs from the backend. I'm looking for a way, as described in the linked issue, for codegen to automatically create the key-val mappings. |
Beta Was this translation helpful? Give feedback.
-
As @ardatan said, with the latest versions of codegen, if you are using a code file to load your schema, it will use the enum values from there. |
Beta Was this translation helpful? Give feedback.
As @ardatan said, with the latest versions of codegen, if you are using a code file to load your schema, it will use the enum values from there.
It's not possible to do that with GraphQL SDL since it doesn't support representing enum values.