absinthe icon indicating copy to clipboard operation
absinthe copied to clipboard

Add WARNING for camelized identifiers

Open hisapy opened this issue 9 years ago • 7 comments

As a schema writer I want a big WARNING when I write a camelized identifier, i.e.: field :someField in order to avoid possible errors when querying/mutating the schema.

hisapy avatar Nov 16 '16 22:11 hisapy

This seems related to #185.

jparise avatar Nov 16 '16 22:11 jparise

I believe yes

hisapy avatar Nov 16 '16 23:11 hisapy

Just to start the discussion, keep in mind that this is a bit hard at the moment because adapters are a runtime phenomena. That is at compile time when the schema is built, we have no idea what convention you're gonna use.

benwilson512 avatar Nov 16 '16 23:11 benwilson512

Because regardless of which runtime adapter is being used, the internal representation will stay static (ie, the schema convention can't change), and because snake_case is conventional for Elixir, I think what we can do is tie a "default" adapter to the schema (and have the system-defined default be LanguageConventions), then have a schema's default adapter decide if a schema's definition warrants a warning.

Slated for v1.3's schema definition changes.

bruce avatar Nov 23 '16 20:11 bruce

@bruce do we want to go ahead with making non snake case field identifiers an error or warning?

benwilson512 avatar Apr 10 '17 20:04 benwilson512

Note that it will likely help with stuff like https://github.com/absinthe-graphql/absinthe/issues/298

benwilson512 avatar Apr 10 '17 20:04 benwilson512

I think we should just error. :fooBar just seems wrong, and it complicates a ton of things we can figure out implicitly to deal with it.

bruce avatar Apr 10 '17 20:04 bruce