You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/12/14 08:29:39 UTC

[GitHub] [airflow] gschuurman opened a new pull request, #28354: Allow Users to disable SwaggerUI via configuration

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

   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of an existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   Due to potential issues we want to give teams the opportunity to disable the swaggerUI. This can now be done via the configuration key: webserver.enable_swagger_ui.
   For backwards compatibility this has been set to default true, but for teams willing to disable this it can be set to false.
   ---
   **^ Add meaningful description above**
   
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
   In case of fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in a newsfragment file, named `{pr_number}.significant.rst` or `{issue_number}.significant.rst`, in [newsfragments](https://github.com/apache/airflow/tree/main/newsfragments).
   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] ephraimbuddy commented on a diff in pull request #28354: Allow Users to disable SwaggerUI via configuration

Posted by GitBox <gi...@apache.org>.
ephraimbuddy commented on code in PR #28354:
URL: https://github.com/apache/airflow/pull/28354#discussion_r1051006086


##########
airflow/config_templates/config.yml:
##########
@@ -1502,6 +1502,13 @@
       type: string
       example: "dagrun_cleared,failed"
       default: ~
+    - name: enable_swagger_ui
+      description: |
+        Boolean for running SwaggerUI in the webserver.
+      version_added: 2.5.1

Review Comment:
   ```suggestion
         version_added: 2.6.0
   ```
   ~Should this be in config 'api' section, since swagger is about REST API?~ 



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] msumit commented on a diff in pull request #28354: Allow Users to disable SwaggerUI via configuration

Posted by GitBox <gi...@apache.org>.
msumit commented on code in PR #28354:
URL: https://github.com/apache/airflow/pull/28354#discussion_r1048239980


##########
airflow/www/extensions/init_views.py:
##########
@@ -208,7 +208,11 @@ def _handle_method_not_allowed(ex):
             return views.method_not_allowed(ex)
 
     spec_dir = path.join(ROOT_APP_DIR, "api_connexion", "openapi")
-    connexion_app = App(__name__, specification_dir=spec_dir, skip_error_handlers=True)
+    if not conf.getboolean("webserver", "enable_swagger_ui"):

Review Comment:
   If someone updates the code but doesn't update the conf file, this line will raise an error.



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] msumit merged pull request #28354: Allow Users to disable SwaggerUI via configuration

Posted by GitBox <gi...@apache.org>.
msumit merged PR #28354:
URL: https://github.com/apache/airflow/pull/28354


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] gschuurman commented on a diff in pull request #28354: Allow Users to disable SwaggerUI via configuration

Posted by GitBox <gi...@apache.org>.
gschuurman commented on code in PR #28354:
URL: https://github.com/apache/airflow/pull/28354#discussion_r1049396994


##########
airflow/www/extensions/init_views.py:
##########
@@ -208,7 +208,11 @@ def _handle_method_not_allowed(ex):
             return views.method_not_allowed(ex)
 
     spec_dir = path.join(ROOT_APP_DIR, "api_connexion", "openapi")
-    connexion_app = App(__name__, specification_dir=spec_dir, skip_error_handlers=True)
+    if not conf.getboolean("webserver", "enable_swagger_ui", fallback=True):
+        options = {"swagger_ui": False}
+    else:
+        options = {"swagger_ui": True}

Review Comment:
   That's a good suggestion



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] msumit commented on pull request #28354: Allow Users to disable SwaggerUI via configuration

Posted by GitBox <gi...@apache.org>.
msumit commented on PR #28354:
URL: https://github.com/apache/airflow/pull/28354#issuecomment-1357429289

   @gschuurman plz fix the braking static check and I think it'll be ok to merge. 


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] gschuurman commented on a diff in pull request #28354: Allow Users to disable SwaggerUI via configuration

Posted by GitBox <gi...@apache.org>.
gschuurman commented on code in PR #28354:
URL: https://github.com/apache/airflow/pull/28354#discussion_r1048279809


##########
airflow/www/extensions/init_views.py:
##########
@@ -208,7 +208,11 @@ def _handle_method_not_allowed(ex):
             return views.method_not_allowed(ex)
 
     spec_dir = path.join(ROOT_APP_DIR, "api_connexion", "openapi")
-    connexion_app = App(__name__, specification_dir=spec_dir, skip_error_handlers=True)
+    if not conf.getboolean("webserver", "enable_swagger_ui"):

Review Comment:
   This should be fixed in the latest commit. Thanks for noticing



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] msumit commented on a diff in pull request #28354: Allow Users to disable SwaggerUI via configuration

Posted by GitBox <gi...@apache.org>.
msumit commented on code in PR #28354:
URL: https://github.com/apache/airflow/pull/28354#discussion_r1048317756


##########
airflow/www/extensions/init_views.py:
##########
@@ -208,7 +208,11 @@ def _handle_method_not_allowed(ex):
             return views.method_not_allowed(ex)
 
     spec_dir = path.join(ROOT_APP_DIR, "api_connexion", "openapi")
-    connexion_app = App(__name__, specification_dir=spec_dir, skip_error_handlers=True)
+    if not conf.getboolean("webserver", "enable_swagger_ui", fallback=True):
+        options = {"swagger_ui": False}
+    else:
+        options = {"swagger_ui": True}

Review Comment:
   nit: simplify the code 
   `options = {"swagger_ui": conf.getboolean("webserver", "enable_swagger_ui", fallback=True)}`



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] ephraimbuddy commented on a diff in pull request #28354: Allow Users to disable SwaggerUI via configuration

Posted by GitBox <gi...@apache.org>.
ephraimbuddy commented on code in PR #28354:
URL: https://github.com/apache/airflow/pull/28354#discussion_r1051006086


##########
airflow/config_templates/config.yml:
##########
@@ -1502,6 +1502,13 @@
       type: string
       example: "dagrun_cleared,failed"
       default: ~
+    - name: enable_swagger_ui
+      description: |
+        Boolean for running SwaggerUI in the webserver.
+      version_added: 2.5.1

Review Comment:
   ```suggestion
         version_added: 2.6.0
   ```
   Should this be in config 'api' section, since swagger is about REST API? 



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] boring-cyborg[bot] commented on pull request #28354: Allow Users to disable SwaggerUI via configuration

Posted by GitBox <gi...@apache.org>.
boring-cyborg[bot] commented on PR #28354:
URL: https://github.com/apache/airflow/pull/28354#issuecomment-1358846858

   Awesome work, congrats on your first merged pull request!
   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org