@@ -1041,7 +1041,20 @@ def test_build_enums(mocker):
1041
1041
build_model_property .assert_not_called ()
1042
1042
1043
1043
1044
- def test_build_model_property ():
1044
+ @pytest .mark .parametrize (
1045
+ "additional_properties_schema, expected_additional_properties" ,
1046
+ [
1047
+ (True , True ),
1048
+ (oai .Schema .construct (), True ),
1049
+ (None , True ),
1050
+ (False , False ),
1051
+ (
1052
+ oai .Schema .construct (type = "string" ),
1053
+ StringProperty (name = "AdditionalProperties" , required = True , nullable = False , default = None ),
1054
+ ),
1055
+ ],
1056
+ )
1057
+ def test_build_model_property (additional_properties_schema , expected_additional_properties ):
1045
1058
from openapi_python_client .parser .properties import Schemas , build_model_property
1046
1059
1047
1060
data = oai .Schema .construct (
@@ -1053,7 +1066,7 @@ def test_build_model_property():
1053
1066
},
1054
1067
description = "A class called MyModel" ,
1055
1068
nullable = False ,
1056
- additional_properties = oai . Schema . construct () ,
1069
+ additionalProperties = additional_properties_schema ,
1057
1070
)
1058
1071
schemas = Schemas (models = {"OtherModel" : None })
1059
1072
@@ -1086,7 +1099,7 @@ def test_build_model_property():
1086
1099
"from ..types import UNSET, Unset" ,
1087
1100
"from typing import Union" ,
1088
1101
},
1089
- additional_properties = True ,
1102
+ additional_properties = expected_additional_properties ,
1090
1103
)
1091
1104
1092
1105
0 commit comments