Skip to content

Commit

Permalink
additionalProperties without schema should allow null.
Browse files Browse the repository at this point in the history
  • Loading branch information
Wim-De-Clercq committed Dec 12, 2022
1 parent 4055a36 commit ae27109
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion openapi_core/unmarshalling/schemas/unmarshallers.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ def _unmarshal_properties(self, value: Any) -> Any:
if additional_properties is not False:
# free-form object
if additional_properties is True:
additional_prop_schema = Spec.from_dict({})
additional_prop_schema = Spec.from_dict({"nullable": True})
# defined schema
else:
additional_prop_schema = self.schema / "additionalProperties"
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/validation/test_petstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,7 @@ def test_post_cats(self, spec, spec_dict):
"ears": {
"healthy": pet_healthy,
},
"extra": 1,
}
data = json.dumps(data_json)
headers = {
Expand Down Expand Up @@ -799,6 +800,7 @@ def test_post_cats(self, spec, spec_dict):
assert result.body.address.street == pet_street
assert result.body.address.city == pet_city
assert result.body.healthy == pet_healthy
assert result.body.extra is None

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

0 comments on commit ae27109

Please sign in to comment.