mirror of
https://github.com/apache/superset.git
synced 2026-07-20 21:55:46 +00:00
fix(mcp): address bito review — pre_validate empty-list and chart_type=None error
- pivot_table.pre_validate: `not config.get("rows/metrics")` catches both
missing keys and empty lists, matching PivotTableChartConfig min_length=1
- chart_utils.map_config_to_form_data: omit `(chart_type=None)` suffix from
ValueError when chart_type is None to avoid misleading error messages
This commit is contained in:
@@ -337,6 +337,8 @@ def map_config_to_form_data(
|
||||
plugin = get_registry().get(chart_type) if chart_type else None
|
||||
|
||||
if plugin is None:
|
||||
if chart_type is None:
|
||||
raise ValueError(f"Unsupported config type: {type(config)}")
|
||||
raise ValueError(
|
||||
f"Unsupported config type: {type(config)} (chart_type={chart_type!r})"
|
||||
)
|
||||
|
||||
@@ -47,9 +47,9 @@ class PivotTableChartPlugin(BaseChartPlugin):
|
||||
) -> ChartGenerationError | None:
|
||||
missing_fields = []
|
||||
|
||||
if "rows" not in config:
|
||||
if not config.get("rows"):
|
||||
missing_fields.append("'rows' (row grouping columns)")
|
||||
if "metrics" not in config:
|
||||
if not config.get("metrics"):
|
||||
missing_fields.append("'metrics' (aggregation metrics)")
|
||||
|
||||
if missing_fields:
|
||||
|
||||
Reference in New Issue
Block a user