Skip to content

Conversation

@chiuinggum
Copy link
Contributor

@chiuinggum chiuinggum commented Oct 24, 2025

Why

How

  • New FastAPI endpoint: implements POST /auth/fab/v1/roles using a router registered by FabAuthManager.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 field actions is preserved via aliases while internal naming uses “permissions,” mirroring the Connexion schema.

  • Service layer: api_fastapi/services/roles.py#create_role reproduces the legacy flow:

    1. validate role name
    2. conflict if role exists (409)
    3. validate action/resource pairs (422 on missing from Pydantic)
    4. bulk_sync_roles
    5. re-fetch or 500 on unexpected failure
  • Authorization 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.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

@boring-cyborg
Copy link

boring-cyborg bot commented Oct 24, 2025

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)
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our prek-hooks will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

@chiuinggum chiuinggum marked this pull request as ready for review October 24, 2025 13:48
@chiuinggum chiuinggum requested a review from vincbeck as a code owner October 24, 2025 13:48
Copy link
Contributor

@vincbeck vincbeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the direction!

@chiuinggum
Copy link
Contributor Author

@vincbeck, thanks for the review! Will work on this tmr

@chiuinggum chiuinggum force-pushed the feat/fab-fastapi-roles-post branch from 8f6e2e1 to 5fcfe46 Compare October 25, 2025 02:37
@jason810496 jason810496 self-requested a review October 25, 2025 11:48
Copy link
Member

@jason810496 jason810496 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! LGTM overall.

@chiuinggum chiuinggum force-pushed the feat/fab-fastapi-roles-post branch from 498c519 to 7e8877e Compare October 25, 2025 14:43
@chiuinggum chiuinggum force-pushed the feat/fab-fastapi-roles-post branch from fa0c6c1 to e31f432 Compare October 25, 2025 15:14
@potiuk
Copy link
Member

potiuk commented Oct 25, 2025

Love it :)

@chiuinggum chiuinggum force-pushed the feat/fab-fastapi-roles-post branch 2 times, most recently from 3be15ad to 9b32f50 Compare October 26, 2025 03:30
@chiuinggum chiuinggum force-pushed the feat/fab-fastapi-roles-post branch from 9b32f50 to 5b3bde0 Compare October 27, 2025 02:04
@chiuinggum
Copy link
Contributor Author

Hi @jason810496 / @vincbeck / @potiuk, could you please take a look at this PR when you have a moment, thanks in advance!

Copy link
Member

@jason810496 jason810496 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Copy link
Contributor

@vincbeck vincbeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good job!

@vincbeck vincbeck merged commit d9035cf into apache:main Oct 27, 2025
77 checks passed
@boring-cyborg
Copy link

boring-cyborg bot commented Oct 27, 2025

Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions.

@potiuk
Copy link
Member

potiuk commented Oct 27, 2025

Fantastic :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants