Absinthe Translation Field Names to DB Column Names

The easiest solution that seemed to work is to add a :name to the field definition:

field(:profilename, non_null(:string), name: "name")

It’s not very clear from the docs but you can check out the field docs Absinthe.Type.Field — absinthe v1.7.6 where it states:

:name - The name of the field, usually assigned automatically by the Absinthe.Schema.Notation.field/1.

Now the exposed field will be name while the one getting into resolvers will be profilename acting like a true alias.

3 Likes