apache / airflow

Apache Airflow - A platform to programmatically author, schedule, and monitor workflows
https://airflow.apache.org/
Apache License 2.0
36.32k stars 14.09k forks source link

Properly setup bundled swagger-ui in Connexion #36975

Closed Taragolis closed 6 months ago

Taragolis commented 7 months ago

Body

Initially reported in Slack

Hi. I just upgraded to 2.8.1 and am wondering if this is a new warning message:

[2024-01-23T15:02:27.020+0000] {options.py:83} WARNING - The swagger_ui directory could not be found.
    Please install connexion with extra install: pip install connexion[swagger-ui]
    or provide the path to your local installation by passing swagger_path=<your path>

This warning message might comes from the different places:

FAB Auth Manager

https://github.com/apache/airflow/blob/18d2498e44b58f8cfbc24e2b3beaa3b7cc7c187f/airflow/providers/fab/auth_manager/fab_auth_manager.py#L159-L161

Internal API

https://github.com/apache/airflow/blob/4d96a9a3a1bcf099856051e51bc328afbf558da6/airflow/www/extensions/init_views.py#L301


The nature of this warning that we use bundled to Airflow swagger ui (added in https://github.com/apache/airflow/pull/28788) that mean we do not require connexion[swagger-ui] however for proper work we need to setup swagger_path in Connexion 2.x options by the same way as it done in regular REST API:

https://github.com/apache/airflow/blob/4d96a9a3a1bcf099856051e51bc328afbf558da6/airflow/www/extensions/init_views.py#L276-L279

Or disable swagger by provide swagger_ui=False if this components do not use swagger, unfortunetly I'm not confident about it.

In addition parameters names/types changed in Connexion 3, see: https://connexion.readthedocs.io/en/3.0.5/swagger_ui.html, so better to take it in account into the https://github.com/apache/airflow/pull/36052 or similar PRs

Committer

potiuk commented 7 months ago

Nice. We might have soon interns from Major League Hacking to take a look at the Connexion upgrade so let's keep it in mind