-
Notifications
You must be signed in to change notification settings - Fork 535
Open
Labels
Description
Environment
- Elixir version:
Erlang/OTP 21 [erts-10.2.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe] [dtrace]
Elixir 1.7.4 (compiled with Erlang/OTP 21)
- Absinthe version (mix deps | grep absinthe):
* absinthe 1.4.13 (Hex package) (mix)
locked at 1.4.13 (absinthe) 81eb2ff4
- Client Framework and version (Relay, Apollo, etc): NA
Expected behavior
With the following input_object
:
input_object :comment_filter do
field :user_id, :id
field :post_id, :id
field :parent_id, :id, default_value: nil
end
used in the connection field
:
connection field :comments, node_type: :comment do
arg :filter, non_null(:comment_filter)
middleware ParseIDs, filter: [user_id: :user, post_id: :post, parent_id: :comment]
resolve &Resolvers.Core.comments/2
end
called with the query:
{
comments(first: 1, filter: {postId: "POST_ID"}) {
edges { cursor }
}
}
I expect my resolver &Resolvers.Core.comments/2
to be called with the following args:
def comments(args, _res) do
IO.inspect args
# %{filter: %{parent_id: nil, post_id: "POST_ID"}, first: 1}
...
end
Actual behavior
Instead my args are missing the nil
default value for :parent_id
:
def comments(args, _res) do
IO.inspect args
# %{filter: %{post_id: "POST_ID"}, first: 1}
...
end
There is currently no way to represent an explicit null/nil value using the default_value
option.
According to graphql-js
, when setting null
as the default value, it should be taken into account:
Let me know if this is the expected behaviour for Absinthe, if so I will close the issue.
sebastialonso, Ecksters, worace, Yobilat, MyNameIsURL and 9 more