Skip to content
Open
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
2 changes: 1 addition & 1 deletion lib/absinthe/blueprint/schema.ex
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ defmodule Absinthe.Blueprint.Schema do

def functions(module) do
if function_exported?(module, :functions, 0) do
module.functions
module.functions()
else
[]
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ defmodule Absinthe.Phase.Document.Validation.FieldsOnCorrectType do
[identifier]

%Type.Interface{identifier: identifier} ->
schema.__absinthe_interface_implementors__
schema.__absinthe_interface_implementors__()
|> Map.fetch!(identifier)

%Type.Union{types: types} ->
Expand Down
2 changes: 1 addition & 1 deletion lib/absinthe/phase/schema/directive_imports.ex
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ defmodule Absinthe.Phase.Schema.DirectiveImports do
defp do_imports([{module, opts} | rest], acc, schema) do
case ensure_compiled(module) do
{:module, module} ->
[other_def] = module.__absinthe_blueprint__.schema_definitions
[other_def] = module.__absinthe_blueprint__().schema_definitions

rejections = MapSet.new(Keyword.get(opts, :except, []))

Expand Down
2 changes: 1 addition & 1 deletion lib/absinthe/phase/schema/spec_compliant_int.ex
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ defmodule Absinthe.Phase.Schema.SpecCompliantInt do
defp handle_node(%Blueprint.Schema.ScalarTypeDefinition{identifier: :integer}) do
case ensure_compiled(Absinthe.Type.BuiltIns.SpecCompliantInt) do
{:module, module} ->
[types] = module.__absinthe_blueprint__.schema_definitions
[types] = module.__absinthe_blueprint__().schema_definitions

Enum.find(
types.type_definitions,
Expand Down
2 changes: 1 addition & 1 deletion lib/absinthe/phase/schema/type_extension_imports.ex
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ defmodule Absinthe.Phase.Schema.TypeExtensionImports do
defp do_imports([{module, opts} | rest], type_extensions_acc, schema) do
case ensure_compiled(module) do
{:module, module} ->
[other_def] = module.__absinthe_blueprint__.schema_definitions
[other_def] = module.__absinthe_blueprint__().schema_definitions

rejections = Keyword.get(opts, :except, []) |> MapSet.new()

Expand Down
2 changes: 1 addition & 1 deletion lib/absinthe/phase/schema/type_imports.ex
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ defmodule Absinthe.Phase.Schema.TypeImports do
defp do_imports([{module, opts} | rest], types_acc, schema) do
case ensure_compiled(module) do
{:module, module} ->
[other_def] = module.__absinthe_blueprint__.schema_definitions
[other_def] = module.__absinthe_blueprint__().schema_definitions

rejections =
MapSet.new([:query, :mutation, :subscription] ++ Keyword.get(opts, :except, []))
Expand Down
18 changes: 9 additions & 9 deletions lib/absinthe/schema.ex
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ defmodule Absinthe.Schema do
```

You can see what your schema's blueprint looks like by calling
`__absinthe_blueprint__` on any schema or type definition module.
`__absinthe_blueprint__()` on any schema or type definition module.

```
defmodule MyAppWeb.Schema do
Expand All @@ -38,7 +38,7 @@ defmodule Absinthe.Schema do
end
end

> MyAppWeb.Schema.__absinthe_blueprint__
> MyAppWeb.Schema.__absinthe_blueprint__()
#=> %Absinthe.Blueprint{...}
```

Expand Down Expand Up @@ -88,7 +88,7 @@ defmodule Absinthe.Schema do
end
end

Foo.__absinthe_blueprint__ #=> ...
Foo.__absinthe_blueprint__() #=> ...
```
"""

Expand Down Expand Up @@ -363,7 +363,7 @@ defmodule Absinthe.Schema do

@spec apply_modifiers(Absinthe.Pipeline.t(), t) :: Absinthe.Pipeline.t()
def apply_modifiers(pipeline, schema) do
Enum.reduce(schema.__absinthe_pipeline_modifiers__, pipeline, fn
Enum.reduce(schema.__absinthe_pipeline_modifiers__(), pipeline, fn
{module, function}, pipeline ->
apply(module, function, [pipeline])

Expand All @@ -382,7 +382,7 @@ defmodule Absinthe.Schema do
|> Absinthe.Pipeline.for_schema(prototype_schema: prototype_schema)
|> apply_modifiers(env.module)

env.module.__absinthe_blueprint__
env.module.__absinthe_blueprint__()
|> Absinthe.Pipeline.run(pipeline)
|> case do
{:ok, _, _} ->
Expand Down Expand Up @@ -621,7 +621,7 @@ defmodule Absinthe.Schema do
"""
@spec directives(t) :: [Type.Directive.t()]
def directives(schema) do
schema.__absinthe_directives__
schema.__absinthe_directives__()
|> Map.keys()
|> Enum.map(&lookup_directive(schema, &1))
end
Expand All @@ -643,7 +643,7 @@ defmodule Absinthe.Schema do
def to_sdl(schema) do
pipeline =
schema
|> Absinthe.Pipeline.for_schema(prototype_schema: schema.__absinthe_prototype_schema__)
|> Absinthe.Pipeline.for_schema(prototype_schema: schema.__absinthe_prototype_schema__())
|> Absinthe.Pipeline.upto({Absinthe.Phase.Schema.Validation.Result, pass: :final})
|> apply_modifiers(schema)

Expand All @@ -659,7 +659,7 @@ defmodule Absinthe.Schema do
"""
@spec implementors(t, Type.identifier_t() | Type.Interface.t()) :: [Type.Object.t()]
def implementors(schema, ident) when is_atom(ident) do
schema.__absinthe_interface_implementors__
schema.__absinthe_interface_implementors__()
|> Map.get(ident, [])
|> Enum.map(&lookup_type(schema, &1))
end
Expand All @@ -673,7 +673,7 @@ defmodule Absinthe.Schema do
"""
@spec types(t) :: [Type.t()]
def types(schema) do
schema.__absinthe_types__
schema.__absinthe_types__()
|> Map.keys()
|> Enum.map(&lookup_type(schema, &1))
end
Expand Down
8 changes: 4 additions & 4 deletions lib/absinthe/schema/compiled.ex
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@ defmodule Absinthe.Schema.Compiled do
end

def __absinthe_types__(schema_mod) do
Module.concat([schema_mod, Compiled]).__absinthe_types__
Module.concat([schema_mod, Compiled]).__absinthe_types__()
end

def __absinthe_types__(schema_mod, group) do
Module.concat([schema_mod, Compiled]).__absinthe_types__(group)
end

def __absinthe_directives__(schema_mod) do
Module.concat([schema_mod, Compiled]).__absinthe_directives__
Module.concat([schema_mod, Compiled]).__absinthe_directives__()
end

def __absinthe_interface_implementors__(schema_mod) do
Module.concat([schema_mod, Compiled]).__absinthe_interface_implementors__
Module.concat([schema_mod, Compiled]).__absinthe_interface_implementors__()
end

def __absinthe_schema_declaration__(schema_mod) do
Module.concat([schema_mod, Compiled]).__absinthe_schema_declaration__
Module.concat([schema_mod, Compiled]).__absinthe_schema_declaration__()
end
end
4 changes: 2 additions & 2 deletions lib/absinthe/schema/manager.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ defmodule Absinthe.Schema.Manager do
end

def init(schema_module) do
prototype_schema = schema_module.__absinthe_prototype_schema__
prototype_schema = schema_module.__absinthe_prototype_schema__()

pipeline =
schema_module
|> Absinthe.Pipeline.for_schema(prototype_schema: prototype_schema)
|> Absinthe.Schema.apply_modifiers(schema_module)

schema_module.__absinthe_blueprint__
schema_module.__absinthe_blueprint__()
|> Absinthe.Pipeline.run(pipeline)
|> case do
{:ok, _, _} ->
Expand Down
2 changes: 1 addition & 1 deletion lib/absinthe/type/built_ins/introspection.ex
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ defmodule Absinthe.Type.BuiltIns.Introspection do
field :kind,
type: non_null(:__type_kind),
resolve: fn _, %{source: %{__struct__: type}} ->
{:ok, type.kind}
{:ok, type.kind()}
end

field :name, :string
Expand Down
4 changes: 2 additions & 2 deletions lib/absinthe/utils.ex
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ defmodule Absinthe.Utils do
|> List.last()

types =
module.__absinthe_types__
module.__absinthe_types__()
|> Map.keys()
|> Enum.sort_by(& &1)
|> Enum.map(fn identifier ->
Expand All @@ -131,7 +131,7 @@ defmodule Absinthe.Utils do
end)

directives =
module.__absinthe_directives__
module.__absinthe_directives__()
|> Map.keys()
|> Enum.sort_by(& &1)
|> Enum.map(fn identifier ->
Expand Down