sadpandajoe commented on code in PR #43225:
URL: https://github.com/apache/superset/pull/43225#discussion_r3817614606
##########
superset/charts/schemas.py:
##########
@@ -510,15 +510,16 @@ class
ChartDataAggregateOptionsSchema(ChartDataPostProcessingOperationOptionsSch
Aggregate operation config.
"""
- groupby = (
- fields.List(
- fields.String(
- allow_none=False,
- metadata={"description": "Columns by which to group by"},
- ),
- metadata={"minLength": 1},
- required=True,
+ groupby = fields.List(
+ fields.String(
+ allow_none=False,
+ metadata={"description": "Columns by which to group by"},
),
+ # `minLength` as metadata neither validates a list nor is the right
+ # OpenAPI keyword for one -- arrays use `minItems`. A validator both
+ # enforces the bound and emits the correct constraint.
+ validate=Length(min=1),
Review Comment:
`aggregate()` explicitly treats an empty `groupby` as the global-aggregation
case, and the frontend emits `groupby: []` for that operation. Publishing
`minItems: 1` now tells schema-aware clients that this valid request is
invalid. Should the non-empty validator be limited to `index`, while retaining
the corrected array metadata for `groupby`?
--
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]