mirror of
https://github.com/ash-project/ash_graphql.git
synced 2024-09-20 21:32:59 +12:00
70eae5f421
Building upon #110, this restores the old behaviour of the result being nullable when root level errors are present. While the result is guaranteed to not be nullable in standard conditions (since either result or errors are always present), when errors are moved to the root level it could become null, so declaring it non-nullable propagates the null up to the data field. This actually causes compatibility problems with some client libraries (e.g. Relay) that expect the inner result to be null, _not_ data, if there's an error. This also adds dedicated RootLevelErrors versions of the Api and the Schema since the configuration is accessed at compile time now, so put_env was not enough to test them correctly.
30 lines
522 B
Elixir
30 lines
522 B
Elixir
defmodule AshGraphql.Test.RootLevelErrorsSchema do
|
|
@moduledoc false
|
|
|
|
use Absinthe.Schema
|
|
|
|
@apis [AshGraphql.Test.RootLevelErrorsApi]
|
|
|
|
use AshGraphql, apis: @apis
|
|
|
|
query do
|
|
end
|
|
|
|
mutation do
|
|
end
|
|
|
|
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
|
|
|
|
enum :status do
|
|
value(:open, description: "The post is open")
|
|
value(:closed, description: "The post is closed")
|
|
end
|
|
end
|