Home / Function/ test_dereference_refs_cyclical_mixed_refs() — langchain Function Reference

test_dereference_refs_cyclical_mixed_refs() — langchain Function Reference

Architecture documentation for the test_dereference_refs_cyclical_mixed_refs() function in test_json_schema.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  d330086d_6620_a717_f4a2_94f5e3402645["test_dereference_refs_cyclical_mixed_refs()"]
  5d9c8eae_7a4a_0ffa_fa7c_a89825bcf1fa["test_json_schema.py"]
  d330086d_6620_a717_f4a2_94f5e3402645 -->|defined in| 5d9c8eae_7a4a_0ffa_fa7c_a89825bcf1fa
  style d330086d_6620_a717_f4a2_94f5e3402645 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/utils/test_json_schema.py lines 637–679

def test_dereference_refs_cyclical_mixed_refs() -> None:
    """Test cyclical references with mixed $ref properties don't cause loops."""
    schema = {
        "type": "object",
        "properties": {"node": {"$ref": "#/$defs/Node"}},
        "$defs": {
            "Node": {
                "type": "object",
                "properties": {
                    "id": {"type": "string"},
                    "parent": {"$ref": "#/$defs/Node", "nullable": True},
                    "children": {"type": "array", "items": {"$ref": "#/$defs/Node"}},
                },
            }
        },
    }

    # This should handle cycles gracefully
    actual = dereference_refs(schema)

    assert actual == {
        "$defs": {
            "Node": {
                "properties": {
                    "children": {"items": {"$ref": "#/$defs/Node"}, "type": "array"},
                    "id": {"type": "string"},
                    "parent": {"$ref": "#/$defs/Node", "nullable": True},
                },
                "type": "object",
            }
        },
        "properties": {
            "node": {
                "properties": {
                    "children": {"items": {}, "type": "array"},
                    "id": {"type": "string"},
                    "parent": {"nullable": True},
                },
                "type": "object",
            }
        },
        "type": "object",
    }

Domain

Subdomains

Frequently Asked Questions

What does test_dereference_refs_cyclical_mixed_refs() do?
test_dereference_refs_cyclical_mixed_refs() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/utils/test_json_schema.py.
Where is test_dereference_refs_cyclical_mixed_refs() defined?
test_dereference_refs_cyclical_mixed_refs() is defined in libs/core/tests/unit_tests/utils/test_json_schema.py at line 637.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free