Skip to content

Commit 5e04c92

Browse files
committed
Fix missing description on uris body parameter in endpoint-reorder-or-replace-playlists-tracks
1 parent 95c1a65 commit 5e04c92

File tree

5 files changed

+35
-5
lines changed

5 files changed

+35
-5
lines changed

spotify-web-api-core/src/main/resources/spotify-web-api.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5299,7 +5299,9 @@ categories:
52995299
required: false
53005300
- location: BODY
53015301
name: uris
5302-
description: ""
5302+
description: "A comma-separated list of [Spotify URIs](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids)\
5303+
\ to set, can be track or episode URIs. For example: `uris=spotify:track:4iV5W9uYEdYUVa79Axb7Rh,spotify:track:1301WleyT98MSxVHPZCA6M,spotify:episode:512ojhOuo1ktJprKbVcKyQ`\
5304+
\ \nA maximum of 100 items can be set in one request."
53035305
type: "Array[String]"
53045306
required: false
53055307
- location: BODY

spotify-web-api-generator-open-api/spotify-open-api-spec.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4112,7 +4112,9 @@ paths:
41124112
properties:
41134113
uris:
41144114
type: array
4115-
description: ""
4115+
description: "A comma-separated list of [Spotify URIs](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids)\
4116+
\ to set, can be track or episode URIs. For example: `uris=spotify:track:4iV5W9uYEdYUVa79Axb7Rh,spotify:track:1301WleyT98MSxVHPZCA6M,spotify:episode:512ojhOuo1ktJprKbVcKyQ`\
4117+
\ \nA maximum of 100 items can be set in one request."
41164118
items:
41174119
type: string
41184120
range_start:

spotify-web-api-java/src/main/generated/de/sonallux/spotify/api/apis/PlaylistsApi.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public ReorderPlaylistsTracksRequest reorderPlaylistsTracks(String playlistId, i
121121
* <h3>Replace items in a playlist</h3>
122122
* <p>Replace all the items in a playlist, overwriting its existing items. This powerful request can be useful for replacing items, re-ordering existing items, or clearing the playlist.</p>
123123
* @param playlistId <p>The <a href="https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids">Spotify ID</a> for the playlist.</p>
124-
* @param uris
124+
* @param uris <p>A comma-separated list of <a href="https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids">Spotify URIs</a> to set, can be track or episode URIs. For example: <code>uris=spotify:track:4iV5W9uYEdYUVa79Axb7Rh,spotify:track:1301WleyT98MSxVHPZCA6M,spotify:episode:512ojhOuo1ktJprKbVcKyQ</code><br>A maximum of 100 items can be set in one request.</p>
125125
* @return a {@link ReplacePlaylistsTracksRequest} object to build and execute the request
126126
*/
127127
public ReplacePlaylistsTracksRequest replacePlaylistsTracks(String playlistId, java.util.List<String> uris) {

spotify-web-api-java/src/main/generated/de/sonallux/spotify/api/apis/playlists/ReplacePlaylistsTracksRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public class ReplacePlaylistsTracksRequest {
2525
* <h3>Replace items in a playlist request</h3>
2626
* @param apiClient <p>The API client</p>
2727
* @param playlistId <p>The <a href="https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids">Spotify ID</a> for the playlist.</p>
28-
* @param uris
28+
* @param uris <p>A comma-separated list of <a href="https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids">Spotify URIs</a> to set, can be track or episode URIs. For example: <code>uris=spotify:track:4iV5W9uYEdYUVa79Axb7Rh,spotify:track:1301WleyT98MSxVHPZCA6M,spotify:episode:512ojhOuo1ktJprKbVcKyQ</code><br>A maximum of 100 items can be set in one request.</p>
2929
*/
3030
public ReplacePlaylistsTracksRequest(ApiClient apiClient, String playlistId, java.util.List<String> uris) {
3131
this.apiClient = apiClient;

spotify-web-api-parser/src/main/java/de/sonallux/spotify/parser/ApiEndpointFixes.java

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import java.util.List;
77
import java.util.SortedMap;
88

9-
import static de.sonallux.spotify.core.model.SpotifyWebApiEndpoint.ParameterLocation.PATH;
9+
import static de.sonallux.spotify.core.model.SpotifyWebApiEndpoint.ParameterLocation.*;
1010

1111
@Slf4j
1212
class ApiEndpointFixes {
@@ -17,6 +17,7 @@ static void fixApiEndpoints(SortedMap<String, SpotifyWebApiCategory> categories)
1717
fixStartAUsersPlayback(categories);
1818
fixGetUsersSavedShowsScope(categories);
1919
fixCheckUsersSavedShowsScope(categories);
20+
fixReplaceAndReorderPlaylistTrackUrisParameter(categories);
2021
}
2122

2223
private static void fixChangePlaylistsDetails(SortedMap<String, SpotifyWebApiCategory> categories) {
@@ -113,4 +114,29 @@ private static void fixCheckUsersSavedShowsScope(SortedMap<String, SpotifyWebApi
113114
endpoint.setScopes(List.of("user-library-read"));
114115
}
115116
}
117+
118+
private static void fixReplaceAndReorderPlaylistTrackUrisParameter(SortedMap<String, SpotifyWebApiCategory> categories) {
119+
var endpoint = categories.get("category-playlists")
120+
.getEndpoints().get("endpoint-reorder-or-replace-playlists-tracks");
121+
122+
var urisBodyParameter = endpoint.getParameters().stream()
123+
.filter(p -> p.getLocation() == BODY && "uris".equals(p.getName()))
124+
.findFirst().orElse(null);
125+
if (urisBodyParameter == null) {
126+
log.warn("Can not find uris body parameter in endpoint-reorder-or-replace-playlists-tracks");
127+
return;
128+
} else if (!urisBodyParameter.getDescription().isBlank()) {
129+
log.warn("Missing description on uris body parameter in endpoint-reorder-or-replace-playlists-tracks has been fixed");
130+
}
131+
132+
var urisQueryParameter = endpoint.getParameters().stream()
133+
.filter(p -> p.getLocation() == QUERY && "uris".equals(p.getName()))
134+
.findFirst().orElse(null);
135+
if (urisQueryParameter == null) {
136+
log.warn("Can not find uris query parameter in endpoint-reorder-or-replace-playlists-tracks");
137+
return;
138+
}
139+
140+
urisBodyParameter.setDescription(urisQueryParameter.getDescription());
141+
}
116142
}

0 commit comments

Comments
 (0)