feat(tracks): allow custom genres; cap at 100 chars#874
Closed
dylanjeffers wants to merge 2 commits into
Closed
Conversation
- 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>
7 tasks
Contributor
Author
|
Superseded by fresh-branch PR from main on genres/custom |
dylanjeffers
added a commit
that referenced
this pull request
May 29, 2026
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](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 - [x] Existing test fixtures using `genre: "Electronic"` still pass (those values are still valid strings). - [x] `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](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
api/v1_track.go: dropped theoneof='Electronic' 'Rock' ...validators onCreateTrackRequest.Genre(required) andUpdateTrackRequest.Genre(omitempty); replaced withmin=1,max=100andmax=100respectively.api/swagger/swagger-v1.yaml:genreschema changed from string-enum to plain string withmaxLength: 100. Canonical values moved into the description so generated docs/SDKs still surface them as autocomplete suggestions.Pairs with AudiusProject/apps#14419 — the SDK regen, 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
genre: "Electronic"etc. still pass (no breakage from removing the enum constraint — those values are still valid strings)./v1/trackswithgenre: "Phonk"succeeds.genre: ""returns 400 (min=1).max=100)./v1/swagger.yamlshow the new schema with description containing the canonical values.🤖 Generated with Claude Code