Uh oh!
There was an error while loading. Please reload this page.
Migrate FAB POST /roles to FastAPI - #57199
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)
|
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
chiuinggum
commented
Oct 24, 2025
@vincbeck, thanks for the review! Will work on this tmr |
8f6e2e1 to
5fcfe46Compare
jason810496
left a comment
There was a problem hiding this comment.
Thanks for the PR! LGTM overall.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
498c519 to
7e8877eComparefa0c6c1 to
e31f432Comparepotiuk
commented
Oct 25, 2025
Love it :) |
3be15ad to
9b32f50Compare9b32f50 to
5b3bde0Comparechiuinggum
commented
Oct 27, 2025
Hi @jason810496 / @vincbeck / @potiuk, could you please take a look at this PR when you have a moment, thanks in advance! |
Uh oh!
There was an error while loading. Please reload this page.
Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions. |
potiuk
commented
Oct 27, 2025
Fantastic :) |
* 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
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.