Skip to content

Expose redemption_status as an enum in the OpenAPI spec#3708

Merged
dsubak merged 2 commits into
mainfrom
cc/codes-redemption-status-enum
Jun 29, 2026
Merged

Expose redemption_status as an enum in the OpenAPI spec#3708
dsubak merged 2 commits into
mainfrom
cc/codes-redemption-status-enum

Conversation

@ChristopherChudzicki

Copy link
Copy Markdown
Contributor

What are the relevant tickets?

None

Description (What does it do?)

Makes redemption_status an enum.

How can this be tested?

CI should pass.

Additional Context

The frontend has been patching the enum type on; let's just get it from the spec.

https://github.com/mitodl/mit-learn/pull/3530/changes#diff-bf61d750bba151d3b8c7df563af5d15b4695ed7fc5d59fa22e2851069e2cc2d6R14-R16

@github-actions

Copy link
Copy Markdown

OpenAPI Changes

Show/hide ## Changes for v0.yaml:
## Changes for v0.yaml:
12 changes: 6 error, 0 warning, 6 info
error	[response-property-type-changed] at head/openapi/specs/v0.yaml
	in API GET /api/v0/b2b/manager/organizations/{parent_lookup_organization}/contracts/{id}/codes/
		the `items/redemption_status` response's property type/format changed from `string`/`` to ``/`` for status `200`

error	[response-property-type-changed] at head/openapi/specs/v0.yaml
	in API POST /api/v0/b2b/manager/organizations/{parent_lookup_organization}/contracts/{id}/codes/bulk_assign/
		the `assigned/items/redemption_status` response's property type/format changed from `string`/`` to ``/`` for status `200`

error	[response-property-type-changed] at head/openapi/specs/v0.yaml
	in API POST /api/v0/b2b/manager/organizations/{parent_lookup_organization}/contracts/{id}/codes/{code}/assign/
		the `redemption_status` response's property type/format changed from `string`/`` to ``/`` for status `200`

error	[response-property-type-changed] at head/openapi/specs/v0.yaml
	in API PUT /api/v0/b2b/manager/organizations/{parent_lookup_organization}/contracts/{id}/codes/{code}/reassign/
		the `redemption_status` response's property type/format changed from `string`/`` to ``/`` for status `200`

error	[response-property-type-changed] at head/openapi/specs/v0.yaml
	in API POST /api/v0/b2b/manager/organizations/{parent_lookup_organization}/contracts/{id}/codes/{code}/remind/
		the `redemption_status` response's property type/format changed from `string`/`` to ``/`` for status `200`

error	[response-property-type-changed] at head/openapi/specs/v0.yaml
	in API DELETE /api/v0/b2b/manager/organizations/{parent_lookup_organization}/contracts/{id}/codes/{code}/revoke/
		the `redemption_status` response's property type/format changed from `string`/`` to ``/`` for status `200`

info	[response-property-all-of-added] at head/openapi/specs/v0.yaml
	in API GET /api/v0/b2b/manager/organizations/{parent_lookup_organization}/contracts/{id}/codes/
		added `#/components/schemas/RedemptionStatusEnum` to the `items/redemption_status` response property `allOf` list for the response status `200`

info	[response-property-all-of-added] at head/openapi/specs/v0.yaml
	in API POST /api/v0/b2b/manager/organizations/{parent_lookup_organization}/contracts/{id}/codes/bulk_assign/
		added `#/components/schemas/RedemptionStatusEnum` to the `assigned/items/redemption_status` response property `allOf` list for the response status `200`

info	[response-property-all-of-added] at head/openapi/specs/v0.yaml
	in API POST /api/v0/b2b/manager/organizations/{parent_lookup_organization}/contracts/{id}/codes/{code}/assign/
		added `#/components/schemas/RedemptionStatusEnum` to the `redemption_status` response property `allOf` list for the response status `200`

info	[response-property-all-of-added] at head/openapi/specs/v0.yaml
	in API PUT /api/v0/b2b/manager/organizations/{parent_lookup_organization}/contracts/{id}/codes/{code}/reassign/
		added `#/components/schemas/RedemptionStatusEnum` to the `redemption_status` response property `allOf` list for the response status `200`

info	[response-property-all-of-added] at head/openapi/specs/v0.yaml
	in API POST /api/v0/b2b/manager/organizations/{parent_lookup_organization}/contracts/{id}/codes/{code}/remind/
		added `#/components/schemas/RedemptionStatusEnum` to the `redemption_status` response property `allOf` list for the response status `200`

info	[response-property-all-of-added] at head/openapi/specs/v0.yaml
	in API DELETE /api/v0/b2b/manager/organizations/{parent_lookup_organization}/contracts/{id}/codes/{code}/revoke/
		added `#/components/schemas/RedemptionStatusEnum` to the `redemption_status` response property `allOf` list for the response status `200`



## Changes for v1.yaml:
12 changes: 6 error, 0 warning, 6 info
error	[response-property-type-changed] at head/openapi/specs/v1.yaml
	in API GET /api/v0/b2b/manager/organizations/{parent_lookup_organization}/contracts/{id}/codes/
		the `items/redemption_status` response's property type/format changed from `string`/`` to ``/`` for status `200`

error	[response-property-type-changed] at head/openapi/specs/v1.yaml
	in API POST /api/v0/b2b/manager/organizations/{parent_lookup_organization}/contracts/{id}/codes/bulk_assign/
		the `assigned/items/redemption_status` response's property type/format changed from `string`/`` to ``/`` for status `200`

error	[response-property-type-changed] at head/openapi/specs/v1.yaml
	in API POST /api/v0/b2b/manager/organizations/{parent_lookup_organization}/contracts/{id}/codes/{code}/assign/
		the `redemption_status` response's property type/format changed from `string`/`` to ``/`` for status `200`

error	[response-property-type-changed] at head/openapi/specs/v1.yaml
	in API PUT /api/v0/b2b/manager/organizations/{parent_lookup_organization}/contracts/{id}/codes/{code}/reassign/
		the `redemption_status` response's property type/format changed from `string`/`` to ``/`` for status `200`

error	[response-property-type-changed] at head/openapi/specs/v1.yaml
	in API POST /api/v0/b2b/manager/organizations/{parent_lookup_organization}/contracts/{id}/codes/{code}/remind/
		the `redemption_status` response's property type/format changed from `string`/`` to ``/`` for status `200`

error	[response-property-type-changed] at head/openapi/specs/v1.yaml
	in API DELETE /api/v0/b2b/manager/organizations/{parent_lookup_organization}/contracts/{id}/codes/{code}/revoke/
		the `redemption_status` response's property type/format changed from `string`/`` to ``/`` for status `200`

info	[response-property-all-of-added] at head/openapi/specs/v1.yaml
	in API GET /api/v0/b2b/manager/organizations/{parent_lookup_organization}/contracts/{id}/codes/
		added `#/components/schemas/RedemptionStatusEnum` to the `items/redemption_status` response property `allOf` list for the response status `200`

info	[response-property-all-of-added] at head/openapi/specs/v1.yaml
	in API POST /api/v0/b2b/manager/organizations/{parent_lookup_organization}/contracts/{id}/codes/bulk_assign/
		added `#/components/schemas/RedemptionStatusEnum` to the `assigned/items/redemption_status` response property `allOf` list for the response status `200`

info	[response-property-all-of-added] at head/openapi/specs/v1.yaml
	in API POST /api/v0/b2b/manager/organizations/{parent_lookup_organization}/contracts/{id}/codes/{code}/assign/
		added `#/components/schemas/RedemptionStatusEnum` to the `redemption_status` response property `allOf` list for the response status `200`

info	[response-property-all-of-added] at head/openapi/specs/v1.yaml
	in API PUT /api/v0/b2b/manager/organizations/{parent_lookup_organization}/contracts/{id}/codes/{code}/reassign/
		added `#/components/schemas/RedemptionStatusEnum` to the `redemption_status` response property `allOf` list for the response status `200`

info	[response-property-all-of-added] at head/openapi/specs/v1.yaml
	in API POST /api/v0/b2b/manager/organizations/{parent_lookup_organization}/contracts/{id}/codes/{code}/remind/
		added `#/components/schemas/RedemptionStatusEnum` to the `redemption_status` response property `allOf` list for the response status `200`

info	[response-property-all-of-added] at head/openapi/specs/v1.yaml
	in API DELETE /api/v0/b2b/manager/organizations/{parent_lookup_organization}/contracts/{id}/codes/{code}/revoke/
		added `#/components/schemas/RedemptionStatusEnum` to the `redemption_status` response property `allOf` list for the response status `200`



## Changes for v2.yaml:
12 changes: 6 error, 0 warning, 6 info
error	[response-property-type-changed] at head/openapi/specs/v2.yaml
	in API GET /api/v0/b2b/manager/organizations/{parent_lookup_organization}/contracts/{id}/codes/
		the `items/redemption_status` response's property type/format changed from `string`/`` to ``/`` for status `200`

error	[response-property-type-changed] at head/openapi/specs/v2.yaml
	in API POST /api/v0/b2b/manager/organizations/{parent_lookup_organization}/contracts/{id}/codes/bulk_assign/
		the `assigned/items/redemption_status` response's property type/format changed from `string`/`` to ``/`` for status `200`

error	[response-property-type-changed] at head/openapi/specs/v2.yaml
	in API POST /api/v0/b2b/manager/organizations/{parent_lookup_organization}/contracts/{id}/codes/{code}/assign/
		the `redemption_status` response's property type/format changed from `string`/`` to ``/`` for status `200`

error	[response-property-type-changed] at head/openapi/specs/v2.yaml
	in API PUT /api/v0/b2b/manager/organizations/{parent_lookup_organization}/contracts/{id}/codes/{code}/reassign/
		the `redemption_status` response's property type/format changed from `string`/`` to ``/`` for status `200`

error	[response-property-type-changed] at head/openapi/specs/v2.yaml
	in API POST /api/v0/b2b/manager/organizations/{parent_lookup_organization}/contracts/{id}/codes/{code}/remind/
		the `redemption_status` response's property type/format changed from `string`/`` to ``/`` for status `200`

error	[response-property-type-changed] at head/openapi/specs/v2.yaml
	in API DELETE /api/v0/b2b/manager/organizations/{parent_lookup_organization}/contracts/{id}/codes/{code}/revoke/
		the `redemption_status` response's property type/format changed from `string`/`` to ``/`` for status `200`

info	[response-property-all-of-added] at head/openapi/specs/v2.yaml
	in API GET /api/v0/b2b/manager/organizations/{parent_lookup_organization}/contracts/{id}/codes/
		added `#/components/schemas/RedemptionStatusEnum` to the `items/redemption_status` response property `allOf` list for the response status `200`

info	[response-property-all-of-added] at head/openapi/specs/v2.yaml
	in API POST /api/v0/b2b/manager/organizations/{parent_lookup_organization}/contracts/{id}/codes/bulk_assign/
		added `#/components/schemas/RedemptionStatusEnum` to the `assigned/items/redemption_status` response property `allOf` list for the response status `200`

info	[response-property-all-of-added] at head/openapi/specs/v2.yaml
	in API POST /api/v0/b2b/manager/organizations/{parent_lookup_organization}/contracts/{id}/codes/{code}/assign/
		added `#/components/schemas/RedemptionStatusEnum` to the `redemption_status` response property `allOf` list for the response status `200`

info	[response-property-all-of-added] at head/openapi/specs/v2.yaml
	in API PUT /api/v0/b2b/manager/organizations/{parent_lookup_organization}/contracts/{id}/codes/{code}/reassign/
		added `#/components/schemas/RedemptionStatusEnum` to the `redemption_status` response property `allOf` list for the response status `200`

info	[response-property-all-of-added] at head/openapi/specs/v2.yaml
	in API POST /api/v0/b2b/manager/organizations/{parent_lookup_organization}/contracts/{id}/codes/{code}/remind/
		added `#/components/schemas/RedemptionStatusEnum` to the `redemption_status` response property `allOf` list for the response status `200`

info	[response-property-all-of-added] at head/openapi/specs/v2.yaml
	in API DELETE /api/v0/b2b/manager/organizations/{parent_lookup_organization}/contracts/{id}/codes/{code}/revoke/
		added `#/components/schemas/RedemptionStatusEnum` to the `redemption_status` response property `allOf` list for the response status `200`



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

ChristopherChudzicki and others added 2 commits June 26, 2026 19:20
The ManagerEnrollmentCodeSerializer.redemption_status SerializerMethodField
was annotated only as `-> str`, so drf-spectacular emitted a bare
`type: string` with no enum. Decorate the getter with
`@extend_schema_field(ChoiceField(choices=REDEMPTION_STATUSES))` so the spec
advertises the three valid values, and add REDEMPTION_STATUSES as a single
source of truth alongside the existing REDEMPTION_STATUS_* constants.

oasdiff flags the enum-ization as a response property type change (the inline
`type: string` moves onto the referenced enum schema), so add err-ignore
entries marking it as a spec correction rather than a behavioral break.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
These entries suppressed breaking changes from already-merged PRs (page
nullability, min/max_price int->number, partner_schools required props,
codes bulk_assign/assign/remind/revoke shape changes). Those changes are now
present in both the base (main) and head specs, so oasdiff no longer reports
them and the ignore entries never match. Verified: with these removed,
oasdiff breaking (main vs this branch) reports no breaking changes across
v0/v1/v2 beyond the redemption_status enum correction.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dsubak dsubak merged commit 2f171e0 into main Jun 29, 2026
9 checks passed
@dsubak dsubak deleted the cc/codes-redemption-status-enum branch June 29, 2026 14:31
@odlbot odlbot mentioned this pull request Jun 29, 2026
6 tasks
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.

2 participants