Skip to content

update openapi spec#3074

Merged
abeglova merged 1 commit intomainfrom
ab/update-openapi-spec
Mar 20, 2026
Merged

update openapi spec#3074
abeglova merged 1 commit intomainfrom
ab/update-openapi-spec

Conversation

@abeglova
Copy link
Contributor

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

@github-actions
Copy link

OpenAPI Changes

Show/hide 26 changes: 26 error, 0 warning, 0 info
26 changes: 26 error, 0 warning, 0 info
error	[response-property-became-nullable] at head/openapi/specs/v0.yaml	
	in API GET /api/v0/vector_learning_resources_search/
		the response property 'results/items/oneOf[#/components/schemas/VideoResource]/video' became nullable for the status '200'

error	[response-property-became-nullable] at head/openapi/specs/v1.yaml	
	in API GET /api/v1/featured/
		the response property 'results/items/oneOf[#/components/schemas/VideoResource]/video' became nullable for the status '200'

error	[response-property-became-nullable] at head/openapi/specs/v1.yaml	
	in API GET /api/v1/featured/{id}/
		the response property '/oneOf[#/components/schemas/VideoResource]/video' became nullable for the status '200'

error	[response-property-became-nullable] at head/openapi/specs/v1.yaml	
	in API GET /api/v1/learning_resources/
		the response property 'results/items/oneOf[#/components/schemas/VideoResource]/video' became nullable for the status '200'

error	[response-property-became-nullable] at head/openapi/specs/v1.yaml	
	in API GET /api/v1/learning_resources/{id}/
		the response property '/oneOf[#/components/schemas/VideoResource]/video' became nullable for the status '200'

error	[response-property-became-nullable] at head/openapi/specs/v1.yaml	
	in API PATCH /api/v1/learning_resources/{id}/learning_paths/
		the response property '/items/resource/allOf[#/components/schemas/LearningResource]/oneOf[#/components/schemas/VideoResource]/video' became nullable for the status '200'

error	[response-property-became-nullable] at head/openapi/specs/v1.yaml	
	in API GET /api/v1/learning_resources/{id}/similar/
		the response property '/items/oneOf[#/components/schemas/VideoResource]/video' became nullable for the status '200'

error	[response-property-became-nullable] at head/openapi/specs/v1.yaml	
	in API PATCH /api/v1/learning_resources/{id}/userlists/
		the response property '/items/resource/allOf[#/components/schemas/LearningResource]/oneOf[#/components/schemas/VideoResource]/video' became nullable for the status '200'

error	[response-property-became-nullable] at head/openapi/specs/v1.yaml	
	in API GET /api/v1/learning_resources/{id}/vector_similar/
		the response property '/items/oneOf[#/components/schemas/VideoResource]/video' became nullable for the status '200'

error	[response-property-became-nullable] at head/openapi/specs/v1.yaml	
	in API GET /api/v1/learning_resources/{learning_resource_id}/items/
		the response property 'results/items/resource/allOf[#/components/schemas/LearningResource]/oneOf[#/components/schemas/VideoResource]/video' became nullable for the status '200'

error	[response-property-became-nullable] at head/openapi/specs/v1.yaml	
	in API GET /api/v1/learning_resources/{learning_resource_id}/items/{id}/
		the response property 'resource/allOf[#/components/schemas/LearningResource]/oneOf[#/components/schemas/VideoResource]/video' became nullable for the status '200'

error	[response-property-became-nullable] at head/openapi/specs/v1.yaml	
	in API GET /api/v1/learning_resources_search/
		the response property 'results/items/oneOf[#/components/schemas/VideoResource]/video' became nullable for the status '200'

error	[response-property-became-nullable] at head/openapi/specs/v1.yaml	
	in API GET /api/v1/learningpaths/{learning_resource_id}/items/
		the response property 'results/items/resource/allOf[#/components/schemas/LearningResource]/oneOf[#/components/schemas/VideoResource]/video' became nullable for the status '200'

error	[response-property-became-nullable] at head/openapi/specs/v1.yaml	
	in API POST /api/v1/learningpaths/{learning_resource_id}/items/
		the response property 'resource/allOf[#/components/schemas/LearningResource]/oneOf[#/components/schemas/VideoResource]/video' became nullable for the status '201'

error	[response-property-became-nullable] at head/openapi/specs/v1.yaml	
	in API GET /api/v1/learningpaths/{learning_resource_id}/items/{id}/
		the response property 'resource/allOf[#/components/schemas/LearningResource]/oneOf[#/components/schemas/VideoResource]/video' became nullable for the status '200'

error	[response-property-became-nullable] at head/openapi/specs/v1.yaml	
	in API PATCH /api/v1/learningpaths/{learning_resource_id}/items/{id}/
		the response property 'resource/allOf[#/components/schemas/LearningResource]/oneOf[#/components/schemas/VideoResource]/video' became nullable for the status '200'

error	[response-property-became-nullable] at head/openapi/specs/v1.yaml	
	in API GET /api/v1/podcasts/{learning_resource_id}/items/
		the response property 'results/items/resource/allOf[#/components/schemas/LearningResource]/oneOf[#/components/schemas/VideoResource]/video' became nullable for the status '200'

error	[response-property-became-nullable] at head/openapi/specs/v1.yaml	
	in API GET /api/v1/podcasts/{learning_resource_id}/items/{id}/
		the response property 'resource/allOf[#/components/schemas/LearningResource]/oneOf[#/components/schemas/VideoResource]/video' became nullable for the status '200'

error	[response-property-became-nullable] at head/openapi/specs/v1.yaml	
	in API GET /api/v1/userlists/{userlist_id}/items/
		the response property 'results/items/resource/allOf[#/components/schemas/LearningResource]/oneOf[#/components/schemas/VideoResource]/video' became nullable for the status '200'

error	[response-property-became-nullable] at head/openapi/specs/v1.yaml	
	in API POST /api/v1/userlists/{userlist_id}/items/
		the response property 'resource/allOf[#/components/schemas/LearningResource]/oneOf[#/components/schemas/VideoResource]/video' became nullable for the status '201'

error	[response-property-became-nullable] at head/openapi/specs/v1.yaml	
	in API GET /api/v1/userlists/{userlist_id}/items/{id}/
		the response property 'resource/allOf[#/components/schemas/LearningResource]/oneOf[#/components/schemas/VideoResource]/video' became nullable for the status '200'

error	[response-property-became-nullable] at head/openapi/specs/v1.yaml	
	in API PATCH /api/v1/userlists/{userlist_id}/items/{id}/
		the response property 'resource/allOf[#/components/schemas/LearningResource]/oneOf[#/components/schemas/VideoResource]/video' became nullable for the status '200'

error	[response-property-became-nullable] at head/openapi/specs/v1.yaml	
	in API GET /api/v1/video_playlists/{learning_resource_id}/items/
		the response property 'results/items/resource/allOf[#/components/schemas/LearningResource]/oneOf[#/components/schemas/VideoResource]/video' became nullable for the status '200'

error	[response-property-became-nullable] at head/openapi/specs/v1.yaml	
	in API GET /api/v1/video_playlists/{learning_resource_id}/items/{id}/
		the response property 'resource/allOf[#/components/schemas/LearningResource]/oneOf[#/components/schemas/VideoResource]/video' became nullable for the status '200'

error	[response-property-became-nullable] at head/openapi/specs/v1.yaml	
	in API GET /api/v1/videos/
		the response property 'results/items/video' became nullable for the status '200'

error	[response-property-became-nullable] at head/openapi/specs/v1.yaml	
	in API GET /api/v1/videos/{id}/
		the response property 'video' became nullable for the status '200'


Unexpected changes? Ensure your branch is up-to-date with main (consider rebasing).

@abeglova abeglova marked this pull request as ready for review March 20, 2026 19:17
Copilot AI review requested due to automatic review settings March 20, 2026 19:17
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.video to be null in DRF (allow_null=True).
  • Mark VideoResource.video as nullable: true in both v0 and v1 OpenAPI specs.
  • Regenerate/update the TS API client types so video is typed as Video | 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)
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@ChristopherChudzicki ChristopherChudzicki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Should we add a test like copilot said?

for our future reference: This is fixing the spec to accurately reflect the API

@abeglova abeglova force-pushed the ab/update-openapi-spec branch from aa0ee24 to dab568e Compare March 20, 2026 19:58
@abeglova abeglova merged commit 407da6d into main Mar 20, 2026
13 of 14 checks passed
@abeglova abeglova deleted the ab/update-openapi-spec branch March 20, 2026 20:07
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.

3 participants