SakshamSinghal20 opened a new pull request, #62455:
URL: https://github.com/apache/airflow/pull/62455

   Type hinting has been significantly improved for `AirflowPlugin` attributes 
to enhance developer experience and runtime safety.
   
   Previously, attributes such as `appbuilder_menu_items`, `external_views`, 
and `fastapi_apps` were typed as `List[Any]` or generic lists. This lack of 
structure made it difficult for plugin developers to know the expected schema 
and allowed invalid configurations to pass until they caused runtime errors.
   
   **Changes in this PR:**
   1.  **New Pydantic Models:** Defined strong configuration models for all 
plugin attributes:
       *   `ExternalViewConfig`
       *   `AppBuilderViewConfig`
       *   `AppBuilderMenuItemConfig`
       *   `FastAPIAppConfig`
       *   `FastAPIMiddlewareConfig`
   2.  **Updated `AirflowPlugin`:** Refactored the class to use 
`Sequence[Model]` type hints instead of `List[Any]`.
   3.  **Enhanced Validation:** Updated the `AirflowPlugin.validate()` method 
to rigorously check provided values against these schemas.
   4.  **Backward Compatibility:** The implementation accepts both strong model 
objects and legacy raw dictionaries (which are validated and converted), 
ensuring existing plugins continue to function.
   
   These changes allow IDEs to provide better autocompletion and catch 
configuration errors early during plugin loading.
   
   closes: #62222
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [x] Yes (for understanding and logic)


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