Skip to content

feat: fix OpenAPI schemas for SDK compatibility#38845

Merged
Faraz32123 merged 3 commits into
feat/axim-api_improvementsfrom
add_changes_wrt_sdk
Jul 3, 2026
Merged

feat: fix OpenAPI schemas for SDK compatibility#38845
Faraz32123 merged 3 commits into
feat/axim-api_improvementsfrom
add_changes_wrt_sdk

Conversation

@Faraz32123

Copy link
Copy Markdown
Contributor

Three changes driven by integration testing with openedx-platform-sdk(PR):

  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).

Faraz32123 and others added 3 commits July 3, 2026 16:04
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>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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>
@Faraz32123 Faraz32123 merged commit 794c440 into feat/axim-api_improvements Jul 3, 2026
42 checks passed
@Faraz32123 Faraz32123 deleted the add_changes_wrt_sdk branch July 3, 2026 12:13
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