bito-code-review[bot] commented on PR #44573:
URL: https://github.com/apache/superset/pull/44573#issuecomment-5793177469
<!-- Bito Reply -->
The flagged issue is correct. While `OmittedMeansUnchanged` correctly
removes `default: null` from the JSON schema to prevent clients from
accidentally clearing fields, the actual update logic in the dashboard service
likely relies on Pydantic's `model_fields_set` to distinguish between omitted
fields and fields explicitly set to `None`. If the service logic only checks
for non-null values (e.g., `if value is not None:`), it will ignore explicit
`null` values intended to clear fields.
To resolve this, the update logic should be updated to check
`model_fields_set` instead of just the field value. For example:
```python
# Instead of: if request.description is not None:
# Use:
if "description" in request.model_fields_set:
dashboard.description = request.description
```
This ensures that if `description` is in `model_fields_set`, the value (even
if `None`) is applied to the model. Would you like me to fetch all other
comments on this PR to validate and implement fixes for them as well?
**superset/mcp_service/dashboard/schemas.py**
```
if "description" in request.model_fields_set:
dashboard.description = request.description
```
--
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]