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

Add directive locations for schema #743

Merged
merged 6 commits into from
Jun 13, 2019
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/blueprint/directive.ex
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ defmodule Absinthe.Blueprint.Directive do
def placement(%Blueprint.Document.Fragment.Named{}), do: :fragment_definition
def placement(%Blueprint.Document.Fragment.Spread{}), do: :fragment_spread
def placement(%Blueprint.Document.Fragment.Inline{}), do: :inline_fragment
def placement(%Blueprint.Document.Operation{}), do: :operation_definition
def placement(%Blueprint.Schema.SchemaDefinition{}), do: :schema
def placement(%Blueprint.Schema.SchemaDeclaration{}), do: :schema
def placement(%Blueprint.Schema.ScalarTypeDefinition{}), do: :scalar
Expand Down
15 changes: 12 additions & 3 deletions lib/absinthe/type/built_ins/introspection.ex
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,24 @@ defmodule Absinthe.Type.BuiltIns.Introspection do

enum :__directive_location,
values: [
# OPERATIONS
:query,
:mutation,
:subscription,
:field,
:fragment_definition,
:fragment_spread,
:inline_fragment
# TODO: Schema definitions to support Schema input
:inline_fragment,
:schema,
:scalar,
:object,
:field_definition,
:interface,
:union,
:enum,
:enum_value,
:input_object,
:argument_definition,
:input_field_definition
]

object :__type do
Expand Down
13 changes: 12 additions & 1 deletion lib/absinthe/type/directive.ex
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,17 @@ defmodule Absinthe.Type.Directive do
defp do_on?(:fragment_definition, %Language.Fragment{}), do: true
defp do_on?(:fragment_spread, %Language.FragmentSpread{}), do: true
defp do_on?(:inline_fragment, %Language.InlineFragment{}), do: true
# TODO: Schema definitions to support Schema input
defp do_on?(:schema, %Language.SchemaDefinition{}), do: true
defp do_on?(:schema, %Language.SchemaDeclaration{}), do: true
defp do_on?(:scalar, %Language.ScalarTypeDefinition{}), do: true
defp do_on?(:object, %Language.ObjectTypeDefinition{}), do: true
defp do_on?(:field_definition, %Language.FieldDefinition{}), do: true
defp do_on?(:interface, %Language.InterfaceTypeDefinition{}), do: true
defp do_on?(:union, %Language.UnionTypeDefinition{}), do: true
defp do_on?(:enum, %Language.EnumTypeDefinition{}), do: true
defp do_on?(:enum_value, %Language.EnumValueDefinition{}), do: true
defp do_on?(:input_object, %Language.InputObjectTypeDefinition{}), do: true
defp do_on?(:argument_definition, %Language.InputValueDefinition{}), do: true
defp do_on?(:input_field_definition, %Language.InputValueDefinition{}), do: true
defp do_on?(_, _), do: false
end