-
Notifications
You must be signed in to change notification settings - Fork 16.3k
Fixing Errors (Update Connexion Library to version 3) #37555
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
Closed
Satoshi-Sh
wants to merge
28
commits into
apache:main
from
Satoshi-Sh:fix/api-endpoints-registration
Closed
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
554fe7b
Update methods to use Connexion v3, Ginucorn command and encoding
9a6b00a
Fix static checks
cfee0cf
Update setup.cfg and encoding
MaksYermak fd00ba9
Update migrations files for
MaksYermak f48673d
Update configuration for tests
MaksYermak 1be1a27
Fix problem with static checks
MaksYermak 912e026
Followed vincbeck instruction on the issue #36052
Satoshi-Sh 13bc94a
Refactor dataset class inheritance (#37590)
sunank200 a0aa56c
Check if Python 3.12 is used for release management commands as well …
potiuk 50edc4e
Enhancing breeze commands with PACKAGE_LIST env variable (#37502)
amoghrajesh 5e7bf22
Introduce new config variable to control whether DAG processor output…
Owen-CH-Leung de059c5
Clarify skip-message for test requiring database. (#37612)
hterik 585111b
Use new exception type inheriting BaseException for SIGTERMs (#37613)
hterik 803e3e1
Implement `batch_is_authorized_*` APIs in AWS auth manager (#37430)
vincbeck ec7bccc
chore: Update comments and logging in OpenLineage ExtractorManager (#…
kacpermuda c8b3118
Merge branch 'main' into fix/api-endpoints-registration
sudiptob2 8a3a013
fix: add connexion v3 and missing dependencies in pyproject.toml.
sudiptob2 8fbded2
fix: use appbuilder.app instead of FlaskApp
sudiptob2 a5dfee7
feat: return connexion.app to keep the return type as FlaskApp
sudiptob2 46274e4
Show dataset events above task/run details in grid view (#37603)
bbovenzi 4a674b6
Update min kubernetes version in docs and update release instructions…
potiuk a236484
Prepare docs ad hoc Teradata provider RC2 February 2024 (#37624)
eladkal e11579e
Add datasets to dag graph (#37604)
bbovenzi 58976f8
Filter datasets graph by dag_id (#37464)
bbovenzi c3ca633
Fix task duration selection (#37630)
bbovenzi 6c01338
Fix Async GCSObjectsWithPrefixExistenceSensor xcom push (#37634)
pankajastro 194f3c7
Fix few small release issues found during 2.8.2 preparation (#37633)
potiuk affb3d8
Merge branch 'main' into fix/api-endpoints-registration
sudiptob2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,8 +22,8 @@ | |
| from pathlib import Path | ||
| from typing import TYPE_CHECKING, Container | ||
|
|
||
| from connexion import FlaskApi | ||
| from flask import Blueprint, url_for | ||
| from connexion.options import SwaggerUIOptions | ||
| from flask import url_for | ||
| from sqlalchemy import select | ||
| from sqlalchemy.orm import Session, joinedload | ||
|
|
||
|
|
@@ -84,10 +84,11 @@ | |
| ) | ||
| from airflow.utils.session import NEW_SESSION, provide_session | ||
| from airflow.utils.yaml import safe_load | ||
| from airflow.www.constants import SWAGGER_BUNDLE, SWAGGER_ENABLED | ||
| from airflow.www.extensions.init_views import _CustomErrorRequestBodyValidator, _LazyResolver | ||
| from airflow.www.extensions.init_views import _LazyResolver | ||
|
|
||
| if TYPE_CHECKING: | ||
| import connexion | ||
|
|
||
| from airflow.auth.managers.models.base_user import BaseUser | ||
| from airflow.cli.cli_config import ( | ||
| CLICommand, | ||
|
|
@@ -149,19 +150,30 @@ def get_cli_commands() -> list[CLICommand]: | |
| SYNC_PERM_COMMAND, # not in a command group | ||
| ] | ||
|
|
||
| def get_api_endpoints(self) -> None | Blueprint: | ||
| def set_api_endpoints(self, connexion_app: connexion.FlaskApp) -> None: | ||
| folder = Path(__file__).parents[0].resolve() # this is airflow/auth/managers/fab/ | ||
| with folder.joinpath("openapi", "v1.yaml").open() as f: | ||
| specification = safe_load(f) | ||
| return FlaskApi( | ||
|
|
||
| swagger_ui_options = SwaggerUIOptions( | ||
| swagger_ui=conf.getboolean("webserver", "enable_swagger_ui", fallback=True), | ||
| ) | ||
|
||
|
|
||
| api = connexion_app.add_api( | ||
| specification=specification, | ||
| resolver=_LazyResolver(), | ||
| base_path="/auth/fab/v1", | ||
| options={"swagger_ui": SWAGGER_ENABLED, "swagger_path": SWAGGER_BUNDLE.__fspath__()}, | ||
| swagger_ui_options=swagger_ui_options, | ||
| strict_validation=True, | ||
| validate_responses=True, | ||
| validator_map={"body": _CustomErrorRequestBodyValidator}, | ||
| ).blueprint | ||
| ) | ||
|
|
||
| # Exempt the API blueprint from CSRF protection | ||
| # Ref: https://github.com/apache/airflow/pull/36052#issuecomment-1898786641 | ||
| if api: | ||
| self.appbuilder.app.extensions["csrf"].exempt(api.blueprint) | ||
|
|
||
| return api.blueprint if api else None | ||
|
||
|
|
||
| def get_user_display_name(self) -> str: | ||
| """Return the user's display name associated to the user in session.""" | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the change here?