gabotorresruiz commented on code in PR #43571:
URL: https://github.com/apache/superset/pull/43571#discussion_r3961074325
##########
superset/mcp_service/chart/schemas.py:
##########
@@ -1045,6 +1045,57 @@ def reject_sql_expression_on_dimensions(self) ->
"PieChartConfig":
return self
+class RadarChartConfig(BaseChartConfig):
+ """Config for radar charts (viz_type ``radar``).
+
+ Matches the frontend Radar buildQuery contract: multiple ``metrics``
+ become the radar axes (indicators), and an optional ``groupby`` splits the
+ data into one polygon per category. With no groupby the whole dataset is a
+ single polygon. The query orders by the first metric descending.
+ """
+
+ model_config = ConfigDict(extra="ignore", populate_by_name=True)
+
+ chart_type: Literal["radar"] = "radar"
+ metrics: List[ColumnRef] = Field(
+ ...,
+ min_length=1,
Review Comment:
I looked into this one and I think `min_length=1` is correct as-is, so I
would resolve this without the arity change. The Explore control panel for
Radar uses the shared metrics control, whose only validator is
`validateNonEmpty`
(`superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/dndControls.tsx`),
so the UI itself accepts a single-metric radar. Bumping the MCP schema to
`min_length=2` would make the API stricter than the frontend it mirrors. I also
generated a single-metric radar on this branch over MCP and it validates and
maps fine.
@gkneighb the part of this thread worth acting on is the wording drift:
`pre_validate` says "Add two or more 'metrics'" and `schema_error_hint` says
"at least one", while the schema enforces one. Aligning all three to "at least
one metric; radars read best with 3 or more" keeps the guidance consistent with
the contract and with Explore. Not a blocker.
--
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]