Skip to content

feat(tracks): allow custom genres; cap at 100 chars#879

Merged
dylanjeffers merged 2 commits into
mainfrom
genres/custom
May 29, 2026
Merged

feat(tracks): allow custom genres; cap at 100 chars#879
dylanjeffers merged 2 commits into
mainfrom
genres/custom

Conversation

@dylanjeffers
Copy link
Copy Markdown
Contributor

Fresh branch off main — supersedes #874.

Summary

  • api/v1_track.go: dropped the oneof='Electronic' 'Rock' ... validators on CreateTrackRequest.Genre (required) and UpdateTrackRequest.Genre (omitempty); replaced with min=1,max=100 and max=100.
  • api/swagger/swagger-v1.yaml: genre schema changed from string-enum to plain string with maxLength: 100. Canonical values moved into the description so generated docs/SDKs still surface them as autocomplete suggestions.
  • indexer/constants.go: added MaxTrackGenreLength = 100 next to Entity_Track. Forward-looking — when the Go indexer takes over track entity-event consumption from the Python discovery-provider, this is the rule the new handler should enforce, mirroring discovery-provider's CHARACTER_LIMIT_GENRE.

Pairs with AudiusProject/apps#14424 — the SDK regen, Python indexer relaxation, and web UI live there. Ship this first (or together) so the Python indexer relaxation isn't gated on a Go API that still rejects custom genres at the validate-tag layer.

Test plan

  • Existing test fixtures using genre: "Electronic" still pass (those values are still valid strings).
  • go build ./indexer clean.
  • POST /v1/tracks with genre: "Phonk" succeeds.
  • POST with genre: "" returns 400 (min=1).
  • POST with a 101-char genre returns 400 (max=100).
  • Generated swagger docs at /v1/swagger.yaml show the new schema with description containing canonical values.
  • When the Go indexer's track-event consumer is implemented, it references indexer.MaxTrackGenreLength rather than introducing its own enum check.

🤖 Generated with Claude Code

dylanjeffers and others added 2 commits May 29, 2026 13:30
- v1_track.go: drop `oneof=...` enum validators on CreateTrackRequest.Genre
  and UpdateTrackRequest.Genre; replace with min/max length constraints
- swagger/swagger-v1.yaml: genre schema changed from string-enum to plain
  string with maxLength=100; canonical values moved into description so
  generated docs/SDKs still surface known autocomplete options

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ent consumer

When the Go indexer takes over track entity-event consumption from the
Python discovery-provider, the genre validation must mirror the new
write-time rule: arbitrary user-supplied string, no enum, just a 100-char
length cap. Land the constant next to Entity_Track so future track-event
handler implementations pick it up by default.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@dylanjeffers dylanjeffers merged commit dd3e8fb into main May 29, 2026
5 checks passed
@dylanjeffers dylanjeffers deleted the genres/custom branch May 29, 2026 21:59
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.

1 participant