fixed required parameter in java api

This commit is contained in:
wing328 2015-04-29 17:31:38 +08:00
parent 6c23a21312
commit fb3088b765
4 changed files with 50 additions and 5 deletions

View File

@ -45,12 +45,12 @@ public class {{classname}} {
*/
public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{nickname}} ({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException {
Object postBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}};
{{#requiredParamCount}}
// verify required params are set
if({{/requiredParamCount}}{{#requiredParams}} {{paramName}} == null {{#hasMore}}|| {{/hasMore}}{{/requiredParams}}{{#requiredParamCount}}) {
throw new ApiException(400, "missing required params");
{{#allParams}}{{#required}}
// verify the required parameter '{{paramName}}' is set
if ({{paramName}} == null) {
throw new ApiException(400, "Missing the required parameter '{{paramName}}' when calling {{nickname}}");
}
{{/requiredParamCount}}
{{/required}}{{/allParams}}
// create path and map variables
String path = "{{path}}".replaceAll("\\{format\\}","json"){{#pathParams}}

View File

@ -249,6 +249,11 @@ public class PetApi {
public Pet getPetById (Long petId) throws ApiException {
Object postBody = null;
// verify the required parameter 'petId' is set
if (petId == null) {
throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetById");
}
// create path and map variables
String path = "/pet/{petId}".replaceAll("\\{format\\}","json")
@ -302,6 +307,11 @@ public class PetApi {
public void updatePetWithForm (String petId, String name, String status) throws ApiException {
Object postBody = null;
// verify the required parameter 'petId' is set
if (petId == null) {
throw new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm");
}
// create path and map variables
String path = "/pet/{petId}".replaceAll("\\{format\\}","json")
@ -362,6 +372,11 @@ public class PetApi {
public void deletePet (String apiKey, Long petId) throws ApiException {
Object postBody = null;
// verify the required parameter 'petId' is set
if (petId == null) {
throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet");
}
// create path and map variables
String path = "/pet/{petId}".replaceAll("\\{format\\}","json")
@ -416,6 +431,11 @@ public class PetApi {
public void uploadFile (Long petId, String additionalMetadata, File file) throws ApiException {
Object postBody = null;
// verify the required parameter 'petId' is set
if (petId == null) {
throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile");
}
// create path and map variables
String path = "/pet/{petId}/uploadImage".replaceAll("\\{format\\}","json")

View File

@ -144,6 +144,11 @@ public class StoreApi {
public Order getOrderById (String orderId) throws ApiException {
Object postBody = null;
// verify the required parameter 'orderId' is set
if (orderId == null) {
throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById");
}
// create path and map variables
String path = "/store/order/{orderId}".replaceAll("\\{format\\}","json")
@ -195,6 +200,11 @@ public class StoreApi {
public void deleteOrder (String orderId) throws ApiException {
Object postBody = null;
// verify the required parameter 'orderId' is set
if (orderId == null) {
throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder");
}
// create path and map variables
String path = "/store/order/{orderId}".replaceAll("\\{format\\}","json")

View File

@ -299,6 +299,11 @@ public class UserApi {
public User getUserByName (String username) throws ApiException {
Object postBody = null;
// verify the required parameter 'username' is set
if (username == null) {
throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName");
}
// create path and map variables
String path = "/user/{username}".replaceAll("\\{format\\}","json")
@ -351,6 +356,11 @@ public class UserApi {
public void updateUser (String username, User body) throws ApiException {
Object postBody = body;
// verify the required parameter 'username' is set
if (username == null) {
throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser");
}
// create path and map variables
String path = "/user/{username}".replaceAll("\\{format\\}","json")
@ -402,6 +412,11 @@ public class UserApi {
public void deleteUser (String username) throws ApiException {
Object postBody = null;
// verify the required parameter 'username' is set
if (username == null) {
throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser");
}
// create path and map variables
String path = "/user/{username}".replaceAll("\\{format\\}","json")