Skip to content

feat: adopt edx-drf-extensions 10.8.0 building blocks across 6 standardized APIs - #39081

Open
Abdul-Muqadim-Arbisoft wants to merge 6 commits into
openedx:masterfrom
edly-io:feat/adopt-edx-drf-extensions-building-blocks
Open

feat: adopt edx-drf-extensions 10.8.0 building blocks across 6 standardized APIs#39081
Abdul-Muqadim-Arbisoft wants to merge 6 commits into
openedx:masterfrom
edly-io:feat/adopt-edx-drf-extensions-building-blocks

Conversation

@Abdul-Muqadim-Arbisoft

Copy link
Copy Markdown
Contributor

Follow-up to the FC-0118 API standardization work merged in #38755. The reusable pieces of that implementation (standardized error envelope, response shaping, manual pagination, opaque-key lookup regexes) were extracted into edx-drf-extensions in openedx/edx-drf-extensions#573 (released as 10.8.0), as agreed with @bradenmacdonald and @feanil in the OEP-69 review (openedx/openedx-proposals#805discussion thread). This PR completes the loop on the platform side: bump the pin and make the 6 standardized APIs use the library instead of the platform-local copies.

Related: FC-0118 umbrella issue #38137.

Commit breakdown

Commit Area Change
feat: adopt the edx-drf-extensions 10.8.0 REST API building blocks deps + core Bump edx-drf-extensions 10.7.0 → 10.8.0 (uv.lock via uv lock --upgrade-package, compat exports regenerated via uv export); openedx/core/lib/api/exceptions.py and StandardizedErrorMixin in mixins.py become re-exports of the library implementation, so existing openedx.core.lib.api import paths keep working; new EDX_DRF_EXTENSIONS['STANDARDIZED_ERROR_BASE_HANDLER'] setting points the library's error handler at ignored_error_exception_handler, preserving the platform's ignored-error logging/monitoring
feat: use edx-drf-extensions building blocks in Enrollments v2 API LMS Library imports; ?view=minimal via MinimalViewMixin (custom representation hook — the enrollment preset collapses course_details to a course_id string); list pagination via IterablePaginationMixin.paginate_iterable
feat: use edx-drf-extensions building blocks in Xblock v1 API CMS Library imports; lookup_value_regex from shared USAGE_KEY_LOOKUP_REGEX (identical pattern); minimal-view filtering via shared project()
feat: use edx-drf-extensions building blocks in Course Details v3 API CMS Library imports; lookup_value_regex from shared COURSE_KEY_LOOKUP_REGEX; ?view=minimal via MinimalViewMixin + minimal_fields (local _apply_view_preset removed); ?fields= via project()
feat: use edx-drf-extensions building blocks in Grading v3 API CMS Library imports; lookup_value_regex from shared COURSE_KEY_LOOKUP_REGEX
feat: use edx-drf-extensions building blocks in Home v3 and v4 APIs CMS Library imports; ?fields= via project(); local apply_field_selection removed from v3 utils with its last caller migrated

Backward compatibility

No behavior change — this is a like-for-like substitution:

  • All existing openedx.core.lib.api.exceptions / .mixins import paths keep working via re-exports.
  • The error handler still delegates to ignored_error_exception_handler (now via the STANDARDIZED_ERROR_BASE_HANDLER setting), so error monitoring is unchanged.
  • Response shapes verified byte-identical before/after the migration by capturing live responses (401/403/400 error envelopes, the 7-field pagination envelope, ?view=minimal, and the default full shape) and diffing the JSON.
  • The shared lookup regexes are character-identical to the strings they replace.

Bump edx-drf-extensions to 10.8.0, which now ships the reusable core of
the FC-0118 REST API conventions (standardized error envelope, response
shaping, manual pagination, opaque-key lookup regexes, envelope test
helper).

openedx/core/lib/api/exceptions.py and the StandardizedErrorMixin in
mixins.py become re-exports of the library implementation, keeping the
182 existing openedx.core.lib.api import paths working. The library
handler delegates to a configurable base handler, so
EDX_DRF_EXTENSIONS['STANDARDIZED_ERROR_BASE_HANDLER'] is pointed at
ignored_error_exception_handler to preserve the platform's ignored-error
logging and monitoring unchanged.
Import StandardizedErrorMixin and Conflict from the library, apply the
ADR 0036 ?view=minimal preset through MinimalViewMixin (the enrollment
preset overrides to_minimal_representation, since collapsing the embedded
course_details sub-object to a course_id string is not a plain field
projection), and paginate the list action through
IterablePaginationMixin.paginate_iterable instead of the hand-written
paginate/serialize/respond sequence. Response shapes are unchanged.
Import StandardizedErrorMixin from the library, take the router
lookup_value_regex from the shared USAGE_KEY_LOOKUP_REGEX constant
(identical pattern), and filter the ?view=minimal payload with the shared
project() helper. Response shapes are unchanged.
Import StandardizedErrorMixin from the library, take the router
lookup_value_regex from the shared COURSE_KEY_LOOKUP_REGEX constant,
serve the ADR 0036 ?view=minimal preset through MinimalViewMixin with
minimal_fields (replacing the local _apply_view_preset helper), and apply
?fields= selection with the shared project() helper. Response shapes are
unchanged.
Import StandardizedErrorMixin from the library and take the router
lookup_value_regex from the shared COURSE_KEY_LOOKUP_REGEX constant.
Response shapes are unchanged.
Import StandardizedErrorMixin from the library and apply ?fields=
selection with the shared project() helper. With its last caller
migrated, the local apply_field_selection helper is removed from the v3
utils module. Response shapes are unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant