@@ -184,16 +184,12 @@ defmodule GraphQL.Execution.Executor do
184
184
185
185
@ spec complete_value ( % Interface { } , ExecutionContext . t , GraphQL.Document . t , any , any ) :: { ExecutionContext . t , map }
186
186
defp complete_value ( % Interface { } = return_type , context , field_asts , info , result ) do
187
- runtime_type = AbstractType . get_object_type ( return_type , result , info . schema )
188
- { context , sub_field_asts } = collect_sub_fields ( context , runtime_type , field_asts )
189
- execute_fields ( context , runtime_type , result , sub_field_asts . fields )
187
+ complete_union_or_interface ( return_type , context , field_asts , info , result )
190
188
end
191
189
192
190
@ spec complete_value ( % Union { } , ExecutionContext . t , GraphQL.Document . t , any , any ) :: { ExecutionContext . t , map }
193
191
defp complete_value ( % Union { } = return_type , context , field_asts , info , result ) do
194
- runtime_type = AbstractType . get_object_type ( return_type , result , info . schema )
195
- { context , sub_field_asts } = collect_sub_fields ( context , runtime_type , field_asts )
196
- execute_fields ( context , runtime_type , result , sub_field_asts . fields )
192
+ complete_union_or_interface ( return_type , context , field_asts , info , result )
197
193
end
198
194
199
195
@ spec complete_value ( % List { } , ExecutionContext . t , GraphQL.Document . t , any , any ) :: map
@@ -345,4 +341,10 @@ defmodule GraphQL.Execution.Executor do
345
341
346
342
defp unwrap_type ( type ) when is_atom ( type ) , do: type . type
347
343
defp unwrap_type ( type ) , do: type
344
+
345
+ defp complete_union_or_interface ( return_type , context , field_asts , info , result ) do
346
+ runtime_type = AbstractType . get_object_type ( return_type , result , info . schema )
347
+ { context , sub_field_asts } = collect_sub_fields ( context , runtime_type , field_asts )
348
+ execute_fields ( context , runtime_type , result , sub_field_asts . fields )
349
+ end
348
350
end
0 commit comments