Skip to content

Commit 0cbe2de

Browse files
committed
Add test for bad additionalProperties schema
1 parent e1ef9a7 commit 0cbe2de

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/test_parser/test_properties/test_init.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,6 +1125,30 @@ def test_build_model_property_bad_prop():
11251125
assert err == PropertyError(detail="unknown type not_real", data=oai.Schema(type="not_real"))
11261126

11271127

1128+
def test_build_model_property_bad_additional_props():
1129+
from openapi_python_client.parser.properties import Schemas, build_model_property
1130+
1131+
additional_properties = oai.Schema(
1132+
type="object",
1133+
properties={
1134+
"bad": oai.Schema(type="not_real"),
1135+
},
1136+
)
1137+
data = oai.Schema(additionalProperties=additional_properties)
1138+
schemas = Schemas(models={"OtherModel": None})
1139+
1140+
err, new_schemas = build_model_property(
1141+
data=data,
1142+
name="prop",
1143+
schemas=schemas,
1144+
required=True,
1145+
parent_name=None,
1146+
)
1147+
1148+
# assert new_schemas == schemas
1149+
assert err == PropertyError(detail="unknown type not_real", data=oai.Schema(type="not_real"))
1150+
1151+
11281152
def test_build_enum_property_conflict(mocker):
11291153
from openapi_python_client.parser.properties import Schemas, build_enum_property
11301154

0 commit comments

Comments
 (0)