Fix nesting when making OpenAPI arrays and objects optional (#1178)

This commit is contained in:
Martin Melka 2025-07-18 14:26:42 +02:00 committed by GitHub
commit 3543c13ca9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 50 additions and 6 deletions

View file

@ -95,8 +95,6 @@ async def test_optional_parameter_allows_null_for_type(param_schema):
# Should have anyOf with the original type and null
assert "anyOf" in optional_param_schema
assert {"type": "null"} in optional_param_schema["anyOf"]
# Check that original schema is preserved (either simple type or complex schema)
if "type" in param_schema:
assert {"type": param_schema["type"]} in optional_param_schema["anyOf"]
else:
assert param_schema in optional_param_schema["anyOf"]
# Check that original schema is fully preserved under anyOf
assert param_schema in optional_param_schema["anyOf"]