Skip to content

Fix attribution source enum colliding with reading list enum in OpenAPI schema - #655

Merged
bpepple merged 1 commit into
masterfrom
attribution-source
Oct 16, 2026
Merged

bpepple merged 1 commit into
masterfrom
attribution-source

Conversation

@bpepple

@bpepple bpepple commented Oct 16, 2026

Copy link
Copy Markdown
Member

Summary

#654 added an ENUM_NAME_OVERRIDES entry that named the resource attribution source choices AttributionSourceEnum. drf-spectacular already generates that name for the reading list's attribution_source field, so the override took it over. In the generated schema, the reading list's writable attribution_source field now lists the Marvel / Wikipedia / Grand Comics Database / DC choices instead of CBRO / CMRO / CBH / etc. Spectacular gives no warning, because the override hides the collision. Mokkari caught it while being updated for the new API fields.

Changes

  • Rename the resource attribution enum to ResourceAttributionSourceEnum.
  • Fix the reading list enum to its original name (AttributionSourceEnum) with an explicit override, so a future override can't silently take it.
  • Extend test_schema_names_attribution_source_enum to check that both enums exist with their own choices. The old test only checked the attribution enum, so it passed even though the schema was wrong.

Impact

Schema only. API responses are unchanged. The reading list enum is back to its pre-#654 name and values. The resource attribution enum has a new component name, which only matters to clients generated from the schema since #654 merged.

The ENUM_NAME_OVERRIDES entry added for resource attribution sources used the name AttributionSourceEnum. drf-spectacular already generates that name for the reading list's attribution_source field, so the override took it over. The reading list's writable attribution_source ended up referencing the Marvel/Wikipedia/GCD/DC choices instead of CBRO/CMRO/etc., and spectacular gave no warning.

Rename the resource attribution enum to ResourceAttributionSourceEnum and fix the reading list enum to its original name so a future override can't silently take it. Extend the schema test to check both enums.
@bpepple bpepple self-assigned this Oct 16, 2026
@bpepple bpepple added bug Something isn't working api An API bug/feature labels Oct 16, 2026
@bpepple
bpepple merged commit b74d171 into master Oct 16, 2026
2 checks passed
@bpepple
bpepple deleted the attribution-source branch October 16, 2026 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api An API bug/feature bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant