diff --git a/modules/openapi-generator/src/main/resources/Groovy/api.mustache b/modules/openapi-generator/src/main/resources/Groovy/api.mustache index 3548311eb8..d20f050432 100644 --- a/modules/openapi-generator/src/main/resources/Groovy/api.mustache +++ b/modules/openapi-generator/src/main/resources/Groovy/api.mustache @@ -24,31 +24,33 @@ class {{classname}} { // query params def queryParams = [:] def headerParams = [:] - + {{#allParams}} {{#required}} // verify required params are set if ({{paramName}} == null) { throw new RuntimeException("missing required params {{paramName}}") } + {{/required}} {{/allParams}} - - {{#queryParams}}if (!"null".equals(String.valueOf({{paramName}}))) + {{#queryParams}} + if (!"null".equals(String.valueOf({{paramName}}))) queryParams.put("{{baseName}}", String.valueOf({{paramName}})) - {{/queryParams}} + {{/queryParams}} {{#headerParams}} headerParams.put("{{baseName}}", {{paramName}}) - {{/headerParams}} - // Also still TODO: form params, body param + {{/headerParams}} + // TODO: form params, body param not yet support invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, "{{httpMethod}}", "{{returnContainer}}", {{#returnBaseType}}{{{returnBaseType}}}.class {{/returnBaseType}}{{^returnBaseType}}null {{/returnBaseType}}) - + } + {{/operation}} } {{/operations}} diff --git a/modules/openapi-generator/src/main/resources/Groovy/model.mustache b/modules/openapi-generator/src/main/resources/Groovy/model.mustache index bc3ca28aae..4a355ebb1e 100644 --- a/modules/openapi-generator/src/main/resources/Groovy/model.mustache +++ b/modules/openapi-generator/src/main/resources/Groovy/model.mustache @@ -1,21 +1,21 @@ package {{package}}; import groovy.transform.Canonical -{{#imports}}import {{import}}; +{{#imports}} +import {{import}}; {{/imports}} + {{#models}} {{#model}} @Canonical class {{classname}} { - {{#vars}} - - {{#description}}/* {{{description}}} */ - {{/description}} - {{{datatype}}} {{name}} = {{{defaultValue}}} - {{/vars}} - + {{#vars}} + {{#description}} + /* {{{description}}} */ + {{/description}} + {{{datatype}}} {{name}} = {{{defaultValue}}} + {{/vars}} } - {{/model}} {{/models}} \ No newline at end of file diff --git a/samples/client/petstore-security-test/php/.openapi-generator/VERSION b/samples/client/petstore-security-test/php/.openapi-generator/VERSION index 855ff9501e..096bf47efe 100644 --- a/samples/client/petstore-security-test/php/.openapi-generator/VERSION +++ b/samples/client/petstore-security-test/php/.openapi-generator/VERSION @@ -1 +1 @@ -2.4.0-SNAPSHOT \ No newline at end of file +3.0.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore-security-test/typescript-jquery/default/.openapi-generator/VERSION b/samples/client/petstore-security-test/typescript-jquery/default/.openapi-generator/VERSION index 7fea99011a..855ff9501e 100644 --- a/samples/client/petstore-security-test/typescript-jquery/default/.openapi-generator/VERSION +++ b/samples/client/petstore-security-test/typescript-jquery/default/.openapi-generator/VERSION @@ -1 +1 @@ -2.2.3-SNAPSHOT \ No newline at end of file +2.4.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/groovy/src/main/groovy/io/swagger/api/PetApi.groovy b/samples/client/petstore/groovy/src/main/groovy/io/swagger/api/PetApi.groovy index a223f4bbad..2620b4e776 100644 --- a/samples/client/petstore/groovy/src/main/groovy/io/swagger/api/PetApi.groovy +++ b/samples/client/petstore/groovy/src/main/groovy/io/swagger/api/PetApi.groovy @@ -16,28 +16,27 @@ class PetApi { String basePath = "http://petstore.swagger.io/v2" String versionPath = "/api/v1" - def addPet ( Pet body, Closure onSuccess, Closure onFailure) { + def addPet ( Pet pet, Closure onSuccess, Closure onFailure) { // create path and map path parameters (TODO) String resourcePath = "/pet" // query params def queryParams = [:] def headerParams = [:] - + // verify required params are set - if (body == null) { - throw new RuntimeException("missing required params body") + if (pet == null) { + throw new RuntimeException("missing required params pet") } - - - // Also still TODO: form params, body param + // TODO: form params, body param not yet support invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, "POST", "", null ) - + } + def deletePet ( Long petId, String apiKey, Closure onSuccess, Closure onFailure) { // create path and map path parameters (TODO) String resourcePath = "/pet/{petId}" @@ -45,22 +44,22 @@ class PetApi { // query params def queryParams = [:] def headerParams = [:] - + // verify required params are set if (petId == null) { throw new RuntimeException("missing required params petId") } - headerParams.put("api_key", apiKey) - // Also still TODO: form params, body param + // TODO: form params, body param not yet support invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, "DELETE", "", null ) - + } + def findPetsByStatus ( List status, Closure onSuccess, Closure onFailure) { // create path and map path parameters (TODO) String resourcePath = "/pet/findByStatus" @@ -68,7 +67,7 @@ class PetApi { // query params def queryParams = [:] def headerParams = [:] - + // verify required params are set if (status == null) { throw new RuntimeException("missing required params status") @@ -77,14 +76,14 @@ class PetApi { if (!"null".equals(String.valueOf(status))) queryParams.put("status", String.valueOf(status)) - - // Also still TODO: form params, body param + // TODO: form params, body param not yet support invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, "GET", "array", Pet.class ) - + } + def findPetsByTags ( List tags, Closure onSuccess, Closure onFailure) { // create path and map path parameters (TODO) String resourcePath = "/pet/findByTags" @@ -92,7 +91,7 @@ class PetApi { // query params def queryParams = [:] def headerParams = [:] - + // verify required params are set if (tags == null) { throw new RuntimeException("missing required params tags") @@ -101,14 +100,14 @@ class PetApi { if (!"null".equals(String.valueOf(tags))) queryParams.put("tags", String.valueOf(tags)) - - // Also still TODO: form params, body param + // TODO: form params, body param not yet support invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, "GET", "array", Pet.class ) - + } + def getPetById ( Long petId, Closure onSuccess, Closure onFailure) { // create path and map path parameters (TODO) String resourcePath = "/pet/{petId}" @@ -116,43 +115,41 @@ class PetApi { // query params def queryParams = [:] def headerParams = [:] - + // verify required params are set if (petId == null) { throw new RuntimeException("missing required params petId") } - - - // Also still TODO: form params, body param + // TODO: form params, body param not yet support invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, "GET", "", Pet.class ) - + } - def updatePet ( Pet body, Closure onSuccess, Closure onFailure) { + + def updatePet ( Pet pet, Closure onSuccess, Closure onFailure) { // create path and map path parameters (TODO) String resourcePath = "/pet" // query params def queryParams = [:] def headerParams = [:] - + // verify required params are set - if (body == null) { - throw new RuntimeException("missing required params body") + if (pet == null) { + throw new RuntimeException("missing required params pet") } - - - // Also still TODO: form params, body param + // TODO: form params, body param not yet support 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 path parameters (TODO) String resourcePath = "/pet/{petId}" @@ -160,21 +157,20 @@ class PetApi { // query params def queryParams = [:] def headerParams = [:] - + // verify required params are set if (petId == null) { throw new RuntimeException("missing required params petId") } - - - // Also still TODO: form params, body param + // TODO: form params, body param not yet support 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 path parameters (TODO) String resourcePath = "/pet/{petId}/uploadImage" @@ -182,19 +178,18 @@ class PetApi { // query params def queryParams = [:] def headerParams = [:] - + // verify required params are set if (petId == null) { throw new RuntimeException("missing required params petId") } - - - // Also still TODO: form params, body param + // TODO: form params, body param not yet support invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, "POST", "", ModelApiResponse.class ) - + } + } diff --git a/samples/client/petstore/groovy/src/main/groovy/io/swagger/api/StoreApi.groovy b/samples/client/petstore/groovy/src/main/groovy/io/swagger/api/StoreApi.groovy index bf74dd2126..1d0687f9f2 100644 --- a/samples/client/petstore/groovy/src/main/groovy/io/swagger/api/StoreApi.groovy +++ b/samples/client/petstore/groovy/src/main/groovy/io/swagger/api/StoreApi.groovy @@ -22,21 +22,20 @@ class StoreApi { // query params def queryParams = [:] def headerParams = [:] - + // verify required params are set if (orderId == null) { throw new RuntimeException("missing required params orderId") } - - - // Also still TODO: form params, body param + // TODO: form params, body param not yet support invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, "DELETE", "", null ) - + } + def getInventory ( Closure onSuccess, Closure onFailure) { // create path and map path parameters (TODO) String resourcePath = "/store/inventory" @@ -44,17 +43,15 @@ class StoreApi { // query params def queryParams = [:] def headerParams = [:] - - - - // Also still TODO: form params, body param + // TODO: form params, body param not yet support invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, "GET", "map", - Map.class ) - + Integer.class ) + } + def getOrderById ( Long orderId, Closure onSuccess, Closure onFailure) { // create path and map path parameters (TODO) String resourcePath = "/store/order/{orderId}" @@ -62,41 +59,39 @@ class StoreApi { // query params def queryParams = [:] def headerParams = [:] - + // verify required params are set if (orderId == null) { throw new RuntimeException("missing required params orderId") } - - - // Also still TODO: form params, body param + // TODO: form params, body param not yet support invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, "GET", "", Order.class ) - + } - def placeOrder ( Order body, Closure onSuccess, Closure onFailure) { + + def placeOrder ( Order order, Closure onSuccess, Closure onFailure) { // create path and map path parameters (TODO) String resourcePath = "/store/order" // query params def queryParams = [:] def headerParams = [:] - + // verify required params are set - if (body == null) { - throw new RuntimeException("missing required params body") + if (order == null) { + throw new RuntimeException("missing required params order") } - - - // Also still TODO: form params, body param + // TODO: form params, body param not yet support invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, "POST", "", Order.class ) - + } + } diff --git a/samples/client/petstore/groovy/src/main/groovy/io/swagger/api/UserApi.groovy b/samples/client/petstore/groovy/src/main/groovy/io/swagger/api/UserApi.groovy index 411fc55ae8..b452062656 100644 --- a/samples/client/petstore/groovy/src/main/groovy/io/swagger/api/UserApi.groovy +++ b/samples/client/petstore/groovy/src/main/groovy/io/swagger/api/UserApi.groovy @@ -14,72 +14,69 @@ class UserApi { String basePath = "http://petstore.swagger.io/v2" String versionPath = "/api/v1" - def createUser ( User body, Closure onSuccess, Closure onFailure) { + def createUser ( User user, Closure onSuccess, Closure onFailure) { // create path and map path parameters (TODO) String resourcePath = "/user" // query params def queryParams = [:] def headerParams = [:] - + // verify required params are set - if (body == null) { - throw new RuntimeException("missing required params body") + if (user == null) { + throw new RuntimeException("missing required params user") } - - - // Also still TODO: form params, body param + // TODO: form params, body param not yet support invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, "POST", "", null ) - + } - def createUsersWithArrayInput ( List body, Closure onSuccess, Closure onFailure) { + + def createUsersWithArrayInput ( List user, Closure onSuccess, Closure onFailure) { // create path and map path parameters (TODO) String resourcePath = "/user/createWithArray" // query params def queryParams = [:] def headerParams = [:] - + // verify required params are set - if (body == null) { - throw new RuntimeException("missing required params body") + if (user == null) { + throw new RuntimeException("missing required params user") } - - - // Also still TODO: form params, body param + // TODO: form params, body param not yet support invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, "POST", "", null ) - + } - def createUsersWithListInput ( List body, Closure onSuccess, Closure onFailure) { + + def createUsersWithListInput ( List user, Closure onSuccess, Closure onFailure) { // create path and map path parameters (TODO) String resourcePath = "/user/createWithList" // query params def queryParams = [:] def headerParams = [:] - + // verify required params are set - if (body == null) { - throw new RuntimeException("missing required params body") + if (user == null) { + throw new RuntimeException("missing required params user") } - - - // Also still TODO: form params, body param + // TODO: form params, body param not yet support invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, "POST", "", null ) - + } + def deleteUser ( String username, Closure onSuccess, Closure onFailure) { // create path and map path parameters (TODO) String resourcePath = "/user/{username}" @@ -87,21 +84,20 @@ class UserApi { // query params def queryParams = [:] def headerParams = [:] - + // verify required params are set if (username == null) { throw new RuntimeException("missing required params username") } - - - // Also still TODO: form params, body param + // TODO: form params, body param not yet support invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, "DELETE", "", null ) - + } + def getUserByName ( String username, Closure onSuccess, Closure onFailure) { // create path and map path parameters (TODO) String resourcePath = "/user/{username}" @@ -109,21 +105,20 @@ class UserApi { // query params def queryParams = [:] def headerParams = [:] - + // verify required params are set if (username == null) { throw new RuntimeException("missing required params username") } - - - // Also still TODO: form params, body param + // TODO: form params, body param not yet support 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 path parameters (TODO) String resourcePath = "/user/login" @@ -131,11 +126,12 @@ class UserApi { // query params def queryParams = [:] def headerParams = [:] - + // verify required params are set if (username == null) { throw new RuntimeException("missing required params username") } + // verify required params are set if (password == null) { throw new RuntimeException("missing required params password") @@ -143,17 +139,18 @@ class UserApi { if (!"null".equals(String.valueOf(username))) queryParams.put("username", String.valueOf(username)) -if (!"null".equals(String.valueOf(password))) + + if (!"null".equals(String.valueOf(password))) queryParams.put("password", String.valueOf(password)) - - // Also still TODO: form params, body param + // TODO: form params, body param not yet support invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, "GET", "", String.class ) - + } + def logoutUser ( Closure onSuccess, Closure onFailure) { // create path and map path parameters (TODO) String resourcePath = "/user/logout" @@ -161,41 +158,39 @@ if (!"null".equals(String.valueOf(password))) // query params def queryParams = [:] def headerParams = [:] - - - - // Also still TODO: form params, body param + // TODO: form params, body param not yet support invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, "GET", "", null ) - + } - def updateUser ( String username, User body, Closure onSuccess, Closure onFailure) { + + def updateUser ( String username, User user, Closure onSuccess, Closure onFailure) { // create path and map path parameters (TODO) String resourcePath = "/user/{username}" // query params def queryParams = [:] def headerParams = [:] - + // verify required params are set if (username == null) { throw new RuntimeException("missing required params username") } + // verify required params are set - if (body == null) { - throw new RuntimeException("missing required params body") + if (user == null) { + throw new RuntimeException("missing required params user") } - - - // Also still TODO: form params, body param + // TODO: form params, body param not yet support invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, "PUT", "", null ) - + } + } diff --git a/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/Category.groovy b/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/Category.groovy index 752328f71e..2081516261 100644 --- a/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/Category.groovy +++ b/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/Category.groovy @@ -3,13 +3,11 @@ package io.swagger.model; import groovy.transform.Canonical import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; + @Canonical class Category { - Long id = null String name = null - } - diff --git a/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/ModelApiResponse.groovy b/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/ModelApiResponse.groovy index 21b0185787..c6f8fd2719 100644 --- a/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/ModelApiResponse.groovy +++ b/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/ModelApiResponse.groovy @@ -3,15 +3,13 @@ package io.swagger.model; import groovy.transform.Canonical import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; + @Canonical class ModelApiResponse { - Integer code = null String type = null String message = null - } - diff --git a/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/Order.groovy b/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/Order.groovy index ca30463cfb..4a7a3aa1b9 100644 --- a/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/Order.groovy +++ b/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/Order.groovy @@ -4,9 +4,9 @@ import groovy.transform.Canonical import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import io.swagger.model.Date; + @Canonical class Order { - Long id = null Long petId = null @@ -15,11 +15,9 @@ class Order { Date shipDate = null - /* Order Status */ - String status = null + /* Order Status */ + String status = null Boolean complete = false - } - diff --git a/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/Pet.groovy b/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/Pet.groovy index 4e2bb9db15..9fb4d6e51b 100644 --- a/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/Pet.groovy +++ b/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/Pet.groovy @@ -7,9 +7,9 @@ import io.swagger.model.ArrayList; import io.swagger.model.Category; import io.swagger.model.Tag; import java.util.List; + @Canonical class Pet { - Long id = null Category category = null @@ -20,9 +20,7 @@ class Pet { List tags = new ArrayList() - /* pet status in the store */ - String status = null - + /* pet status in the store */ + String status = null } - diff --git a/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/Tag.groovy b/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/Tag.groovy index 4160f03a71..5b513a987b 100644 --- a/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/Tag.groovy +++ b/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/Tag.groovy @@ -3,13 +3,11 @@ package io.swagger.model; import groovy.transform.Canonical import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; + @Canonical class Tag { - Long id = null String name = null - } - diff --git a/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/User.groovy b/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/User.groovy index 142a4afd0d..8fbe2e18a5 100644 --- a/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/User.groovy +++ b/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/User.groovy @@ -3,9 +3,9 @@ package io.swagger.model; import groovy.transform.Canonical import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; + @Canonical class User { - Long id = null String username = null @@ -20,9 +20,7 @@ class User { String phone = null - /* User Status */ - Integer userStatus = null - + /* User Status */ + Integer userStatus = null } -