Migrate FAB POST /roles to FastAPI#57199
Merged
vincbeck merged 5 commits intoapache:mainfrom Oct 27, 2025
Merged
Conversation
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
|
vincbeck
reviewed
Oct 24, 2025
providers/fab/src/airflow/providers/fab/auth_manager/api_fastapi/datamodels/roles.py
Outdated
Show resolved
Hide resolved
providers/fab/src/airflow/providers/fab/auth_manager/api_fastapi/datamodels/roles.py
Outdated
Show resolved
Hide resolved
providers/fab/src/airflow/providers/fab/auth_manager/api_fastapi/services/roles.py
Outdated
Show resolved
Hide resolved
providers/fab/src/airflow/providers/fab/auth_manager/api_fastapi/services/roles.py
Outdated
Show resolved
Hide resolved
providers/fab/src/airflow/providers/fab/auth_manager/api_fastapi/services/roles.py
Outdated
Show resolved
Hide resolved
Contributor
Author
|
@vincbeck, thanks for the review! Will work on this tmr |
8f6e2e1 to
5fcfe46
Compare
jason810496
reviewed
Oct 25, 2025
Member
jason810496
left a comment
There was a problem hiding this comment.
Thanks for the PR! LGTM overall.
providers/fab/src/airflow/providers/fab/auth_manager/api_fastapi/routes/roles.py
Outdated
Show resolved
Hide resolved
providers/fab/src/airflow/providers/fab/auth_manager/api_fastapi/routes/roles.py
Show resolved
Hide resolved
providers/fab/src/airflow/providers/fab/auth_manager/api_fastapi/routes/roles.py
Outdated
Show resolved
Hide resolved
providers/fab/src/airflow/providers/fab/auth_manager/api_fastapi/routes/roles.py
Outdated
Show resolved
Hide resolved
providers/fab/tests/unit/fab/auth_manager/api_fastapi/routes/test_roles.py
Outdated
Show resolved
Hide resolved
498c519 to
7e8877e
Compare
fa0c6c1 to
e31f432
Compare
Member
|
Love it :) |
3be15ad to
9b32f50
Compare
9b32f50 to
5b3bde0
Compare
Contributor
Author
|
Hi @jason810496 / @vincbeck / @potiuk, could you please take a look at this PR when you have a moment, thanks in advance! |
|
Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions. |
Member
|
Fantastic :) |
1 task
odaneau-astro
pushed a commit
to odaneau-astro/airflow
that referenced
this pull request
Mar 18, 2026
* Migrate FAB POST /roles to FastAPI * Remove unnecessary casting and model * Validate non-empty role name via Pydantic * Move auth dep to provider security and fixtureize dependency_overrides * Add test for roles data model and security provider
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why
How
New FastAPI endpoint: implements
POST /auth/fab/v1/rolesusing a router registered byFabAuthManager.get_fastapi_app(). Path and success status remain compatible (200 OK). The login FastAPI module serves as structural precedent.Data models: added Pydantic models in
api_fastapi/datamodels/roles.py(RoleBody,RoleResponse, etc.). The JSON fieldactionsis preserved via aliases while internal naming uses “permissions,” mirroring the Connexion schema.Service layer:
api_fastapi/services/roles.py#create_rolereproduces the legacy flow:bulk_sync_rolesAuthorization parity: introduced a FastAPI dependency that mirrors
requires_access_custom_view("POST", RESOURCE_ROLE); unauthorized → 401, forbidden → 403 (same semantics as FAB’s Connexion layer)OpenAPI docs: response map includes 400/401/403/409 and now 500 for the rare “created-but-not-found” case, consistent with the new service behavior. (FastAPI auto-generates the schema from code.)
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rstor{issue_number}.significant.rst, in airflow-core/newsfragments.