Skip to content

feat: configure drf-spectacular on LMS for enrollment API schema gene…#38849

Merged
Faraz32123 merged 2 commits into
feat/axim-api_improvementsfrom
feat/add_drf_spectacular_support_in_LMS_for_enrollment_api
Jul 6, 2026
Merged

feat: configure drf-spectacular on LMS for enrollment API schema gene…#38849
Faraz32123 merged 2 commits into
feat/axim-api_improvementsfrom
feat/add_drf_spectacular_support_in_LMS_for_enrollment_api

Conversation

@Faraz32123

@Faraz32123 Faraz32123 commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Adds drf-spectacular support to LMS so the openedx-platform-sdk can generate enrollment v2 API bindings from a proper LMS schema rather than mounting enrollment URLs in CMS as a workaround.

Changes:

  • openedx/envs/common.py: add DEFAULT_SCHEMA_CLASS to REST_FRAMEWORK so drf-spectacular's AutoSchema is used across all LMS environments
  • lms/envs/common.py: add drf_spectacular to INSTALLED_APPS
  • lms/lib/spectacular.py: preprocessing hook that filters to enrollment v2 endpoints only (/api/enrollment/v\d+/)
  • lms/envs/devstack.py, lms/envs/production.py: SPECTACULAR_SETTINGS with path prefix trim and enrollment-only title
  • lms/urls.py: expose schema at /lms-api/schema/ via SpectacularAPIView
  • cms/lib/spectacular.py: revert enrollment URL workaround (no longer needed)

related SDK PR: edly-io/openedx-platform-sdk#1

Adds drf-spectacular support to LMS so the openedx-platform-sdk can
generate enrollment v2 API bindings from a proper LMS schema rather than
mounting enrollment URLs in CMS as a workaround.

Changes:
- openedx/envs/common.py: add DEFAULT_SCHEMA_CLASS to REST_FRAMEWORK so
  drf-spectacular's AutoSchema is used across all LMS environments
- lms/envs/common.py: add drf_spectacular to INSTALLED_APPS
- lms/lib/spectacular.py: preprocessing hook that filters to enrollment
  v2 endpoints only (/api/enrollment/v\d+/)
- lms/envs/devstack.py, lms/envs/production.py: SPECTACULAR_SETTINGS with
  path prefix trim and enrollment-only title
- lms/urls.py: expose schema at /lms-api/schema/ via SpectacularAPIView
- cms/lib/spectacular.py: revert enrollment URL workaround (no longer needed)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Faraz32123 Faraz32123 force-pushed the feat/add_drf_spectacular_support_in_LMS_for_enrollment_api branch from 9a58b59 to e950bb8 Compare July 6, 2026 07:55
Comment thread lms/envs/production.py
MIDDLEWARE.extend(_YAML_TOKENS.get('EXTRA_MIDDLEWARE_CLASSES', [])) # noqa: F405


###################### drf-spectacular (LMS enrollment schema) ######################

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we add this in common and duplicate in both devstack and production?

@Faraz32123 Faraz32123 merged commit 5c3fbec into feat/axim-api_improvements Jul 6, 2026
42 checks passed
@Faraz32123 Faraz32123 deleted the feat/add_drf_spectacular_support_in_LMS_for_enrollment_api branch July 6, 2026 10:44
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.

2 participants