@@ -340,21 +340,17 @@ def test_schema_additionalProperties_nullable_allof(with_schema_additionalProper
340340 """
341341 api = OpenAPI ("/" , with_schema_additionalProperties_nullable_allof )
342342
343- schema = api ._ ["getRelations" ].return_value ()
344- value_type = schema .additionalProperties .get_type ()
343+ for op in ["implicit-allOf" , "explicit-allOf" , "explicit-oneOf" ]:
344+ schema = api ._ [op ].return_value ()
345+ value_type = schema .additionalProperties .get_type ()
345346
346- assert value_type .__pydantic_complete__ is True
347+ assert value_type .__pydantic_complete__ is True
347348
348- # non-null value
349- obj = value_type .model_validate ({"unitPartNumber" : "ABC" , "linkOccasions" : [{"unitTestId" : 1 }]})
350- assert obj .root .unitPartNumber == "ABC"
351- assert obj .root .linkOccasions [0 ].unitTestId == 1
352-
353- # map model accepts null values for the map entries
354- map_type = schema .get_type ()
355- result = map_type .model_validate ({"key1" : {"unitPartNumber" : "ABC" , "linkOccasions" : []}, "key2" : None })
356- assert result .root ["key2" ] is None
357- assert result .root ["key1" ].root .unitPartNumber == "ABC"
349+ # map model accepts null values for the map entries
350+ map_type = schema .get_type ()
351+ result = map_type .model_validate ({"obj" : {"a" : "ABC" }, "none" : None })
352+ assert result .root ["none" ] is None
353+ assert result .root ["obj" ].root .a == "ABC"
358354
359355
360356def test_schema_with_patternProperties (with_schema_patternProperties ):
0 commit comments