7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/graphql/stitching/composer/validate_type_resolvers.rb', line 7
def perform(supergraph, composer)
root_types = [
supergraph.schema.query,
supergraph.schema.mutation,
supergraph.schema.subscription,
].tap(&:compact!)
supergraph.schema.types.each do |type_name, type|
next unless type.kind.object? || type.kind.interface?
next if root_types.include?(type)
next if type.graphql_name.start_with?("__")
subgraph_types_by_location = composer.subgraph_types_by_name_and_location[type_name]
next unless subgraph_types_by_location.length > 1
resolvers = supergraph.resolvers[type_name]
if resolvers&.any?
validate_as_resolver(supergraph, type, subgraph_types_by_location, resolvers)
elsif type.kind.object?
validate_as_shared(supergraph, type, subgraph_types_by_location)
end
end
end
|