Automate stable REST API permission reference doc generation#67606
Automate stable REST API permission reference doc generation#67606durgaprasadml wants to merge 6 commits into
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
|
jscheffl
left a comment
There was a problem hiding this comment.
It is missing to add it to .pre-commit-config.yaml
|
Implemented the requested changes:
This ensures the generated permission reference stays automatically synchronized with route changes and prevents stale generated docs from passing CI. |
There was a problem hiding this comment.
Pull request overview
This PR automates generation of stable REST API permission reference documentation by statically extracting requires_access_* dependencies from /api/v2 route definitions and rendering a committed RST reference.
Changes:
- Adds a stdlib-only AST extractor and CLI for generating/checking API permission docs.
- Adds regression/invariant tests for route parsing, resource mapping, rendering, and check mode.
- Registers a prek hook and commits the generated
api_permissions_ref.rstartifact.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
scripts/ci/prek/extract_permissions.py |
New extractor and RST generator for stable REST API permissions. |
scripts/tests/ci/prek/test_extract_permissions.py |
Tests for extractor helpers, real route integration, rendering, and check mode. |
airflow-core/docs/security/api_permissions_ref.rst |
Generated permission reference documentation. |
.pre-commit-config.yaml |
Adds prek hook to regenerate the permission reference. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
Thanks for the review and the detailed feedback. Addressed the positional access_entity case for requires_access_dag by extending the AST extraction logic to support both:
Also added a regression test covering the positional form (DagAccessEntity.TASK_LOGS) and regenerated the permission reference docs. Additionally, the generator hook is now registered in .pre-commit-config.yaml to ensure generated docs remain synchronized with route/security changes during CI and local prek runs. |
Automate stable REST API permission reference doc generation.
This PR introduces an automated extractor for stable REST API permissions and generates a reference RST document directly from the source routes and permission declarations.
Current implementation:
This PR is intentionally opened as a draft to gather maintainer feedback on:
Closes: #10937