bito-code-review[bot] commented on PR #43427:
URL: https://github.com/apache/superset/pull/43427#issuecomment-5381940010

   <!-- Bito Reply -->
   The issue is correct. The current `dashArrayX` schema definition allows 
mixed types within the array because it uses `z.union([z.number(), 
z.array(z.number())])` for each element, which permits heterogeneous arrays 
like `[1, [2, 3]]`. To enforce uniformity, you should define the schema as a 
union of the three allowed types (`number`, `number[]`, or `number[][]`) rather 
than an array of unions.
   
   To resolve this, update the `dashArrayX` schema in 
`superset-frontend/plugins/plugin-chart-echarts/src/utils/eChartOptionsSchema.ts`
 as follows:
   
   ```typescript
     dashArrayX: z
       .union([z.number(), z.array(z.number()), z.array(z.array(z.number()))])
       .optional(),
   ```
   
   This change ensures that `dashArrayX` must be either a single number, a flat 
array of numbers, or a nested array of numbers, rejecting mixed-type arrays. 
Would you like me to check the rest of the comments on this PR and implement 
fixes for them as well?
   
   
**superset-frontend/plugins/plugin-chart-echarts/src/utils/eChartOptionsSchema.ts**
   ```
   dashArrayX: z
       .union([z.number(), z.array(z.number()), z.array(z.array(z.number()))])
       .optional(),
   ```


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