Skip to content

Conversion between snake and camel case inconsistencies #601

@kevmojay

Description

@kevmojay

I ran into an issue where the following field
field(:v_i_n, :string)
would produce the graphql field "vIN"

When requesting vIN, it would produce an error "errors":[{"message":"Cannot query field \"vIN\" on type \"Metadata\". Did you mean \"vIN\"?","locations":[{"line":30,"column":0}]}]}

This is because absinthe uses Macro.camelize and Macro.underscore. These aren't necessarily reverse operations.

iex(19)> "v_i_n" |> Macro.camelize |> Macro.underscore
"vin"
iex(20)> "foo_bar" |> Macro.camelize |> Macro.underscore
"foo_bar"

I was considering creating a PR to create a more consistent conversion but figured it would be too much of a breaking change.

I was curious if there were any potential options of how this should be solved, if at all.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions