Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor redundant doc url logic to use utility #14080

Merged
merged 1 commit into from
Feb 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions airflow/api_connexion/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,9 @@
import werkzeug
from connexion import FlaskApi, ProblemException, problem

from airflow import version

if any(suffix in version.version for suffix in ['dev', 'a', 'b']):
doc_link = (
"http://apache-airflow-docs.s3-website.eu-central-1.amazonaws.com/docs/apache-airflow/latest"
"/stable-rest-api-ref.html"
)
else:
doc_link = f'https://airflow.apache.org/docs/{version.version}/stable-rest-api-ref.html'
from airflow.utils.docs import get_docs_url

doc_link = get_docs_url("stable-rest-api-ref.html")

EXCEPTIONS_LINK_MAP = {
400: f"{doc_link}#section/Errors/BadRequest",
Expand Down
2 changes: 1 addition & 1 deletion airflow/utils/docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

def get_docs_url(page: Optional[str] = None) -> str:
"""Prepare link to Airflow documentation."""
if "dev" in version.version:
if any(suffix in version.version for suffix in ['dev', 'a', 'b']):
result = (
"http://apache-airflow-docs.s3-website.eu-central-1.amazonaws.com/docs/apache-airflow/latest/"
)
Expand Down