Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1302, camelize type system directives in sdl output #1303

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion lib/absinthe/schema/notation.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1991,7 +1991,6 @@ defmodule Absinthe.Schema.Notation do
defp default_name(Schema.DirectiveDefinition, identifier) do
identifier
|> Atom.to_string()
|> Absinthe.Utils.camelize(lower: true)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This did succeed in camelCasing the directive in the test below, but it broke a bunch of other things.

end

defp default_name(_, identifier) do
Expand Down
6 changes: 0 additions & 6 deletions test/absinthe/schema/sdl_render_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,6 @@ defmodule Absinthe.Schema.SdlRenderTest do
on :field
end

directive :foo_foo do
on :field
end
Comment on lines -211 to -213
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought this was a type system directive definition, but we're defining those using a prototype schema. I'm not clear on what kind of directive definition this is.


enum :order_status do
value :delivered
value :processing
Expand Down Expand Up @@ -248,8 +244,6 @@ defmodule Absinthe.Schema.SdlRenderTest do
query: RootQueryType
}

directive @fooFoo on FIELD

directive @foo(baz: String) on FIELD

\"Escaped\\t\\\"descrição\\/description\\\"\"
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