pierrejeambrun commented on code in PR #64552:
URL: https://github.com/apache/airflow/pull/64552#discussion_r3028494414


##########
airflow-core/src/airflow/api_fastapi/common/types.py:
##########
@@ -216,7 +216,11 @@ def serialize_model(self, handler: Any) -> dict:
 class Theme(BaseModel):
     """JSON to modify Chakra's theme."""
 
-    tokens: dict[Literal["colors"], ThemeColors]
+    tokens: dict[Literal["colors"], ThemeColors] | None = None
     globalCss: dict[str, dict] | None = None
     icon: ThemeIconType = None
     icon_dark_mode: ThemeIconType = None
+
+    @model_serializer(mode="wrap")
+    def serialize_model(self, handler: Any) -> dict:
+        return {k: v for k, v in handler(self).items() if v is not None}

Review Comment:
   +1 using a model config will probably be better.



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

Reply via email to