bito-code-review[bot] commented on code in PR #42655:
URL: https://github.com/apache/superset/pull/42655#discussion_r3717946245
##########
superset/mcp_service/chart/schemas.py:
##########
@@ -2379,6 +2387,19 @@ class UpdateChartRequest(ChartRequestNormalizerMixin,
QueryCacheControl):
),
)
+ @model_validator(mode="after")
+ def validate_column_patch(self) -> "UpdateChartRequest":
+ """Keep full-config replacement and additive table updates
unambiguous."""
+ if self.config is not None and self.add_columns is not None:
+ raise ValueError(
+ "Use either 'config' for a full visualization replacement or "
+ "'add_columns' to append table columns while preserving the
existing "
+ "configuration, not both."
+ )
Review Comment:
<!-- Bito Reply -->
The suggestion to add unit tests for the validator error branches is
appropriate and improves the code's robustness. Implementing these tests
ensures that the mutual exclusivity of 'config' and 'add_columns' is correctly
enforced and helps prevent regressions, as demonstrated by the bug you
identified and fixed.
--
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]