Conversation
OpenAPI ChangesShow/hide 26 changes: 26 error, 0 warning, 0 infoUnexpected changes? Ensure your branch is up-to-date with |
There was a problem hiding this comment.
Pull request overview
Updates the API contract to reflect that VideoResource.video may be null for some video learning resources (post-#2965), aligning backend serialization, OpenAPI specs, and generated TypeScript client types.
Changes:
- Allow
VideoResourceSerializer.videoto benullin DRF (allow_null=True). - Mark
VideoResource.videoasnullable: truein both v0 and v1 OpenAPI specs. - Regenerate/update the TS API client types so
videois typed asVideo | null.
Reviewed changes
Copilot reviewed 3 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| openapi/specs/v1.yaml | Marks VideoResource.video as nullable in the v1 OpenAPI schema. |
| openapi/specs/v0.yaml | Marks VideoResource.video as nullable in the v0 OpenAPI schema. |
| learning_resources/serializers.py | Allows the nested video field to serialize as null when missing. |
| frontends/api/src/generated/v1/api.ts | Updates generated v1 TS types: video: Video | null. |
| frontends/api/src/generated/v0/api.ts | Updates generated v0 TS types: video: Video | null. |
| ) | ||
|
|
||
| video = VideoSerializer(read_only=True) | ||
| video = VideoSerializer(read_only=True, allow_null=True) |
There was a problem hiding this comment.
video is now allowed to be null for VideoResourceSerializer, but there’s no serializer test covering the case where a LearningResource has resource_type=video and no related Video row. Adding a unit test that asserts the serializer returns "video": null (and does not raise) would protect this behavior and keep it aligned with the OpenAPI change.
ChristopherChudzicki
left a comment
There was a problem hiding this comment.
👍
Should we add a test like copilot said?
for our future reference: This is fixing the spec to accurately reflect the API
aa0ee24 to
dab568e
Compare
What are the relevant tickets?
None
Description (What does it do?)
After #2965 some video learning resources have a null video object. This updates the open-api spec to reflect that
How can this be tested?
The automated tests should pass