@@ -135,6 +135,44 @@ def test_main_openapi_discriminator_allof_no_subtypes(output_file: Path) -> None
135135 )
136136
137137
138+ def test_main_openapi_allof_with_oneof_ref (output_file : Path ) -> None :
139+ """Test OpenAPI generation with allOf referencing a oneOf schema.
140+
141+ This tests the case where allOf combines a $ref to a schema with oneOf/discriminator
142+ and additional properties. Regression test for issue #1763.
143+ """
144+ run_main_and_assert (
145+ input_path = OPEN_API_DATA_PATH / "allof_with_oneof_ref.yaml" ,
146+ output_path = output_file ,
147+ input_file_type = "openapi" ,
148+ assert_func = assert_file_content ,
149+ expected_file = EXPECTED_OPENAPI_PATH / "allof_with_oneof_ref.py" ,
150+ extra_args = [
151+ "--output-model-type" ,
152+ "pydantic_v2.BaseModel" ,
153+ ],
154+ )
155+
156+
157+ def test_main_openapi_allof_with_anyof_ref (output_file : Path ) -> None :
158+ """Test OpenAPI generation with allOf referencing an anyOf schema.
159+
160+ This tests the case where allOf combines a $ref to a schema with anyOf
161+ and additional properties.
162+ """
163+ run_main_and_assert (
164+ input_path = OPEN_API_DATA_PATH / "allof_with_anyof_ref.yaml" ,
165+ output_path = output_file ,
166+ input_file_type = "openapi" ,
167+ assert_func = assert_file_content ,
168+ expected_file = EXPECTED_OPENAPI_PATH / "allof_with_anyof_ref.py" ,
169+ extra_args = [
170+ "--output-model-type" ,
171+ "pydantic_v2.BaseModel" ,
172+ ],
173+ )
174+
175+
138176def test_main_pydantic_basemodel (output_file : Path ) -> None :
139177 """Test OpenAPI generation with Pydantic BaseModel output."""
140178 run_main_and_assert (
0 commit comments