Skip to content

Commit a4b8948

Browse files
authored
Fix market parameter in 'Get a Playlist's Items' endpoint (#89)
Fix #84
1 parent 7b80d28 commit a4b8948

File tree

7 files changed

+27
-12
lines changed

7 files changed

+27
-12
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>de.sonallux.spotify</groupId>
88
<artifactId>spotify-web-api-parent</artifactId>
9-
<version>2021.6.30</version>
9+
<version>2021.7.20</version>
1010
<packaging>pom</packaging>
1111

1212
<name>spotify-web-api-parent</name>

spotify-web-api-core/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
<parent>
88
<groupId>de.sonallux.spotify</groupId>
99
<artifactId>spotify-web-api-parent</artifactId>
10-
<version>2021.6.30</version>
10+
<version>2021.7.20</version>
1111
<relativePath>../pom.xml</relativePath>
1212
</parent>
1313

1414
<artifactId>spotify-web-api-core</artifactId>
15-
<version>2021.6.30</version>
15+
<version>2021.7.20</version>
1616
<packaging>jar</packaging>
1717

1818
<name>spotify-web-api-core</name>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5107,7 +5107,7 @@ categories:
51075107
\ over this parameter. \n*Note: If neither market or user country are\
51085108
\ provided, the episode is considered unavailable for the client.*"
51095109
type: String
5110-
required: true
5110+
required: false
51115111
- location: QUERY
51125112
name: fields
51135113
description: "Filters for the query: a comma-separated list of the fields\

spotify-web-api-generator-open-api/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
<parent>
88
<groupId>de.sonallux.spotify</groupId>
99
<artifactId>spotify-web-api-parent</artifactId>
10-
<version>2021.6.30</version>
10+
<version>2021.7.20</version>
1111
<relativePath>../pom.xml</relativePath>
1212
</parent>
1313

1414
<artifactId>spotify-web-api-generator-open-api</artifactId>
15-
<version>2021.6.30</version>
15+
<version>2021.7.20</version>
1616
<packaging>jar</packaging>
1717

1818
<name>spotify-web-api-generator-open-api</name>
@@ -31,7 +31,7 @@
3131
<dependency>
3232
<groupId>de.sonallux.spotify</groupId>
3333
<artifactId>spotify-web-api-core</artifactId>
34-
<version>2021.6.30</version>
34+
<version>2021.7.20</version>
3535
</dependency>
3636
<dependency>
3737
<groupId>io.swagger.core.v3</groupId>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ info:
44
contact:
55
name: sonallux
66
url: https://github.com/sonallux/spotify-web-api
7-
version: 2021.6.30
7+
version: 2021.7.20
88
externalDocs:
99
description: Find more info on the official Spotify Web API Reference
1010
url: https://developer.spotify.com/documentation/web-api/reference
@@ -3890,7 +3890,7 @@ paths:
38903890
\ header, the country associated with the user account will take priority\
38913891
\ over this parameter. \n*Note: If neither market or user country are provided,\
38923892
\ the episode is considered unavailable for the client.*"
3893-
required: true
3893+
required: false
38943894
schema:
38953895
type: string
38963896
- name: fields

spotify-web-api-parser/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
<parent>
88
<groupId>de.sonallux.spotify</groupId>
99
<artifactId>spotify-web-api-parent</artifactId>
10-
<version>2021.6.30</version>
10+
<version>2021.7.20</version>
1111
<relativePath>../pom.xml</relativePath>
1212
</parent>
1313

1414
<artifactId>spotify-web-api-parser</artifactId>
15-
<version>2021.6.30</version>
15+
<version>2021.7.20</version>
1616
<packaging>jar</packaging>
1717

1818
<name>spotify-web-api-parser</name>
@@ -29,7 +29,7 @@
2929
<dependency>
3030
<groupId>de.sonallux.spotify</groupId>
3131
<artifactId>spotify-web-api-core</artifactId>
32-
<version>2021.6.30</version>
32+
<version>2021.7.20</version>
3333
</dependency>
3434
<dependency>
3535
<groupId>org.jsoup</groupId>

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ static void fixApiEndpoints(SortedMap<String, SpotifyWebApiCategory> categories)
2121
fixReplaceAndReorderPlaylistTrackUrisParameter(categories);
2222
fixSaveShowsForCurrentUserBodyParameter(categories);
2323
fixRemoveUsersSavedShowsBodyParameter(categories);
24+
fixPlaylistsItemsRequireParameter(categories);
2425
}
2526

2627
private static void fixChangePlaylistsDetails(SortedMap<String, SpotifyWebApiCategory> categories) {
@@ -182,4 +183,18 @@ private static void fixRemoveUsersSavedShowsBodyParameter(SortedMap<String, Spot
182183
"Array[String]",
183184
false));
184185
}
186+
187+
private static void fixPlaylistsItemsRequireParameter(SortedMap<String, SpotifyWebApiCategory> categories) {
188+
var endpoint = categories.get("category-playlists")
189+
.getEndpoints().get("endpoint-get-playlists-tracks");
190+
191+
var marketParameter = endpoint.getParameters().stream()
192+
.filter(param -> "market".equals(param.getName()) && param.isRequired())
193+
.findFirst().orElse(null);
194+
if (marketParameter == null) {
195+
log.warn("Market parameter for endpoint-get-playlists-tracks has been fixed");
196+
return;
197+
}
198+
marketParameter.setRequired(false);
199+
}
185200
}

0 commit comments

Comments
 (0)