sivavarma-x commented on code in PR #69761:
URL: https://github.com/apache/airflow/pull/69761#discussion_r3950463645
##########
shared/plugins_manager/src/airflow_shared/plugins_manager/plugins_manager.py:
##########
@@ -85,6 +87,62 @@ class AirflowPluginException(Exception):
"""Exception when loading plugin."""
+BaseDestinationLiteral = Literal["nav", "dag", "dag_run", "task",
"task_instance", "asset", "base"]
+
+
+class AppliesToDict(TypedDict):
+ """Dictionary structure for the optional ``applies_to`` scoping block on
UI plugins."""
+
+ dag_tags: NotRequired[list[str] | None]
+ dag_ids: NotRequired[list[str] | None]
+ task_ids: NotRequired[list[str] | None]
+ operators: NotRequired[list[str] | None]
+ operator_names: NotRequired[list[str] | None]
+
+
+class _BaseUIDict(TypedDict):
+ """Shared UI fields mirroring ``BaseUIResponse``."""
+
+ name: str
+ icon: NotRequired[str]
+ icon_dark_mode: NotRequired[str]
+ url_route: NotRequired[str]
+ category: NotRequired[str]
+ nav_top_level: NotRequired[bool]
+ applies_to: NotRequired[AppliesToDict | None]
+
+
+class ExternalViewDict(_BaseUIDict):
+ """Dictionary structure for entries in AirflowPlugin.external_views."""
+
+ href: str
+ destination: NotRequired[BaseDestinationLiteral]
+
+
+class ReactAppDict(_BaseUIDict):
+ """Dictionary structure for entries in AirflowPlugin.react_apps."""
+
+ bundle_url: str
+ destination: NotRequired[Literal[BaseDestinationLiteral, "dashboard",
"dag_overview", "task_overview"]]
+
+
+class FastAPIAppDict(TypedDict):
+ """Dictionary structure for entries in AirflowPlugin.fastapi_apps."""
+
+ app: Any
+ url_prefix: str
+ name: NotRequired[str]
Review Comment:
Thanks for the spot, Aligned with response models now,
Tightened `FastAPIAppDict.name` and `FastAPIRootMiddlewareDict.name` to
`required`.
Loosened the `_BaseUIDict` optionals to `NotRequired[T | None]` so authors
can pass `None` or omit the key (in line with `Response` as it accepts null).
--
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]