From a586cb736e58be60d406f44c13c6f58fcdcd8927 Mon Sep 17 00:00:00 2001 From: Sweets Sweetman Date: Wed, 15 Apr 2026 14:36:08 -0500 Subject: [PATCH] docs: tighten research endpoint schemas to match handler enforcement MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Align OpenAPI spec with the validation the handlers actually enforce: Enums (docs were permissive, handlers restrict): - /research/metrics source: 14-item enum (spotify, tiktok, youtube_*, etc.) - /research/playlist platform: spotify|applemusic|deezer|amazon|youtube - /research/playlists platform: same 5-value enum - /research/track/playlists platform: spotify|applemusic|deezer|amazon (no youtube, matching handler); status: current|past - /research/similar audience|genre|mood|musicality: high|medium|low Missing query params documented: - /research/playlists: indie, majorCurator, popularIndie, personalized, chart Validation constraints: - /research/charts platform pattern: ^[a-z]+$ - /research/discover country: minLength/maxLength 2 - /research/discover limit: minimum 1, maximum 100 - ResearchExtractRequest.urls: minItems 1 Surfaced by cross-checking routes in recoupable/api#366 against the openapi spec. No behavior change — docs only. Co-Authored-By: Claude Opus 4.6 (1M context) --- api-reference/openapi/research.json | 66 +++++++++++++++++++++++++---- 1 file changed, 58 insertions(+), 8 deletions(-) diff --git a/api-reference/openapi/research.json b/api-reference/openapi/research.json index 50f4d12..1b92cff 100644 --- a/api-reference/openapi/research.json +++ b/api-reference/openapi/research.json @@ -1047,7 +1047,8 @@ "required": true, "description": "Chart platform: spotify, applemusic, tiktok, youtube, itunes, shazam, etc.", "schema": { - "type": "string" + "type": "string", + "pattern": "^[a-z]+$" } }, { @@ -1305,7 +1306,9 @@ "required": false, "description": "ISO country code (e.g., US, BR, GB).", "schema": { - "type": "string" + "type": "string", + "minLength": 2, + "maxLength": 2 } }, { @@ -1348,7 +1351,9 @@ "required": false, "schema": { "type": "integer", - "default": 20 + "default": 20, + "minimum": 1, + "maximum": 100 } } ], @@ -2008,6 +2013,46 @@ "type": "integer", "default": 20 } + }, + { + "name": "indie", + "in": "query", + "description": "Include indie playlists.", + "schema": { + "type": "boolean" + } + }, + { + "name": "majorCurator", + "in": "query", + "description": "Include major-curator playlists.", + "schema": { + "type": "boolean" + } + }, + { + "name": "popularIndie", + "in": "query", + "description": "Include popular indie playlists.", + "schema": { + "type": "boolean" + } + }, + { + "name": "personalized", + "in": "query", + "description": "Include personalized playlists.", + "schema": { + "type": "boolean" + } + }, + { + "name": "chart", + "in": "query", + "description": "Include chart playlists.", + "schema": { + "type": "boolean" + } } ], "responses": { @@ -2201,7 +2246,8 @@ "high", "medium", "low" - ] + ], + "default": "medium" } }, { @@ -2215,7 +2261,8 @@ "high", "medium", "low" - ] + ], + "default": "medium" } }, { @@ -2229,7 +2276,8 @@ "high", "medium", "low" - ] + ], + "default": "medium" } }, { @@ -2243,7 +2291,8 @@ "high", "medium", "low" - ] + ], + "default": "medium" } }, { @@ -3974,7 +4023,8 @@ "format": "uri" }, "maxItems": 10, - "description": "URLs to extract content from (max 10)." + "description": "URLs to extract content from (max 10).", + "minItems": 1 }, "objective": { "type": "string",