forked from loafle/openapi-generator-original
* 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:
parent
722bbb8e1f
commit
a2d1edc6f5
@ -18,7 +18,7 @@ class {{classname}} {
|
|||||||
|
|
||||||
{{#operation}}
|
{{#operation}}
|
||||||
def {{operationId}} ({{#allParams}} {{{dataType}}} {{paramName}},{{/allParams}} Closure onSuccess, Closure onFailure) {
|
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}}"
|
String resourcePath = "{{path}}"
|
||||||
|
|
||||||
// query params
|
// query params
|
||||||
@ -35,13 +35,15 @@ class {{classname}} {
|
|||||||
{{/allParams}}
|
{{/allParams}}
|
||||||
|
|
||||||
{{#queryParams}}if (!"null".equals(String.valueOf({{paramName}})))
|
{{#queryParams}}if (!"null".equals(String.valueOf({{paramName}})))
|
||||||
queryParams.put("{{paramName}}", String.valueOf({{paramName}}))
|
queryParams.put("{{baseName}}", String.valueOf({{paramName}}))
|
||||||
{{/queryParams}}
|
{{/queryParams}}
|
||||||
|
|
||||||
{{#headerParams}}
|
{{#headerParams}}
|
||||||
headerParams.put("{{paramName}}", {{paramName}})
|
headerParams.put("{{baseName}}", {{paramName}})
|
||||||
{{/headerParams}}
|
{{/headerParams}}
|
||||||
|
|
||||||
|
// Also still TODO: form params, body param
|
||||||
|
|
||||||
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
|
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
|
||||||
"{{httpMethod}}", "{{returnContainer}}",
|
"{{httpMethod}}", "{{returnContainer}}",
|
||||||
{{#returnBaseType}}{{{returnBaseType}}}.class {{/returnBaseType}}{{^returnBaseType}}null {{/returnBaseType}})
|
{{#returnBaseType}}{{{returnBaseType}}}.class {{/returnBaseType}}{{^returnBaseType}}null {{/returnBaseType}})
|
||||||
|
@ -17,7 +17,7 @@ class PetApi {
|
|||||||
String versionPath = "/api/v1"
|
String versionPath = "/api/v1"
|
||||||
|
|
||||||
def addPet ( Pet body, Closure onSuccess, Closure onFailure) {
|
def addPet ( Pet body, Closure onSuccess, Closure onFailure) {
|
||||||
// create path and map variables
|
// create path and map path parameters (TODO)
|
||||||
String resourcePath = "/pet"
|
String resourcePath = "/pet"
|
||||||
|
|
||||||
// query params
|
// query params
|
||||||
@ -31,13 +31,15 @@ class PetApi {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Also still TODO: form params, body param
|
||||||
|
|
||||||
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
|
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
|
||||||
"POST", "",
|
"POST", "",
|
||||||
null )
|
null )
|
||||||
|
|
||||||
}
|
}
|
||||||
def deletePet ( Long petId, String apiKey, Closure onSuccess, Closure onFailure) {
|
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}"
|
String resourcePath = "/pet/{petId}"
|
||||||
|
|
||||||
// query params
|
// 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,
|
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
|
||||||
"DELETE", "",
|
"DELETE", "",
|
||||||
@ -58,7 +62,7 @@ class PetApi {
|
|||||||
|
|
||||||
}
|
}
|
||||||
def findPetsByStatus ( List<String> status, Closure onSuccess, Closure onFailure) {
|
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"
|
String resourcePath = "/pet/findByStatus"
|
||||||
|
|
||||||
// query params
|
// query params
|
||||||
@ -74,13 +78,15 @@ class PetApi {
|
|||||||
queryParams.put("status", String.valueOf(status))
|
queryParams.put("status", String.valueOf(status))
|
||||||
|
|
||||||
|
|
||||||
|
// Also still TODO: form params, body param
|
||||||
|
|
||||||
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
|
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
|
||||||
"GET", "array",
|
"GET", "array",
|
||||||
Pet.class )
|
Pet.class )
|
||||||
|
|
||||||
}
|
}
|
||||||
def findPetsByTags ( List<String> tags, Closure onSuccess, Closure onFailure) {
|
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"
|
String resourcePath = "/pet/findByTags"
|
||||||
|
|
||||||
// query params
|
// query params
|
||||||
@ -96,13 +102,15 @@ class PetApi {
|
|||||||
queryParams.put("tags", String.valueOf(tags))
|
queryParams.put("tags", String.valueOf(tags))
|
||||||
|
|
||||||
|
|
||||||
|
// Also still TODO: form params, body param
|
||||||
|
|
||||||
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
|
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
|
||||||
"GET", "array",
|
"GET", "array",
|
||||||
Pet.class )
|
Pet.class )
|
||||||
|
|
||||||
}
|
}
|
||||||
def getPetById ( Long petId, Closure onSuccess, Closure onFailure) {
|
def getPetById ( Long petId, Closure onSuccess, Closure onFailure) {
|
||||||
// create path and map variables
|
// create path and map path parameters (TODO)
|
||||||
String resourcePath = "/pet/{petId}"
|
String resourcePath = "/pet/{petId}"
|
||||||
|
|
||||||
// query params
|
// query params
|
||||||
@ -116,13 +124,15 @@ class PetApi {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Also still TODO: form params, body param
|
||||||
|
|
||||||
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
|
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
|
||||||
"GET", "",
|
"GET", "",
|
||||||
Pet.class )
|
Pet.class )
|
||||||
|
|
||||||
}
|
}
|
||||||
def updatePet ( Pet body, Closure onSuccess, Closure onFailure) {
|
def updatePet ( Pet body, Closure onSuccess, Closure onFailure) {
|
||||||
// create path and map variables
|
// create path and map path parameters (TODO)
|
||||||
String resourcePath = "/pet"
|
String resourcePath = "/pet"
|
||||||
|
|
||||||
// query params
|
// query params
|
||||||
@ -136,13 +146,15 @@ class PetApi {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Also still TODO: form params, body param
|
||||||
|
|
||||||
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
|
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
|
||||||
"PUT", "",
|
"PUT", "",
|
||||||
null )
|
null )
|
||||||
|
|
||||||
}
|
}
|
||||||
def updatePetWithForm ( Long petId, String name, String status, Closure onSuccess, Closure onFailure) {
|
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}"
|
String resourcePath = "/pet/{petId}"
|
||||||
|
|
||||||
// query params
|
// query params
|
||||||
@ -156,13 +168,15 @@ class PetApi {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Also still TODO: form params, body param
|
||||||
|
|
||||||
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
|
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
|
||||||
"POST", "",
|
"POST", "",
|
||||||
null )
|
null )
|
||||||
|
|
||||||
}
|
}
|
||||||
def uploadFile ( Long petId, String additionalMetadata, File file, Closure onSuccess, Closure onFailure) {
|
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"
|
String resourcePath = "/pet/{petId}/uploadImage"
|
||||||
|
|
||||||
// query params
|
// query params
|
||||||
@ -176,6 +190,8 @@ class PetApi {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Also still TODO: form params, body param
|
||||||
|
|
||||||
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
|
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
|
||||||
"POST", "",
|
"POST", "",
|
||||||
ModelApiResponse.class )
|
ModelApiResponse.class )
|
||||||
|
@ -16,7 +16,7 @@ class StoreApi {
|
|||||||
String versionPath = "/api/v1"
|
String versionPath = "/api/v1"
|
||||||
|
|
||||||
def deleteOrder ( String orderId, Closure onSuccess, Closure onFailure) {
|
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}"
|
String resourcePath = "/store/order/{orderId}"
|
||||||
|
|
||||||
// query params
|
// query params
|
||||||
@ -30,13 +30,15 @@ class StoreApi {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Also still TODO: form params, body param
|
||||||
|
|
||||||
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
|
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
|
||||||
"DELETE", "",
|
"DELETE", "",
|
||||||
null )
|
null )
|
||||||
|
|
||||||
}
|
}
|
||||||
def getInventory ( Closure onSuccess, Closure onFailure) {
|
def getInventory ( Closure onSuccess, Closure onFailure) {
|
||||||
// create path and map variables
|
// create path and map path parameters (TODO)
|
||||||
String resourcePath = "/store/inventory"
|
String resourcePath = "/store/inventory"
|
||||||
|
|
||||||
// query params
|
// query params
|
||||||
@ -46,13 +48,15 @@ class StoreApi {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Also still TODO: form params, body param
|
||||||
|
|
||||||
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
|
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
|
||||||
"GET", "map",
|
"GET", "map",
|
||||||
Map.class )
|
Map.class )
|
||||||
|
|
||||||
}
|
}
|
||||||
def getOrderById ( Long orderId, Closure onSuccess, Closure onFailure) {
|
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}"
|
String resourcePath = "/store/order/{orderId}"
|
||||||
|
|
||||||
// query params
|
// query params
|
||||||
@ -66,13 +70,15 @@ class StoreApi {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Also still TODO: form params, body param
|
||||||
|
|
||||||
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
|
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
|
||||||
"GET", "",
|
"GET", "",
|
||||||
Order.class )
|
Order.class )
|
||||||
|
|
||||||
}
|
}
|
||||||
def placeOrder ( Order body, Closure onSuccess, Closure onFailure) {
|
def placeOrder ( Order body, Closure onSuccess, Closure onFailure) {
|
||||||
// create path and map variables
|
// create path and map path parameters (TODO)
|
||||||
String resourcePath = "/store/order"
|
String resourcePath = "/store/order"
|
||||||
|
|
||||||
// query params
|
// query params
|
||||||
@ -86,6 +92,8 @@ class StoreApi {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Also still TODO: form params, body param
|
||||||
|
|
||||||
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
|
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
|
||||||
"POST", "",
|
"POST", "",
|
||||||
Order.class )
|
Order.class )
|
||||||
|
@ -15,7 +15,7 @@ class UserApi {
|
|||||||
String versionPath = "/api/v1"
|
String versionPath = "/api/v1"
|
||||||
|
|
||||||
def createUser ( User body, Closure onSuccess, Closure onFailure) {
|
def createUser ( User body, Closure onSuccess, Closure onFailure) {
|
||||||
// create path and map variables
|
// create path and map path parameters (TODO)
|
||||||
String resourcePath = "/user"
|
String resourcePath = "/user"
|
||||||
|
|
||||||
// query params
|
// query params
|
||||||
@ -29,13 +29,15 @@ class UserApi {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Also still TODO: form params, body param
|
||||||
|
|
||||||
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
|
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
|
||||||
"POST", "",
|
"POST", "",
|
||||||
null )
|
null )
|
||||||
|
|
||||||
}
|
}
|
||||||
def createUsersWithArrayInput ( List<User> body, Closure onSuccess, Closure onFailure) {
|
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"
|
String resourcePath = "/user/createWithArray"
|
||||||
|
|
||||||
// query params
|
// query params
|
||||||
@ -49,13 +51,15 @@ class UserApi {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Also still TODO: form params, body param
|
||||||
|
|
||||||
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
|
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
|
||||||
"POST", "",
|
"POST", "",
|
||||||
null )
|
null )
|
||||||
|
|
||||||
}
|
}
|
||||||
def createUsersWithListInput ( List<User> body, Closure onSuccess, Closure onFailure) {
|
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"
|
String resourcePath = "/user/createWithList"
|
||||||
|
|
||||||
// query params
|
// query params
|
||||||
@ -69,13 +73,15 @@ class UserApi {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Also still TODO: form params, body param
|
||||||
|
|
||||||
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
|
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
|
||||||
"POST", "",
|
"POST", "",
|
||||||
null )
|
null )
|
||||||
|
|
||||||
}
|
}
|
||||||
def deleteUser ( String username, Closure onSuccess, Closure onFailure) {
|
def deleteUser ( String username, Closure onSuccess, Closure onFailure) {
|
||||||
// create path and map variables
|
// create path and map path parameters (TODO)
|
||||||
String resourcePath = "/user/{username}"
|
String resourcePath = "/user/{username}"
|
||||||
|
|
||||||
// query params
|
// query params
|
||||||
@ -89,13 +95,15 @@ class UserApi {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Also still TODO: form params, body param
|
||||||
|
|
||||||
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
|
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
|
||||||
"DELETE", "",
|
"DELETE", "",
|
||||||
null )
|
null )
|
||||||
|
|
||||||
}
|
}
|
||||||
def getUserByName ( String username, Closure onSuccess, Closure onFailure) {
|
def getUserByName ( String username, Closure onSuccess, Closure onFailure) {
|
||||||
// create path and map variables
|
// create path and map path parameters (TODO)
|
||||||
String resourcePath = "/user/{username}"
|
String resourcePath = "/user/{username}"
|
||||||
|
|
||||||
// query params
|
// query params
|
||||||
@ -109,13 +117,15 @@ class UserApi {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Also still TODO: form params, body param
|
||||||
|
|
||||||
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
|
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
|
||||||
"GET", "",
|
"GET", "",
|
||||||
User.class )
|
User.class )
|
||||||
|
|
||||||
}
|
}
|
||||||
def loginUser ( String username, String password, Closure onSuccess, Closure onFailure) {
|
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"
|
String resourcePath = "/user/login"
|
||||||
|
|
||||||
// query params
|
// query params
|
||||||
@ -137,13 +147,15 @@ if (!"null".equals(String.valueOf(password)))
|
|||||||
queryParams.put("password", String.valueOf(password))
|
queryParams.put("password", String.valueOf(password))
|
||||||
|
|
||||||
|
|
||||||
|
// Also still TODO: form params, body param
|
||||||
|
|
||||||
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
|
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
|
||||||
"GET", "",
|
"GET", "",
|
||||||
String.class )
|
String.class )
|
||||||
|
|
||||||
}
|
}
|
||||||
def logoutUser ( Closure onSuccess, Closure onFailure) {
|
def logoutUser ( Closure onSuccess, Closure onFailure) {
|
||||||
// create path and map variables
|
// create path and map path parameters (TODO)
|
||||||
String resourcePath = "/user/logout"
|
String resourcePath = "/user/logout"
|
||||||
|
|
||||||
// query params
|
// 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,
|
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
|
||||||
"GET", "",
|
"GET", "",
|
||||||
null )
|
null )
|
||||||
|
|
||||||
}
|
}
|
||||||
def updateUser ( String username, User body, Closure onSuccess, Closure onFailure) {
|
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}"
|
String resourcePath = "/user/{username}"
|
||||||
|
|
||||||
// query params
|
// 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,
|
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
|
||||||
"PUT", "",
|
"PUT", "",
|
||||||
null )
|
null )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user