docs(artists): POST /api/artists resolve-or-create by spotify_artist_id (chat#1889 row 8)

Merged
SW
4mo ago
+15-1

Contract-first PR for chat#1889 row 8 (dedup at creation).

POST /api/artists gains optional spotify_artist_id:

  • canonical exists → link to account, return { artist } 200
  • none → create + attach the SPOTIFY social server-side, return 201
  • omitted → unchanged (201)

Merge order: this PR → api#TBD → chat#TBD. The 2026-07-29 decision on the issue: one canonical artist per Spotify id, enforced at creation; no account-scoped canonical lookups (api#792 closed unmerged).

Edited via anchored text edits (releases.json doesn't round-trip byte-identical); re-validated the JSON parses and both the property and the 200 response resolve.

🤖 Generated with Claude Code


Summary by cubic

Adds resolve-or-create behavior to POST /api/artists using an optional spotify_artist_id to prevent duplicate artists and link accounts to the canonical record. OpenAPI now documents 200 on linking existing and 201 on creating a new artist, with copy updated to follow customer-facing style.

  • New Features
    • Optional spotify_artist_id on create.
    • If a canonical exists for that id, link it to the account and return 200 with { artist }.
    • If none exists, create the artist and attach the Spotify profile, return 201.
    • Omitting spotify_artist_id keeps existing create behavior (201).
    • OpenAPI: added 200 response and field docs; clarified “one canonical artist per Spotify id” at creation; removed em dashes in the endpoint description.

Summary by CodeRabbit

  • Documentation
    • Updated artist creation API documentation to support an optional Spotify artist ID.
    • Clarified that requests may link an existing artist instead of creating a duplicate.
    • Documented successful responses for both newly created and linked artists.