refactor: split REST API views by domain ownership - #453
mariajgrimaldi wants to merge 2 commits into
Conversation
|
Thanks for the pull request, @mariajgrimaldi! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
c923f1f to
993665b
Compare
Moves the five Admin-Console-shaped endpoints (AdminConsoleOrgsAPIView, ScopesAPIView, TeamMembersAPIView, TeamMemberAssignmentsAPIView, AssignmentsAPIView) into a new admin_console/ subpackage, and WaffleFlagStatesAPIView into a new course_authoring/ subpackage, per the ownership and layout rules being recorded in ADR 0016 and ADR 0017. PermissionValidationMeView, RoleUserAPIView, RoleListView, and UserValidationAPIView remain in views.py as generic Authorization endpoints, with no reference to any specific consumer's packaging; that reasoning lives in admin_console/course_authoring's own docstrings and in ADR 0017. No URLs change; tests move alongside their views. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
pylint 4.0.4/astroid 4.0.4 no longer needs the too-many-positional-arguments suppression on these test/model signatures, flagging the old comments as useless-suppression. Also trims trailing blank lines flagged by trailing-newlines, fixes a line-too-long, and drops an unused import in the new admin_console test module. openedx_authz/rest_api/v1/filters.py was left behind, byte-identical and unreferenced, after admin_console/filters.py replaced it in the package layout split (ADR 0017).
993665b to
e2475f2
Compare
BryanttV
left a comment
There was a problem hiding this comment.
The refactor looks good! I just have a few comments:
There are some serializers exclusive to admin_console. Could we move them to the corresponding module?
There was a problem hiding this comment.
Just a thought: what if we separate the url lists by domain? For example:
authz_urlpatterns = [...]
admin_console_urlpatterns = [...]
course_authoring_urlpatterns = [...]
urlpatterns = authz_urlpatterns + admin_console_urlpatterns + course_authoring_urlpatternsI think it makes them easier to differentiate. What do you think?
| from openedx_authz.constants import permissions, roles | ||
| from openedx_authz.models.scopes import get_content_library_model, get_course_overview_model | ||
| from openedx_authz.rest_api.v1.admin_console.views import ScopesAPIView | ||
| from openedx_authz.tests.rest_api.test_views import ViewTestMixin |
There was a problem hiding this comment.
Could we move the ViewTestMixin class to its own mixins.py module? That way, we wouldn't have to import from test_views, but from mixins instead.
Description
This PR splits the REST API views and tests by domain ownership, following the boundary recorded in ADR 0016. It changes the package layout without changing the API URLs or endpoint behavior.
The Admin Console endpoints now live under
openedx_authz.rest_api.v1.admin_console:AdminConsoleOrgsAPIViewScopesAPIViewTeamMembersAPIViewTeamMemberAssignmentsAPIViewAssignmentsAPIViewTheir filters and tests move with them.
WaffleFlagStatesAPIViewand its tests move underopenedx_authz.rest_api.v1.course_authoring. The shared authorization endpoints, including permission validation and role operations, remain inv1/views.py.This package boundary lets domain-specific behavior stay with the domain that owns it. The course-authoring filter implementation is kept out of this PR and remains in the next layer, #361.
Stack dependency
This PR is stacked on #390, which documents the ownership boundary and cross-domain filter decision. Review and merge #390 first.
Testing
This is a package-layout refactor. The endpoint URLs and behavior remain unchanged, so no separate manual test is needed.
Merge checklist: