Commit 5c3fbec
feat: configure drf-spectacular on LMS for enrollment API schema gene… (#38849)
* feat: add drf-spectacular on LMS for enrollment API schema generation
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>
* chore: move settings to common.py
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 794c440 commit 5c3fbec
7 files changed
Lines changed: 53 additions & 3 deletions
File tree
- cms/lib
- lms
- envs
- lib
- openedx/envs
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
17 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
18 | 21 | | |
19 | 22 | | |
20 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2040 | 2040 | | |
2041 | 2041 | | |
2042 | 2042 | | |
| 2043 | + | |
2043 | 2044 | | |
2044 | 2045 | | |
2045 | 2046 | | |
| |||
2125 | 2126 | | |
2126 | 2127 | | |
2127 | 2128 | | |
| 2129 | + | |
| 2130 | + | |
| 2131 | + | |
| 2132 | + | |
| 2133 | + | |
| 2134 | + | |
| 2135 | + | |
| 2136 | + | |
| 2137 | + | |
| 2138 | + | |
| 2139 | + | |
| 2140 | + | |
2128 | 2141 | | |
2129 | 2142 | | |
2130 | 2143 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
582 | 582 | | |
583 | 583 | | |
584 | 584 | | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
585 | 590 | | |
586 | 591 | | |
587 | 592 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
397 | 397 | | |
398 | 398 | | |
399 | 399 | | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
400 | 405 | | |
401 | 406 | | |
402 | 407 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
1068 | 1069 | | |
1069 | 1070 | | |
1070 | 1071 | | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
836 | 836 | | |
837 | 837 | | |
838 | 838 | | |
| 839 | + | |
839 | 840 | | |
840 | 841 | | |
841 | 842 | | |
| |||
0 commit comments