Skip to content

additionalProperties without schema should allow null. #444

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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": None,
}
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