Skip to content

Commit b45eaec

Browse files
authored
Merge pull request #444 from Wim-De-Clercq/bugfix/442_additionalproperties_null
additionalProperties without schema should allow null.
2 parents 5c6ba11 + e017634 commit b45eaec

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Diff for: openapi_core/unmarshalling/schemas/unmarshallers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ def _unmarshal_properties(self, value: Any) -> Any:
292292
if additional_properties is not False:
293293
# free-form object
294294
if additional_properties is True:
295-
additional_prop_schema = Spec.from_dict({})
295+
additional_prop_schema = Spec.from_dict({"nullable": True})
296296
# defined schema
297297
else:
298298
additional_prop_schema = self.schema / "additionalProperties"

Diff for: tests/integration/validation/test_petstore.py

+2
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,7 @@ def test_post_cats(self, spec, spec_dict):
752752
"ears": {
753753
"healthy": pet_healthy,
754754
},
755+
"extra": None,
755756
}
756757
data = json.dumps(data_json)
757758
headers = {
@@ -799,6 +800,7 @@ def test_post_cats(self, spec, spec_dict):
799800
assert result.body.address.street == pet_street
800801
assert result.body.address.city == pet_city
801802
assert result.body.healthy == pet_healthy
803+
assert result.body.extra is None
802804

803805
def test_post_cats_boolean_string(self, spec, spec_dict):
804806
host_url = "https://staging.gigantic-server.com/v1"

0 commit comments

Comments
 (0)