SEPURI-SAI-KRISHNA commented on code in PR #43225:
URL: https://github.com/apache/superset/pull/43225#discussion_r3860993739


##########
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:
   Agreed, and done, the non-empty validator is now limited to `index`, with 
`groupby` keeping only the corrected array metadata.
   
   Confirming against the generated OpenAPI rather than the field declarations:
   
       Aggregate.groupby:  required=True   minItems=(absent)
       Pivot.index:        required=True   minItems=1
   
   `groupby` stays `required` because `aggregate()` gives it no default, but it 
publishes no lower bound, so `groupby: []` validates.
   
   For the record on why this mattered: `aggregateOperator.ts:54` hardcodes 
`groupby: []` for every aggregate operation it emits, so `minItems: 1` would 
have documented Superset's own request as invalid.



-- 
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]

Reply via email to