47 / 89 · 04 API & Contract Testing with AI · Schema Federation Testing← prev⊞ allnext →☰ Read as one page
8.3Test 1: All Subgraph Types Are Resolvable
class TestSchemaFederation:
"""Test that federated GraphQL schemas compose correctly."""
def test_all_subgraph_types_resolvable(self, composed_schema, subgraphs):
"""Every type defined in a subgraph should be resolvable
in the composed schema."""
for subgraph_name, subgraph_schema in subgraphs.items():
for type_name in subgraph_schema.get_types():
if type_name.startswith("__"): # Skip introspection types
continue
assert type_name in composed_schema.get_types(), (
f"Type '{type_name}' from subgraph '{subgraph_name}' "
f"is not resolvable in the composed schema"
)