2020-12-02 18:07:15 +13:00
|
|
|
defmodule AshGraphql.Test.Schema do
|
2020-12-02 18:55:25 +13:00
|
|
|
@moduledoc false
|
|
|
|
|
2020-12-02 18:07:15 +13:00
|
|
|
use Absinthe.Schema
|
|
|
|
|
|
|
|
@apis [AshGraphql.Test.Api]
|
|
|
|
|
|
|
|
use AshGraphql, apis: @apis
|
|
|
|
|
2021-03-29 05:30:28 +13:00
|
|
|
object :foo do
|
|
|
|
field(:foo, :string)
|
|
|
|
field(:bar, :string)
|
|
|
|
end
|
|
|
|
|
|
|
|
input_object :foo_input do
|
|
|
|
field(:foo, non_null(:string))
|
|
|
|
field(:bar, non_null(:string))
|
|
|
|
end
|
|
|
|
|
2021-03-29 08:46:23 +13:00
|
|
|
enum :status do
|
|
|
|
value(:open, description: "The post is open")
|
|
|
|
value(:closed, description: "The post is closed")
|
|
|
|
end
|
|
|
|
|
2020-12-02 18:07:15 +13:00
|
|
|
query do
|
|
|
|
end
|
|
|
|
|
|
|
|
mutation do
|
|
|
|
end
|
|
|
|
|
|
|
|
def context(ctx) do
|
|
|
|
AshGraphql.add_context(ctx, @apis)
|
|
|
|
end
|
|
|
|
|
2020-12-02 18:55:25 +13:00
|
|
|
def plugins do
|
2020-12-02 18:07:15 +13:00
|
|
|
[Absinthe.Middleware.Dataloader | Absinthe.Plugin.defaults()]
|
|
|
|
end
|
|
|
|
end
|