Repository navigation
fix: give CourseEnrollmentsApiListSerializer its own schema ref_name - #39192
Merged
Merged
Conversation
CourseEnrollmentsApiListSerializer's Meta subclasses its parent's, so it inherited ref_name = "CourseEnrollment". Both serializers were published under one schema component, and in the full /api-docs schema the subset serializer won: the enrollment create and retrieve endpoints were documented with course_id instead of course_details, and clients generated from the schema were typed accordingly.
Faraz32123
requested review from
Abdul-Muqadim-Arbisoft,
feanil and
taimoor-ahmed-1
October 6, 2026 13:07
taimoor-ahmed-1
approved these changes
Oct 7, 2026
3 tasks
feanil
approved these changes
Oct 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes wrong API documentation for the enrollment create/retrieve endpoints. The API itself already works correctly; only the OpenAPI schema (and clients generated from it) change.
CourseEnrollmentsApiListSerializerdeclaresclass Meta(CourseEnrollmentSerializer.Meta), so it inherits the parent'sref_name = "CourseEnrollment". Both serializers were published under one OpenAPI component.In the full
/api-docsschema, whichdocs/lms-openapi.yamlis generated from since #39108, the cut-down serializer won that collision. As a result:POST /api/enrollment/v2/enrollment/andGET /api/enrollment/v2/enrollment/{course_id}(and{username},{course_id}) were documented as returningcourse_idinstead ofcourse_details.This gives the subclass its own
ref_name,CourseEnrollmentsApiList. That is the component name it was published under before the collision surfaced.No runtime behaviour changes:
ref_nameis read only by schema generation.Testing
generate_openapi_schemas.ymldoes (docs.docs_settings):CourseEnrollmenthascourse_details,created,is_active,mode,user, and is referenced by enrollment create and retrieve.CourseEnrollmentsApiListhascourse_id,created,is_active,mode,user, and is referenced only byGET /api/enrollment/v2/enrollments/.pytest openedx/core/djangoapps/enrollments/: 272 passed.The committed
docs/lms-openapi.yamlpicks this up on the next run of the schema workflow.