Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JAVA] Address [rawtypes] and [this-escape] warnings in generated API clients #20466

Merged
merged 2 commits into from
Jan 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
* @param value The value of the parameter.
* @return A list of {@code Pair} objects.
*/
public List<Pair> parameterToPairs(String collectionFormat, String name, Collection value) {
public List<Pair> parameterToPairs(String collectionFormat, String name, Collection<?> value) {
List<Pair> params = new ArrayList<Pair>();

// preconditions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public class ApiClient {
asyncResponseInterceptor = null;
}

protected ObjectMapper createDefaultObjectMapper() {
public static ObjectMapper createDefaultObjectMapper() {
ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
Expand All @@ -199,11 +199,11 @@ public class ApiClient {
return mapper;
}

protected String getDefaultBaseUri() {
private String getDefaultBaseUri() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generally i'm ok with the PR but if later users have a use case that need protected method here for example, we will need to provide a way to fallback.

return "{{{basePath}}}";
}

protected HttpClient.Builder createDefaultHttpClientBuilder() {
public static HttpClient.Builder createDefaultHttpClientBuilder() {
return HttpClient.newBuilder();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ public List<Pair> parameterToPair(String name, Object value) {
* @param value The value of the parameter.
* @return A list of {@code Pair} objects.
*/
public List<Pair> parameterToPairs(String collectionFormat, String name, Collection value) {
public List<Pair> parameterToPairs(String collectionFormat, String name, Collection<?> value) {
List<Pair> params = new ArrayList<Pair>();

// preconditions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public ApiClient(HttpClient.Builder builder, ObjectMapper mapper, String baseUri
asyncResponseInterceptor = null;
}

protected ObjectMapper createDefaultObjectMapper() {
public static ObjectMapper createDefaultObjectMapper() {
ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
Expand All @@ -206,11 +206,11 @@ protected ObjectMapper createDefaultObjectMapper() {
return mapper;
}

protected String getDefaultBaseUri() {
private String getDefaultBaseUri() {
return "http://localhost:3000";
}

protected HttpClient.Builder createDefaultHttpClientBuilder() {
public static HttpClient.Builder createDefaultHttpClientBuilder() {
return HttpClient.newBuilder();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ public List<Pair> parameterToPair(String name, Object value) {
* @param value The value of the parameter.
* @return A list of {@code Pair} objects.
*/
public List<Pair> parameterToPairs(String collectionFormat, String name, Collection value) {
public List<Pair> parameterToPairs(String collectionFormat, String name, Collection<?> value) {
List<Pair> params = new ArrayList<Pair>();

// preconditions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public ApiClient(HttpClient.Builder builder, ObjectMapper mapper, String baseUri
asyncResponseInterceptor = null;
}

protected ObjectMapper createDefaultObjectMapper() {
public static ObjectMapper createDefaultObjectMapper() {
ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
Expand All @@ -206,11 +206,11 @@ protected ObjectMapper createDefaultObjectMapper() {
return mapper;
}

protected String getDefaultBaseUri() {
private String getDefaultBaseUri() {
return "http://petstore.swagger.io:80/v2";
}

protected HttpClient.Builder createDefaultHttpClientBuilder() {
public static HttpClient.Builder createDefaultHttpClientBuilder() {
return HttpClient.newBuilder();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public ApiClient(HttpClient.Builder builder, ObjectMapper mapper, String baseUri
asyncResponseInterceptor = null;
}

protected ObjectMapper createDefaultObjectMapper() {
public static ObjectMapper createDefaultObjectMapper() {
ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
Expand All @@ -206,11 +206,11 @@ protected ObjectMapper createDefaultObjectMapper() {
return mapper;
}

protected String getDefaultBaseUri() {
private String getDefaultBaseUri() {
return "http://petstore.swagger.io/v2";
}

protected HttpClient.Builder createDefaultHttpClientBuilder() {
public static HttpClient.Builder createDefaultHttpClientBuilder() {
return HttpClient.newBuilder();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public ApiClient(HttpClient.Builder builder, ObjectMapper mapper, String baseUri
asyncResponseInterceptor = null;
}

protected ObjectMapper createDefaultObjectMapper() {
public static ObjectMapper createDefaultObjectMapper() {
ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
Expand All @@ -206,11 +206,11 @@ protected ObjectMapper createDefaultObjectMapper() {
return mapper;
}

protected String getDefaultBaseUri() {
private String getDefaultBaseUri() {
return "http://petstore.swagger.io:80/v2";
}

protected HttpClient.Builder createDefaultHttpClientBuilder() {
public static HttpClient.Builder createDefaultHttpClientBuilder() {
return HttpClient.newBuilder();
}

Expand Down
Loading