Fix (partially) #4898 for groovy (#5030)

* Fix (partially) #4898 for groovy.

This also adds some TODOs for the missing path, form and body parameters.

* Update Groovy samples (after partial fix for #4898)
This commit is contained in:
Paŭlo Ebermann 2017-03-13 14:46:28 +01:00 committed by wing328
parent 722bbb8e1f
commit a2d1edc6f5
4 changed files with 66 additions and 24 deletions

View File

@ -18,7 +18,7 @@ class {{classname}} {
{{#operation}}
def {{operationId}} ({{#allParams}} {{{dataType}}} {{paramName}},{{/allParams}} Closure onSuccess, Closure onFailure) {
// create path and map variables
// create path and map path parameters (TODO)
String resourcePath = "{{path}}"
// query params
@ -35,13 +35,15 @@ class {{classname}} {
{{/allParams}}
{{#queryParams}}if (!"null".equals(String.valueOf({{paramName}})))
queryParams.put("{{paramName}}", String.valueOf({{paramName}}))
queryParams.put("{{baseName}}", String.valueOf({{paramName}}))
{{/queryParams}}
{{#headerParams}}
headerParams.put("{{paramName}}", {{paramName}})
headerParams.put("{{baseName}}", {{paramName}})
{{/headerParams}}
// Also still TODO: form params, body param
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
"{{httpMethod}}", "{{returnContainer}}",
{{#returnBaseType}}{{{returnBaseType}}}.class {{/returnBaseType}}{{^returnBaseType}}null {{/returnBaseType}})

View File

@ -17,7 +17,7 @@ class PetApi {
String versionPath = "/api/v1"
def addPet ( Pet body, Closure onSuccess, Closure onFailure) {
// create path and map variables
// create path and map path parameters (TODO)
String resourcePath = "/pet"
// query params
@ -31,13 +31,15 @@ class PetApi {
// Also still TODO: form params, body param
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
"POST", "",
null )
}
def deletePet ( Long petId, String apiKey, Closure onSuccess, Closure onFailure) {
// create path and map variables
// create path and map path parameters (TODO)
String resourcePath = "/pet/{petId}"
// query params
@ -50,7 +52,9 @@ class PetApi {
}
headerParams.put("apiKey", apiKey)
headerParams.put("api_key", apiKey)
// Also still TODO: form params, body param
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
"DELETE", "",
@ -58,7 +62,7 @@ class PetApi {
}
def findPetsByStatus ( List<String> status, Closure onSuccess, Closure onFailure) {
// create path and map variables
// create path and map path parameters (TODO)
String resourcePath = "/pet/findByStatus"
// query params
@ -74,13 +78,15 @@ class PetApi {
queryParams.put("status", String.valueOf(status))
// Also still TODO: form params, body param
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
"GET", "array",
Pet.class )
}
def findPetsByTags ( List<String> tags, Closure onSuccess, Closure onFailure) {
// create path and map variables
// create path and map path parameters (TODO)
String resourcePath = "/pet/findByTags"
// query params
@ -96,13 +102,15 @@ class PetApi {
queryParams.put("tags", String.valueOf(tags))
// Also still TODO: form params, body param
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
"GET", "array",
Pet.class )
}
def getPetById ( Long petId, Closure onSuccess, Closure onFailure) {
// create path and map variables
// create path and map path parameters (TODO)
String resourcePath = "/pet/{petId}"
// query params
@ -116,13 +124,15 @@ class PetApi {
// Also still TODO: form params, body param
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
"GET", "",
Pet.class )
}
def updatePet ( Pet body, Closure onSuccess, Closure onFailure) {
// create path and map variables
// create path and map path parameters (TODO)
String resourcePath = "/pet"
// query params
@ -136,13 +146,15 @@ class PetApi {
// Also still TODO: form params, body param
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
"PUT", "",
null )
}
def updatePetWithForm ( Long petId, String name, String status, Closure onSuccess, Closure onFailure) {
// create path and map variables
// create path and map path parameters (TODO)
String resourcePath = "/pet/{petId}"
// query params
@ -156,13 +168,15 @@ class PetApi {
// Also still TODO: form params, body param
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
"POST", "",
null )
}
def uploadFile ( Long petId, String additionalMetadata, File file, Closure onSuccess, Closure onFailure) {
// create path and map variables
// create path and map path parameters (TODO)
String resourcePath = "/pet/{petId}/uploadImage"
// query params
@ -176,6 +190,8 @@ class PetApi {
// Also still TODO: form params, body param
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
"POST", "",
ModelApiResponse.class )

View File

@ -16,7 +16,7 @@ class StoreApi {
String versionPath = "/api/v1"
def deleteOrder ( String orderId, Closure onSuccess, Closure onFailure) {
// create path and map variables
// create path and map path parameters (TODO)
String resourcePath = "/store/order/{orderId}"
// query params
@ -30,13 +30,15 @@ class StoreApi {
// Also still TODO: form params, body param
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
"DELETE", "",
null )
}
def getInventory ( Closure onSuccess, Closure onFailure) {
// create path and map variables
// create path and map path parameters (TODO)
String resourcePath = "/store/inventory"
// query params
@ -46,13 +48,15 @@ class StoreApi {
// Also still TODO: form params, body param
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
"GET", "map",
Map.class )
}
def getOrderById ( Long orderId, Closure onSuccess, Closure onFailure) {
// create path and map variables
// create path and map path parameters (TODO)
String resourcePath = "/store/order/{orderId}"
// query params
@ -66,13 +70,15 @@ class StoreApi {
// Also still TODO: form params, body param
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
"GET", "",
Order.class )
}
def placeOrder ( Order body, Closure onSuccess, Closure onFailure) {
// create path and map variables
// create path and map path parameters (TODO)
String resourcePath = "/store/order"
// query params
@ -86,6 +92,8 @@ class StoreApi {
// Also still TODO: form params, body param
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
"POST", "",
Order.class )

View File

@ -15,7 +15,7 @@ class UserApi {
String versionPath = "/api/v1"
def createUser ( User body, Closure onSuccess, Closure onFailure) {
// create path and map variables
// create path and map path parameters (TODO)
String resourcePath = "/user"
// query params
@ -29,13 +29,15 @@ class UserApi {
// Also still TODO: form params, body param
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
"POST", "",
null )
}
def createUsersWithArrayInput ( List<User> body, Closure onSuccess, Closure onFailure) {
// create path and map variables
// create path and map path parameters (TODO)
String resourcePath = "/user/createWithArray"
// query params
@ -49,13 +51,15 @@ class UserApi {
// Also still TODO: form params, body param
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
"POST", "",
null )
}
def createUsersWithListInput ( List<User> body, Closure onSuccess, Closure onFailure) {
// create path and map variables
// create path and map path parameters (TODO)
String resourcePath = "/user/createWithList"
// query params
@ -69,13 +73,15 @@ class UserApi {
// Also still TODO: form params, body param
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
"POST", "",
null )
}
def deleteUser ( String username, Closure onSuccess, Closure onFailure) {
// create path and map variables
// create path and map path parameters (TODO)
String resourcePath = "/user/{username}"
// query params
@ -89,13 +95,15 @@ class UserApi {
// Also still TODO: form params, body param
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
"DELETE", "",
null )
}
def getUserByName ( String username, Closure onSuccess, Closure onFailure) {
// create path and map variables
// create path and map path parameters (TODO)
String resourcePath = "/user/{username}"
// query params
@ -109,13 +117,15 @@ class UserApi {
// Also still TODO: form params, body param
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
"GET", "",
User.class )
}
def loginUser ( String username, String password, Closure onSuccess, Closure onFailure) {
// create path and map variables
// create path and map path parameters (TODO)
String resourcePath = "/user/login"
// query params
@ -137,13 +147,15 @@ if (!"null".equals(String.valueOf(password)))
queryParams.put("password", String.valueOf(password))
// Also still TODO: form params, body param
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
"GET", "",
String.class )
}
def logoutUser ( Closure onSuccess, Closure onFailure) {
// create path and map variables
// create path and map path parameters (TODO)
String resourcePath = "/user/logout"
// query params
@ -153,13 +165,15 @@ if (!"null".equals(String.valueOf(password)))
// Also still TODO: form params, body param
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
"GET", "",
null )
}
def updateUser ( String username, User body, Closure onSuccess, Closure onFailure) {
// create path and map variables
// create path and map path parameters (TODO)
String resourcePath = "/user/{username}"
// query params
@ -177,6 +191,8 @@ if (!"null".equals(String.valueOf(password)))
// Also still TODO: form params, body param
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
"PUT", "",
null )