@@ -1423,6 +1423,54 @@ def test_main_all_of_multi_ref_with_property_override(output_file: Path) -> None
14231423 )
14241424
14251425
1426+ def test_main_all_of_deep_hierarchy_property_override (output_file : Path ) -> None :
1427+ """Test allOf with deep hierarchy inherits types from grandparent when parent has partial override."""
1428+ with chdir (JSON_SCHEMA_DATA_PATH ):
1429+ run_main_and_assert (
1430+ input_path = Path ("all_of_deep_hierarchy_property_override.json" ),
1431+ output_path = output_file ,
1432+ input_file_type = "jsonschema" ,
1433+ assert_func = assert_file_content ,
1434+ expected_file = "all_of_deep_hierarchy_property_override.py" ,
1435+ )
1436+
1437+
1438+ def test_main_all_of_very_deep_hierarchy_property_override (output_file : Path ) -> None :
1439+ """Test allOf with 4+ levels of hierarchy inherits types from great-grandparent."""
1440+ with chdir (JSON_SCHEMA_DATA_PATH ):
1441+ run_main_and_assert (
1442+ input_path = Path ("all_of_very_deep_hierarchy_property_override.json" ),
1443+ output_path = output_file ,
1444+ input_file_type = "jsonschema" ,
1445+ assert_func = assert_file_content ,
1446+ expected_file = "all_of_very_deep_hierarchy_property_override.py" ,
1447+ )
1448+
1449+
1450+ def test_main_all_of_hierarchy_property_not_in_ancestor (output_file : Path ) -> None :
1451+ """Test allOf hierarchy when property override is not found in any ancestor."""
1452+ with chdir (JSON_SCHEMA_DATA_PATH ):
1453+ run_main_and_assert (
1454+ input_path = Path ("all_of_hierarchy_property_not_in_ancestor.json" ),
1455+ output_path = output_file ,
1456+ input_file_type = "jsonschema" ,
1457+ assert_func = assert_file_content ,
1458+ expected_file = "all_of_hierarchy_property_not_in_ancestor.py" ,
1459+ )
1460+
1461+
1462+ def test_main_all_of_hierarchy_inline_allof (output_file : Path ) -> None :
1463+ """Test allOf hierarchy when parent has inline allOf without $ref."""
1464+ with chdir (JSON_SCHEMA_DATA_PATH ):
1465+ run_main_and_assert (
1466+ input_path = Path ("all_of_hierarchy_inline_allof.json" ),
1467+ output_path = output_file ,
1468+ input_file_type = "jsonschema" ,
1469+ assert_func = assert_file_content ,
1470+ expected_file = "all_of_hierarchy_inline_allof.py" ,
1471+ )
1472+
1473+
14261474@pytest .mark .skipif (
14271475 black .__version__ .split ("." )[0 ] >= "24" ,
14281476 reason = "Installed black doesn't support the old style" ,
0 commit comments