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][Client][RestTemplate] Do not create new Object for empty body #605

Merged
merged 2 commits into from
Jul 20, 2018
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 @@ -61,7 +61,7 @@ public class {{classname}} {
{{/externalDocs}}
*/
public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws RestClientException {
Object {{localVariablePrefix}}postBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}new Object(){{/bodyParam}};
Object {{localVariablePrefix}}postBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}};
{{#allParams}}{{#required}}
// verify the required parameter '{{paramName}}' is set
if ({{paramName}} == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ public Client testClientModel(Client client) throws RestClientException {
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public void testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws RestClientException {
Object postBody = new Object();
Object postBody = null;

// verify the required parameter 'number' is set
if (number == null) {
Expand Down Expand Up @@ -385,7 +385,7 @@ public void testEndpointParameters(BigDecimal number, Double _double, String pat
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public void testEnumParameters(List<String> enumHeaderStringArray, String enumHeaderString, List<String> enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List<String> enumFormStringArray, String enumFormString) throws RestClientException {
Object postBody = new Object();
Object postBody = null;

String path = UriComponentsBuilder.fromPath("/fake").build().toUriString();

Expand Down Expand Up @@ -462,7 +462,7 @@ public void testInlineAdditionalProperties(Map<String, String> requestBody) thro
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public void testJsonFormData(String param, String param2) throws RestClientException {
Object postBody = new Object();
Object postBody = null;

// verify the required parameter 'param' is set
if (param == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public void addPet(Pet pet) throws RestClientException {
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public void deletePet(Long petId, String apiKey) throws RestClientException {
Object postBody = new Object();
Object postBody = null;

// verify the required parameter 'petId' is set
if (petId == null) {
Expand Down Expand Up @@ -128,7 +128,7 @@ public void deletePet(Long petId, String apiKey) throws RestClientException {
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public List<Pet> findPetsByStatus(List<String> status) throws RestClientException {
Object postBody = new Object();
Object postBody = null;

// verify the required parameter 'status' is set
if (status == null) {
Expand Down Expand Up @@ -165,7 +165,7 @@ public List<Pet> findPetsByStatus(List<String> status) throws RestClientExceptio
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public List<Pet> findPetsByTags(List<String> tags) throws RestClientException {
Object postBody = new Object();
Object postBody = null;

// verify the required parameter 'tags' is set
if (tags == null) {
Expand Down Expand Up @@ -203,7 +203,7 @@ public List<Pet> findPetsByTags(List<String> tags) throws RestClientException {
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public Pet getPetById(Long petId) throws RestClientException {
Object postBody = new Object();
Object postBody = null;

// verify the required parameter 'petId' is set
if (petId == null) {
Expand Down Expand Up @@ -276,7 +276,7 @@ public void updatePet(Pet pet) throws RestClientException {
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public void updatePetWithForm(Long petId, String name, String status) throws RestClientException {
Object postBody = new Object();
Object postBody = null;

// verify the required parameter 'petId' is set
if (petId == null) {
Expand Down Expand Up @@ -320,7 +320,7 @@ public void updatePetWithForm(Long petId, String name, String status) throws Res
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File file) throws RestClientException {
Object postBody = new Object();
Object postBody = null;

// verify the required parameter 'petId' is set
if (petId == null) {
Expand Down Expand Up @@ -366,7 +366,7 @@ public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File f
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public ModelApiResponse uploadFileWithRequiredFile(Long petId, File requiredFile, String additionalMetadata) throws RestClientException {
Object postBody = new Object();
Object postBody = null;

// verify the required parameter 'petId' is set
if (petId == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void setApiClient(ApiClient apiClient) {
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public void deleteOrder(String orderId) throws RestClientException {
Object postBody = new Object();
Object postBody = null;

// verify the required parameter 'orderId' is set
if (orderId == null) {
Expand Down Expand Up @@ -88,7 +88,7 @@ public void deleteOrder(String orderId) throws RestClientException {
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public Map<String, Integer> getInventory() throws RestClientException {
Object postBody = new Object();
Object postBody = null;

String path = UriComponentsBuilder.fromPath("/store/inventory").build().toUriString();

Expand Down Expand Up @@ -119,7 +119,7 @@ public Map<String, Integer> getInventory() throws RestClientException {
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public Order getOrderById(Long orderId) throws RestClientException {
Object postBody = new Object();
Object postBody = null;

// verify the required parameter 'orderId' is set
if (orderId == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public void createUsersWithListInput(List<User> user) throws RestClientException
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public void deleteUser(String username) throws RestClientException {
Object postBody = new Object();
Object postBody = null;

// verify the required parameter 'username' is set
if (username == null) {
Expand Down Expand Up @@ -184,7 +184,7 @@ public void deleteUser(String username) throws RestClientException {
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public User getUserByName(String username) throws RestClientException {
Object postBody = new Object();
Object postBody = null;

// verify the required parameter 'username' is set
if (username == null) {
Expand Down Expand Up @@ -223,7 +223,7 @@ public User getUserByName(String username) throws RestClientException {
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public String loginUser(String username, String password) throws RestClientException {
Object postBody = new Object();
Object postBody = null;

// verify the required parameter 'username' is set
if (username == null) {
Expand Down Expand Up @@ -263,7 +263,7 @@ public String loginUser(String username, String password) throws RestClientExcep
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public void logoutUser() throws RestClientException {
Object postBody = new Object();
Object postBody = null;

String path = UriComponentsBuilder.fromPath("/user/logout").build().toUriString();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ public Client testClientModel(Client client) throws RestClientException {
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public void testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws RestClientException {
Object postBody = new Object();
Object postBody = null;

// verify the required parameter 'number' is set
if (number == null) {
Expand Down Expand Up @@ -385,7 +385,7 @@ public void testEndpointParameters(BigDecimal number, Double _double, String pat
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public void testEnumParameters(List<String> enumHeaderStringArray, String enumHeaderString, List<String> enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List<String> enumFormStringArray, String enumFormString) throws RestClientException {
Object postBody = new Object();
Object postBody = null;

String path = UriComponentsBuilder.fromPath("/fake").build().toUriString();

Expand Down Expand Up @@ -462,7 +462,7 @@ public void testInlineAdditionalProperties(Map<String, String> requestBody) thro
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public void testJsonFormData(String param, String param2) throws RestClientException {
Object postBody = new Object();
Object postBody = null;

// verify the required parameter 'param' is set
if (param == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public void addPet(Pet pet) throws RestClientException {
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public void deletePet(Long petId, String apiKey) throws RestClientException {
Object postBody = new Object();
Object postBody = null;

// verify the required parameter 'petId' is set
if (petId == null) {
Expand Down Expand Up @@ -128,7 +128,7 @@ public void deletePet(Long petId, String apiKey) throws RestClientException {
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public List<Pet> findPetsByStatus(List<String> status) throws RestClientException {
Object postBody = new Object();
Object postBody = null;

// verify the required parameter 'status' is set
if (status == null) {
Expand Down Expand Up @@ -165,7 +165,7 @@ public List<Pet> findPetsByStatus(List<String> status) throws RestClientExceptio
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public List<Pet> findPetsByTags(List<String> tags) throws RestClientException {
Object postBody = new Object();
Object postBody = null;

// verify the required parameter 'tags' is set
if (tags == null) {
Expand Down Expand Up @@ -203,7 +203,7 @@ public List<Pet> findPetsByTags(List<String> tags) throws RestClientException {
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public Pet getPetById(Long petId) throws RestClientException {
Object postBody = new Object();
Object postBody = null;

// verify the required parameter 'petId' is set
if (petId == null) {
Expand Down Expand Up @@ -276,7 +276,7 @@ public void updatePet(Pet pet) throws RestClientException {
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public void updatePetWithForm(Long petId, String name, String status) throws RestClientException {
Object postBody = new Object();
Object postBody = null;

// verify the required parameter 'petId' is set
if (petId == null) {
Expand Down Expand Up @@ -320,7 +320,7 @@ public void updatePetWithForm(Long petId, String name, String status) throws Res
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File file) throws RestClientException {
Object postBody = new Object();
Object postBody = null;

// verify the required parameter 'petId' is set
if (petId == null) {
Expand Down Expand Up @@ -366,7 +366,7 @@ public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File f
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public ModelApiResponse uploadFileWithRequiredFile(Long petId, File requiredFile, String additionalMetadata) throws RestClientException {
Object postBody = new Object();
Object postBody = null;

// verify the required parameter 'petId' is set
if (petId == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void setApiClient(ApiClient apiClient) {
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public void deleteOrder(String orderId) throws RestClientException {
Object postBody = new Object();
Object postBody = null;

// verify the required parameter 'orderId' is set
if (orderId == null) {
Expand Down Expand Up @@ -88,7 +88,7 @@ public void deleteOrder(String orderId) throws RestClientException {
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public Map<String, Integer> getInventory() throws RestClientException {
Object postBody = new Object();
Object postBody = null;

String path = UriComponentsBuilder.fromPath("/store/inventory").build().toUriString();

Expand Down Expand Up @@ -119,7 +119,7 @@ public Map<String, Integer> getInventory() throws RestClientException {
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public Order getOrderById(Long orderId) throws RestClientException {
Object postBody = new Object();
Object postBody = null;

// verify the required parameter 'orderId' is set
if (orderId == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public void createUsersWithListInput(List<User> user) throws RestClientException
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public void deleteUser(String username) throws RestClientException {
Object postBody = new Object();
Object postBody = null;

// verify the required parameter 'username' is set
if (username == null) {
Expand Down Expand Up @@ -184,7 +184,7 @@ public void deleteUser(String username) throws RestClientException {
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public User getUserByName(String username) throws RestClientException {
Object postBody = new Object();
Object postBody = null;

// verify the required parameter 'username' is set
if (username == null) {
Expand Down Expand Up @@ -223,7 +223,7 @@ public User getUserByName(String username) throws RestClientException {
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public String loginUser(String username, String password) throws RestClientException {
Object postBody = new Object();
Object postBody = null;

// verify the required parameter 'username' is set
if (username == null) {
Expand Down Expand Up @@ -263,7 +263,7 @@ public String loginUser(String username, String password) throws RestClientExcep
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public void logoutUser() throws RestClientException {
Object postBody = new Object();
Object postBody = null;

String path = UriComponentsBuilder.fromPath("/user/logout").build().toUriString();

Expand Down