YuriyKrasilnikov commented on PR #37516:
URL: https://github.com/apache/superset/pull/37516#issuecomment-3825155446
## Fixed in eba466aea6
### OpenAPI spec validation fix
**Problem:** `test_open_api_spec` was failing with `None for not nullable`.
**Root cause analysis:**
The issue was NOT in `apispec` version — it was in `load_default=None` on
the `timing` field.
```python
# Before (broken)
timing = fields.Nested(
ChartDataTimingSchema,
metadata={...},
allow_none=True,
load_default=None, # ← causes "default": null in OpenAPI
)
```
When `load_default=None` is present, apispec generates `"default": null` in
the schema. The validator then checks if `null` is valid against the `allOf`
schema — it's not, so validation fails.
**Testing results:**
| Configuration | apispec 6.6.1 |
|--------------|---------------|
| `allow_none=True` | ✓ |
| `+ metadata` | ✓ |
| `+ load_default=None` | ✗ |
**Fix:**
Removed `load_default=None` — marshmallow returns `None` for absent fields
with `allow_none=True` anyway.
```python
# After (works)
timing = fields.Nested(
ChartDataTimingSchema,
metadata={...},
allow_none=True,
)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]