Open
Description
Environment
- Elixir version (elixir -v): 1.10.4
- Absinthe version (mix deps | grep absinthe): 1.6.3
- Client Framework and version (Relay, Apollo, etc): dillonkearns/elm-graphql 5.0.3
Expected behavior
Given this schema:
object :form_field do
field :value, :value_union do
resolve(fn field, _, _ ->
case field[:value] do
bool when is_boolean(bool) -> {:ok, %{boolean: bool}}
str -> {:ok, %{string: str}}
_ -> {:ok, nil}
end
end)
end
end
union :value_union do
types([:string_value, :boolean_value])
resolve_type(fn
bool, _ when is_boolean(bool) -> :boolean_value
str, _ -> :string_value
end)
end
object :string_value do
field(:string, non_null(:string))
end
object :boolean_value do
field(:boolean, non_null(:boolean))
end
I would expect the union resolve_type to not get called if {:ok, nil} is returned, but it is called…
Actual behavior
It returns an error that string_value.string returns nil from a non-nullable type. (it shouldn't get that far, all of value should be null
And, if I return nil
from resolve_type, it returns value: {}
in the response. Basically, a nullable union field doesn't seem to work…