In my Absinthe input types, I want to use an
enum field to restrict input to a list of known values – importantly, this is done to make life easier for the front-end scripts which will be sending values into our GraphQL API.
I’ve noticed that the
enum macro always upcases all the values, so even though I want the incoming values to be restricted to
myThing (i.e. camelCase), Absinthe seems to always convert this to
I’m looking at the source code in
Absinthe.Schema.Notation and I can see the
handle_enum_value_attrs function includes a call to
String.upcase that I think is the culprit, but I don’t yet follow the flow well enough to see if there’s a workaround for having the values restricted to the camelCases for the front end. (I did see the
as: option, but that only affects the value on the back-end).
Thanks for any pointers.