Skip to content

Commit affa92c

Browse files
committed
Support for non null args
1 parent 7ed5f98 commit affa92c

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

lib/absinthe/blueprint/schema/enum_type_definition.ex

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ defmodule Absinthe.Blueprint.Schema.EnumTypeDefinition do
3030
errors: [Absinthe.Phase.Error.t()]
3131
}
3232

33-
@spec build(t, any) :: Absinthe.Type.Enum.t()
3433
def build(type_def, _schema) do
3534
%Absinthe.Type.Enum{
3635
identifier: type_def.identifier,

lib/absinthe/schema/notation/sdl_render.ex

+8-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,14 @@ defmodule Absinthe.Schema.Notation.SDL.Render do
109109
nil
110110

111111
value when is_atom(value) ->
112-
definition = Enum.find(type_definitions, fn d -> input_value.type == d.identifier end)
112+
typ =
113+
case input_value.type do
114+
%Absinthe.Blueprint.TypeReference.NonNull{of_type: t} -> t
115+
%Absinthe.Blueprint.TypeReference.List{of_type: t} -> t
116+
t -> t
117+
end
118+
119+
definition = Enum.find(type_definitions, fn d -> typ == d.identifier end)
113120

114121
case definition do
115122
nil ->

test/absinthe/schema/sdl_render_test.exs

+2-2
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ defmodule Absinthe.Schema.SdlRenderTest do
198198
arg :times, :integer, default_value: 10, description: "The number of times"
199199
arg :time_interval, :integer
200200
arg :time_string, :string, default_value: "2021"
201-
arg :order_status, :order_status, default_value: :processing
201+
arg :order_status, non_null(:order_status), default_value: :processing
202202
end
203203

204204
field :search, :search_result
@@ -259,7 +259,7 @@ defmodule Absinthe.Schema.SdlRenderTest do
259259
260260
timeString: String = "2021"
261261
262-
orderStatus: OrderStatus = PROCESSING
262+
orderStatus: OrderStatus! = PROCESSING
263263
): String
264264
search: SearchResult
265265
}

0 commit comments

Comments
 (0)