Modern QA2026Test 3: No Conflicting Type Definitions — tiles
Log inJoin
49 / 89 · 04 API & Contract Testing with AI · Schema Federation Testing← prev⊞ allnext →☰ Read as one page

8.5Test 3: No Conflicting Type Definitions

When two subgraphs extend the same type, their field definitions must be compatible:

    def test_no_conflicting_type_definitions(self, subgraphs):
        """Subgraphs should not define conflicting field types for shared types."""
        type_fields = {}
        conflicts = []

        for subgraph_name, schema in subgraphs.items():
            for type_name, type_def in schema.get_types().items():
                if type_name.startswith("__"):
                    continue
                if type_name not in type_fields:
                    type_fields[type_name] = {}
                for field_name, field_type in type_def.fields.items():
                    if field_name in type_fields[type_name]:
                        existing = type_fields[type_name][field_name]
                        if field_type != existing["type"]:
                            conflicts.append(
                                f"Field '{type_name}.{field_name}' has conflicting types: "
                                f"'{existing['type']}' in {existing['subgraph']} vs "
                                f"'{field_type}' in {subgraph_name}"
                            )
                    type_fields[type_name][field_name] = {
                        "type": field_type,
                        "subgraph": subgraph_name
                    }

        assert not conflicts, (
            f"Found {len(conflicts)} type conflicts:\n" + "\n".join(conflicts)
        )