geido commented on code in PR #31163:
URL: https://github.com/apache/superset/pull/31163#discussion_r1858975647


##########
superset/dashboards/schemas.py:
##########
@@ -116,6 +116,28 @@ def validate_json_metadata(value: Union[bytes, bytearray, 
str]) -> None:
         raise ValidationError(errors)
 
 
+class SharedLabelsColorsField(fields.Field):
+    """
+    A custom field that accepts either a list of strings or a dictionary.
+    """
+
+    def _deserialize(
+        self,
+        value: Union[list[str], dict[str, str]],
+        attr: Union[str, None],
+        data: Union[Mapping[str, Any], None],
+        **kwargs: dict[str, Any],
+    ) -> list[str]:
+        if isinstance(value, list):
+            if all(isinstance(item, str) for item in value):
+                return value
+        elif isinstance(value, dict):
+            # Convert dict values to a list (for backward compatibility)
+            return []

Review Comment:
   Nope, it needs to be re-generated as the existing dict would be 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