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][RestTemplate] Prevent conflicts with accept(s) local variables #7101

Merged
merged 2 commits into from
Aug 4, 2020
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 @@ -134,19 +134,19 @@ public class {{classname}} {
formParams.{{^collectionFormat}}add{{/collectionFormat}}{{#collectionFormat}}put{{/collectionFormat}}("{{baseName}}", {{#isFile}}{{^collectionFormat}}{{#useAbstractionForFiles}}{{paramName}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}new FileSystemResource({{paramName}}){{/useAbstractionForFiles}}{{/collectionFormat}}{{/isFile}}{{#isFile}}{{#collectionFormat}}{{paramName}}.stream(){{^useAbstractionForFiles}}.map(FileSystemResource::new){{/useAbstractionForFiles}}.collect(Collectors.toList()){{/collectionFormat}}{{/isFile}}{{^isFile}}{{paramName}}{{/isFile}});{{#hasMore}}
{{/hasMore}}{{/formParams}}{{/hasFormParams}}

final String[] accepts = { {{#hasProduces}}
final String[] localVarAccepts = { {{#hasProduces}}
{{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}}
{{/hasProduces}}};
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
{{/hasProduces}} };
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] contentTypes = { {{#hasConsumes}}
{{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}}
{{/hasConsumes}}};
{{/hasConsumes}} };
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

String[] authNames = new String[] { {{#authMethods}}"{{name}}"{{#hasMore}}, {{/hasMore}}{{/authMethods}} };

{{#returnType}}ParameterizedTypeReference<{{{returnType}}}> returnType = new ParameterizedTypeReference<{{{returnType}}}>() {};{{/returnType}}{{^returnType}}ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};{{/returnType}}
return apiClient.invokeAPI(path, HttpMethod.{{httpMethod}}, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
return apiClient.invokeAPI(path, HttpMethod.{{httpMethod}}, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, contentType, authNames, returnType);
}
{{/operation}}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,18 @@ public ResponseEntity<Client> call123testSpecialTagsWithHttpInfo(Client body) th
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
final MultiValueMap formParams = new LinkedMultiValueMap();

final String[] accepts = {
final String[] localVarAccepts = {
"application/json"
};
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
};
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] contentTypes = {
"application/json"
};
};
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

String[] authNames = new String[] { };

ParameterizedTypeReference<Client> returnType = new ParameterizedTypeReference<Client>() {};
return apiClient.invokeAPI(path, HttpMethod.PATCH, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
return apiClient.invokeAPI(path, HttpMethod.PATCH, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, contentType, authNames, returnType);
}
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,18 @@ public ResponseEntity<Client> testClassnameWithHttpInfo(Client body) throws Rest
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
final MultiValueMap formParams = new LinkedMultiValueMap();

final String[] accepts = {
final String[] localVarAccepts = {
"application/json"
};
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
};
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] contentTypes = {
"application/json"
};
};
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

String[] authNames = new String[] { "api_key_query" };

ParameterizedTypeReference<Client> returnType = new ParameterizedTypeReference<Client>() {};
return apiClient.invokeAPI(path, HttpMethod.PATCH, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
return apiClient.invokeAPI(path, HttpMethod.PATCH, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, contentType, authNames, returnType);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,17 @@ public ResponseEntity<Void> addPetWithHttpInfo(Pet body) throws RestClientExcept
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
final MultiValueMap formParams = new LinkedMultiValueMap();

final String[] accepts = { };
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] localVarAccepts = { };
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] contentTypes = {
"application/json", "application/xml"
};
};
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

String[] authNames = new String[] { "petstore_auth" };

ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, contentType, authNames, returnType);
}
/**
* Deletes a pet
Expand Down Expand Up @@ -144,15 +144,15 @@ public ResponseEntity<Void> deletePetWithHttpInfo(Long petId, String apiKey) thr
if (apiKey != null)
headerParams.add("api_key", apiClient.parameterToString(apiKey));

final String[] accepts = { };
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = { };
final String[] localVarAccepts = { };
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] contentTypes = { };
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

String[] authNames = new String[] { "petstore_auth" };

ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI(path, HttpMethod.DELETE, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
return apiClient.invokeAPI(path, HttpMethod.DELETE, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, contentType, authNames, returnType);
}
/**
* Finds Pets by status
Expand Down Expand Up @@ -193,17 +193,17 @@ public ResponseEntity<List<Pet>> findPetsByStatusWithHttpInfo(List<String> statu

queryParams.putAll(apiClient.parameterToMultiValueMap(ApiClient.CollectionFormat.valueOf("csv".toUpperCase(Locale.ROOT)), "status", status));

final String[] accepts = {
final String[] localVarAccepts = {
"application/xml", "application/json"
};
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = { };
};
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] contentTypes = { };
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

String[] authNames = new String[] { "petstore_auth" };

ParameterizedTypeReference<List<Pet>> returnType = new ParameterizedTypeReference<List<Pet>>() {};
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, contentType, authNames, returnType);
}
/**
* Finds Pets by tags
Expand Down Expand Up @@ -246,17 +246,17 @@ public ResponseEntity<Set<Pet>> findPetsByTagsWithHttpInfo(Set<String> tags) thr

queryParams.putAll(apiClient.parameterToMultiValueMap(ApiClient.CollectionFormat.valueOf("csv".toUpperCase(Locale.ROOT)), "tags", tags));

final String[] accepts = {
final String[] localVarAccepts = {
"application/xml", "application/json"
};
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = { };
};
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] contentTypes = { };
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

String[] authNames = new String[] { "petstore_auth" };

ParameterizedTypeReference<Set<Pet>> returnType = new ParameterizedTypeReference<Set<Pet>>() {};
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, contentType, authNames, returnType);
}
/**
* Find pet by ID
Expand Down Expand Up @@ -300,17 +300,17 @@ public ResponseEntity<Pet> getPetByIdWithHttpInfo(Long petId) throws RestClientE
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
final MultiValueMap formParams = new LinkedMultiValueMap();

final String[] accepts = {
final String[] localVarAccepts = {
"application/xml", "application/json"
};
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = { };
};
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] contentTypes = { };
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

String[] authNames = new String[] { "api_key" };

ParameterizedTypeReference<Pet> returnType = new ParameterizedTypeReference<Pet>() {};
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, contentType, authNames, returnType);
}
/**
* Update an existing pet
Expand Down Expand Up @@ -352,17 +352,17 @@ public ResponseEntity<Void> updatePetWithHttpInfo(Pet body) throws RestClientExc
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
final MultiValueMap formParams = new LinkedMultiValueMap();

final String[] accepts = { };
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] localVarAccepts = { };
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] contentTypes = {
"application/json", "application/xml"
};
};
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

String[] authNames = new String[] { "petstore_auth" };

ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI(path, HttpMethod.PUT, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
return apiClient.invokeAPI(path, HttpMethod.PUT, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, contentType, authNames, returnType);
}
/**
* Updates a pet in the store with form data
Expand Down Expand Up @@ -410,17 +410,17 @@ public ResponseEntity<Void> updatePetWithFormWithHttpInfo(Long petId, String nam
if (status != null)
formParams.add("status", status);

final String[] accepts = { };
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] localVarAccepts = { };
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] contentTypes = {
"application/x-www-form-urlencoded"
};
};
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

String[] authNames = new String[] { "petstore_auth" };

ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, contentType, authNames, returnType);
}
/**
* uploads an image
Expand Down Expand Up @@ -469,19 +469,19 @@ public ResponseEntity<ModelApiResponse> uploadFileWithHttpInfo(Long petId, Strin
if (file != null)
formParams.add("file", new FileSystemResource(file));

final String[] accepts = {
final String[] localVarAccepts = {
"application/json"
};
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
};
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] contentTypes = {
"multipart/form-data"
};
};
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

String[] authNames = new String[] { "petstore_auth" };

ParameterizedTypeReference<ModelApiResponse> returnType = new ParameterizedTypeReference<ModelApiResponse>() {};
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, contentType, authNames, returnType);
}
/**
* uploads an image (required)
Expand Down Expand Up @@ -535,18 +535,18 @@ public ResponseEntity<ModelApiResponse> uploadFileWithRequiredFileWithHttpInfo(L
if (requiredFile != null)
formParams.add("requiredFile", new FileSystemResource(requiredFile));

final String[] accepts = {
final String[] localVarAccepts = {
"application/json"
};
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
};
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] contentTypes = {
"multipart/form-data"
};
};
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

String[] authNames = new String[] { "petstore_auth" };

ParameterizedTypeReference<ModelApiResponse> returnType = new ParameterizedTypeReference<ModelApiResponse>() {};
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, contentType, authNames, returnType);
}
}
Loading