Skip to content

Commit

Permalink
update sdl stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelcaterisano committed Feb 29, 2024
1 parent 4eb0c8f commit 61e0c89
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions lib/absinthe/schema/notation/sdl_render.ex
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,11 @@ defmodule Absinthe.Schema.Notation.SDL.Render do
end

defp directives(directives, type_definitions) do
directives =
Enum.map(directives, fn directive ->
%{directive | name: Absinthe.Utils.camelize(directive.name, lower: true)}
end)

concat(Enum.map(directives, &render(&1, type_definitions)))
end

Expand Down
8 changes: 6 additions & 2 deletions test/absinthe/schema/type_system_directive_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ defmodule Absinthe.Schema.TypeSystemDirectiveTest do
:input_field_definition
]
end

directive :camel_case_me do
on [:field_definition]
end
end

defmodule TypeSystemDirectivesSdlSchema do
Expand Down Expand Up @@ -110,7 +114,7 @@ defmodule Absinthe.Schema.TypeSystemDirectiveTest do
directive :feature, name: ":field_definition"
end

field :sweet, :sweet_scalar
field :sweet, :sweet_scalar, directives: [:camel_case_me]
field :which, :category
field :pet, :dog

Expand Down Expand Up @@ -190,7 +194,7 @@ defmodule Absinthe.Schema.TypeSystemDirectiveTest do
type RootQueryType {
post: Post @feature(name: \":field_definition\")
sweet: SweetScalar
sweet: SweetScalar @camelCaseMe
which: Category
pet: Dog
search(filter: SearchFilter @feature(name: \":argument_definition\")): SearchResult @feature(name: \":argument_definition\")
Expand Down

0 comments on commit 61e0c89

Please sign in to comment.