Home / Function/ test_dereference_refs_mixed_ref_cyclical_with_properties() — langchain Function Reference

test_dereference_refs_mixed_ref_cyclical_with_properties() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/core/tests/unit_tests/utils/test_json_schema.py lines 794–834

def test_dereference_refs_mixed_ref_cyclical_with_properties() -> None:
    """Test cyclical mixed $refs preserve non-ref properties correctly."""
    schema = {
        "type": "object",
        "properties": {"root": {"$ref": "#/$defs/Node", "required": True}},
        "$defs": {
            "Node": {
                "type": "object",
                "properties": {
                    "id": {"type": "string"},
                    "child": {"$ref": "#/$defs/Node", "nullable": True},
                },
            }
        },
    }

    expected = {
        "type": "object",
        "properties": {
            "root": {
                "type": "object",
                "properties": {
                    "id": {"type": "string"},
                    "child": {"nullable": True},  # Cycle broken but nullable preserved
                },
                "required": True,  # Mixed property preserved
            }
        },
        "$defs": {
            "Node": {
                "type": "object",
                "properties": {
                    "id": {"type": "string"},
                    "child": {"$ref": "#/$defs/Node", "nullable": True},
                },
            }
        },
    }

    actual = dereference_refs(schema)
    assert actual == expected

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free