Commit 794c440
feat: fix OpenAPI schemas for SDK compatibility (#38845)
* feat: fix OpenAPI schemas for SDK compatibility
Three changes driven by integration testing with openedx-platform-sdk:
1. authoring_grading serializer — expose grade_cutoffs, grace_period,
and minimum_grade_credit as proper typed schema fields.
CourseGradingModel.update_from_json requires all three, but they were
absent from the serializer so the generated SDK had no typed fields for
them, forcing callers to smuggle values in via additional_properties.
Adds GracePeriodSerializer (hours / minutes / seconds) and documents
that grade_cutoffs and grace_period must be present in every PATCH.
2. course_details serializer — mark certificate_available_date as
allow_null=True. The field is legitimately null for many courses, but
the missing flag caused the SDK client to crash with
fromisoformat(None) when deserialising the response.
3. v4 HomeCoursesViewSet — add _HomeCoursesAutoSchema (same pattern as
the existing v3 _HomeAutoSchema). The viewset builds its paginator
manually inside list() rather than via pagination_class, so
drf-spectacular's _is_list_view() returns True and generates an array
schema. Overriding _is_list_view() for the list action and using an
inline_serializer makes the schema reflect the actual paginated object
shape (count, num_pages, current_page, start, next, previous,
results).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix: sort imports in v4 home view to satisfy ruff I001
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix: wrap long lines in v4 home view inline_serializer fields
Fixes pylint C0301 (line-too-long) — lines 175 and 177 exceeded the
120-character limit.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 8ec46fe commit 794c440
3 files changed
Lines changed: 60 additions & 3 deletions
File tree
- cms/djangoapps/contentstore/rest_api
- v0/serializers
- v1/serializers
- v4/views
Lines changed: 28 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
21 | 31 | | |
22 | 32 | | |
23 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
24 | 52 | | |
25 | 53 | | |
26 | 54 | | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| |||
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
21 | 32 | | |
22 | 33 | | |
23 | 34 | | |
| |||
136 | 147 | | |
137 | 148 | | |
138 | 149 | | |
| 150 | + | |
139 | 151 | | |
140 | 152 | | |
141 | 153 | | |
| |||
154 | 166 | | |
155 | 167 | | |
156 | 168 | | |
157 | | - | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
158 | 187 | | |
159 | 188 | | |
160 | 189 | | |
| |||
0 commit comments