Skip to content

Commit 76af4e8

Browse files
authored
fix: type parameter of search request is encoded incorrectly (#329)
1 parent 40bb20d commit 76af4e8

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

spotify-web-api-java-generator/src/main/java/de/sonallux/spotify/generator/java/model/ApiEndpoint.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,15 @@ public static class Parameter {
7070
private final String name;
7171
private final String javaName;
7272
private String type;
73+
private boolean commaSeparatedListType;
7374
private String description;
7475
private String defaultValue;
7576

7677
public Parameter(String name, String type, String description) {
7778
this.name = name;
7879
this.javaName = JavaUtils.escapeFieldName(name);
7980
this.type = type;
81+
this.commaSeparatedListType = "java.util.List<String>".equals(type);
8082
this.description = Markdown2Html.convertToSingleLine(description);
8183
this.defaultValue = null;
8284
}

spotify-web-api-java-generator/src/main/resources/templates/request.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class {{className}} {
4040
.addPathParameter("{{name}}", String.valueOf({{javaName}}))
4141
{{/requiredPathParameters}}
4242
{{#requiredQueryParameters}}
43-
.addQueryParameter("{{name}}", String.valueOf({{javaName}}))
43+
.addQueryParameter("{{name}}", {{#commaSeparatedListType}}String.join(",", {{javaName}}){{/commaSeparatedListType}}{{^commaSeparatedListType}}String.valueOf({{javaName}}){{/commaSeparatedListType}})
4444
{{/requiredQueryParameters}}
4545
{{#requiredBodyParameters}}
4646
.addBodyParameter("{{name}}", {{javaName}})

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public SearchRequest(ApiClient apiClient, String q, java.util.List<String> type)
2727
this.apiClient = apiClient;
2828
this.request = new Request("GET", "/search")
2929
.addQueryParameter("q", String.valueOf(q))
30-
.addQueryParameter("type", String.valueOf(type))
30+
.addQueryParameter("type", String.join(",", type))
3131
;
3232
}
3333

0 commit comments

Comments
 (0)