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

[Android] Fix compilation errors when there's no model defined #1438

Merged
merged 2 commits into from
Nov 14, 2018
Merged
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
@@ -523,6 +523,12 @@ public int compare(CodegenOperation one, CodegenOperation another) {
operation.put("importPath", config.toApiImport(tag));
operation.put("classFilename", config.toApiFilename(tag));

if (allModels == null || allModels.isEmpty()) {
operation.put("hasModel", false);
} else {
operation.put("hasModel", true);
}

if (!config.vendorExtensions().isEmpty()) {
operation.put("vendorExtensions", config.vendorExtensions());
}
Original file line number Diff line number Diff line change
@@ -5,7 +5,9 @@ import {{invokerPackage}}.ApiException;
import {{invokerPackage}}.ApiInvoker;
import {{invokerPackage}}.Pair;

{{#hasModel}}
import {{modelPackage}}.*;
{{/hasModel}}

import java.util.*;

Original file line number Diff line number Diff line change
@@ -5,7 +5,9 @@ import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.List;
{{#hasModel}}
import {{modelPackage}}.*;
{{/hasModel}}

public class JsonUtil {
public static GsonBuilder gsonBuilder;
Original file line number Diff line number Diff line change
@@ -5,7 +5,9 @@ import {{invokerPackage}}.ApiInvoker;
import {{invokerPackage}}.ApiException;
import {{invokerPackage}}.Pair;

{{#hasModel}}
import {{modelPackage}}.*;
{{/hasModel}}

import java.util.*;

Original file line number Diff line number Diff line change
@@ -11,7 +11,9 @@ import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.List;
import java.util.Date;
{{#models.0}}
import {{modelPackage}}.*;
{{/models.0}}

public class JsonUtil {
public static GsonBuilder gsonBuilder;
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.0-SNAPSHOT
3.3.3-SNAPSHOT
36 changes: 18 additions & 18 deletions samples/client/petstore/android/httpclient/docs/PetApi.md
Original file line number Diff line number Diff line change
@@ -66,8 +66,8 @@ Deletes a pet
//import org.openapitools.client.api.PetApi;

PetApi apiInstance = new PetApi();
Long petId = 56L; // Long | Pet id to delete
String apiKey = "apiKey_example"; // String |
Long petId = null; // Long | Pet id to delete
String apiKey = null; // String |
try {
apiInstance.deletePet(petId, apiKey);
} catch (ApiException e) {
@@ -80,8 +80,8 @@ try {

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**petId** | **Long**| Pet id to delete |
**apiKey** | **String**| | [optional]
**petId** | **Long**| Pet id to delete | [default to null]
**apiKey** | **String**| | [optional] [default to null]

### Return type

@@ -110,7 +110,7 @@ Multiple status values can be provided with comma separated strings
//import org.openapitools.client.api.PetApi;

PetApi apiInstance = new PetApi();
List<String> status = Arrays.asList("status_example"); // List<String> | Status values that need to be considered for filter
List<String> status = null; // List<String> | Status values that need to be considered for filter
try {
List<Pet> result = apiInstance.findPetsByStatus(status);
System.out.println(result);
@@ -124,7 +124,7 @@ try {

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**status** | [**List&lt;String&gt;**](String.md)| Status values that need to be considered for filter | [enum: available, pending, sold]
**status** | [**List&lt;String&gt;**](String.md)| Status values that need to be considered for filter | [default to null] [enum: available, pending, sold]

### Return type

@@ -153,7 +153,7 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3
//import org.openapitools.client.api.PetApi;

PetApi apiInstance = new PetApi();
List<String> tags = Arrays.asList("tags_example"); // List<String> | Tags to filter by
List<String> tags = null; // List<String> | Tags to filter by
try {
List<Pet> result = apiInstance.findPetsByTags(tags);
System.out.println(result);
@@ -167,7 +167,7 @@ try {

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**tags** | [**List&lt;String&gt;**](String.md)| Tags to filter by |
**tags** | [**List&lt;String&gt;**](String.md)| Tags to filter by | [default to null]

### Return type

@@ -196,7 +196,7 @@ Returns a single pet
//import org.openapitools.client.api.PetApi;

PetApi apiInstance = new PetApi();
Long petId = 56L; // Long | ID of pet to return
Long petId = null; // Long | ID of pet to return
try {
Pet result = apiInstance.getPetById(petId);
System.out.println(result);
@@ -210,7 +210,7 @@ try {

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**petId** | **Long**| ID of pet to return |
**petId** | **Long**| ID of pet to return | [default to null]

### Return type

@@ -277,9 +277,9 @@ Updates a pet in the store with form data
//import org.openapitools.client.api.PetApi;

PetApi apiInstance = new PetApi();
Long petId = 56L; // Long | ID of pet that needs to be updated
String name = "null"; // String | Updated name of the pet
String status = "null"; // String | Updated status of the pet
Long petId = null; // Long | ID of pet that needs to be updated
String name = null; // String | Updated name of the pet
String status = null; // String | Updated status of the pet
try {
apiInstance.updatePetWithForm(petId, name, status);
} catch (ApiException e) {
@@ -292,7 +292,7 @@ try {

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**petId** | **Long**| ID of pet that needs to be updated |
**petId** | **Long**| ID of pet that needs to be updated | [default to null]
**name** | **String**| Updated name of the pet | [optional] [default to null]
**status** | **String**| Updated status of the pet | [optional] [default to null]

@@ -321,9 +321,9 @@ uploads an image
//import org.openapitools.client.api.PetApi;

PetApi apiInstance = new PetApi();
Long petId = 56L; // Long | ID of pet to update
String additionalMetadata = "null"; // String | Additional data to pass to server
File file = new File("null"); // File | file to upload
Long petId = null; // Long | ID of pet to update
String additionalMetadata = null; // String | Additional data to pass to server
File file = null; // File | file to upload
try {
ApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file);
System.out.println(result);
@@ -337,7 +337,7 @@ try {

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**petId** | **Long**| ID of pet to update |
**petId** | **Long**| ID of pet to update | [default to null]
**additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null]
**file** | **File**| file to upload | [optional] [default to null]

8 changes: 4 additions & 4 deletions samples/client/petstore/android/httpclient/docs/StoreApi.md
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ For valid response try integer IDs with value &lt; 1000. Anything above 1000 or
//import org.openapitools.client.api.StoreApi;

StoreApi apiInstance = new StoreApi();
String orderId = "orderId_example"; // String | ID of the order that needs to be deleted
String orderId = null; // String | ID of the order that needs to be deleted
try {
apiInstance.deleteOrder(orderId);
} catch (ApiException e) {
@@ -37,7 +37,7 @@ try {

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**orderId** | **String**| ID of the order that needs to be deleted |
**orderId** | **String**| ID of the order that needs to be deleted | [default to null]

### Return type

@@ -105,7 +105,7 @@ For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other val
//import org.openapitools.client.api.StoreApi;

StoreApi apiInstance = new StoreApi();
Long orderId = 56L; // Long | ID of pet that needs to be fetched
Long orderId = null; // Long | ID of pet that needs to be fetched
try {
Order result = apiInstance.getOrderById(orderId);
System.out.println(result);
@@ -119,7 +119,7 @@ try {

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**orderId** | **Long**| ID of pet that needs to be fetched |
**orderId** | **Long**| ID of pet that needs to be fetched | [default to null]

### Return type

20 changes: 10 additions & 10 deletions samples/client/petstore/android/httpclient/docs/UserApi.md
Original file line number Diff line number Diff line change
@@ -150,7 +150,7 @@ This can only be done by the logged in user.
//import org.openapitools.client.api.UserApi;

UserApi apiInstance = new UserApi();
String username = "username_example"; // String | The name that needs to be deleted
String username = null; // String | The name that needs to be deleted
try {
apiInstance.deleteUser(username);
} catch (ApiException e) {
@@ -163,7 +163,7 @@ try {

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**username** | **String**| The name that needs to be deleted |
**username** | **String**| The name that needs to be deleted | [default to null]

### Return type

@@ -190,7 +190,7 @@ Get user by user name
//import org.openapitools.client.api.UserApi;

UserApi apiInstance = new UserApi();
String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing.
String username = null; // String | The name that needs to be fetched. Use user1 for testing.
try {
User result = apiInstance.getUserByName(username);
System.out.println(result);
@@ -204,7 +204,7 @@ try {

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**username** | **String**| The name that needs to be fetched. Use user1 for testing. |
**username** | **String**| The name that needs to be fetched. Use user1 for testing. | [default to null]

### Return type

@@ -231,8 +231,8 @@ Logs user into the system
//import org.openapitools.client.api.UserApi;

UserApi apiInstance = new UserApi();
String username = "username_example"; // String | The user name for login
String password = "password_example"; // String | The password for login in clear text
String username = null; // String | The user name for login
String password = null; // String | The password for login in clear text
try {
String result = apiInstance.loginUser(username, password);
System.out.println(result);
@@ -246,8 +246,8 @@ try {

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**username** | **String**| The user name for login |
**password** | **String**| The password for login in clear text |
**username** | **String**| The user name for login | [default to null]
**password** | **String**| The password for login in clear text | [default to null]

### Return type

@@ -312,7 +312,7 @@ This can only be done by the logged in user.
//import org.openapitools.client.api.UserApi;

UserApi apiInstance = new UserApi();
String username = "username_example"; // String | name that need to be deleted
String username = null; // String | name that need to be deleted
User user = new User(); // User | Updated user object
try {
apiInstance.updateUser(username, user);
@@ -326,7 +326,7 @@ try {

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**username** | **String**| name that need to be deleted |
**username** | **String**| name that need to be deleted | [default to null]
**user** | [**User**](User.md)| Updated user object |

### Return type
Original file line number Diff line number Diff line change
@@ -5,7 +5,6 @@
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.List;
import org.openapitools.client.model.*;

public class JsonUtil {
public static GsonBuilder gsonBuilder;
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.0-SNAPSHOT
3.3.3-SNAPSHOT
Loading