absinthe-graphql / absinthe

The GraphQL toolkit for Elixir
http://absinthe-graphql.org
Other
4.28k stars 524 forks source link

Schema compilation fails when defining a camel cased directive #1311

Closed beligante closed 6 months ago

beligante commented 6 months ago

Hello Absinthe Team!

I'm currently working on introduce federated graphql on my project and in order to progress with that we need to create a custom directive ( @interfaceObject ) which is a fairly new directive.

When trying to create the directive using absinthe's macro, I get a compilation error stating the directive doesn't exists. If I change the case to snake case for example it works as expected. I'm open to contribute to the repo in order to fix this, but I'm having a hard time finding the right spot to check why this is happening. I made a WIP PR with a broken test to exemplify the issue: https://github.com/absinthe-graphql/absinthe/pull/1310

If you guys point me to the place in code where is issue might be happening, I'm glad to work on a fix.

Environment

Expected behavior

Allow the creation of camel cased directives

Actual behavior

Compilation error image

Relevant Schema/Middleware Code

https://github.com/absinthe-graphql/absinthe/pull/1310

The tests on PR above, fail right on this step: https://github.com/absinthe-graphql/absinthe/blob/main/lib/absinthe/phase/schema/validation/known_directives.ex#L18

benwilson512 commented 6 months ago

Hi @beligante The elixir schemas always use snake case, and then the adapters allow the usage of camel case.