diff --git a/modules/swagger-codegen/src/main/resources/android-java/api.mustache b/modules/swagger-codegen/src/main/resources/android-java/api.mustache index 03d692e59226..0f21897e6779 100644 --- a/modules/swagger-codegen/src/main/resources/android-java/api.mustache +++ b/modules/swagger-codegen/src/main/resources/android-java/api.mustache @@ -39,10 +39,12 @@ public class {{classname}} { } {{#operation}} - {{#errorList}} //error info- code: {{code}} reason: "{{reason}}" model: {{#responseModel}}{{responseModel}} - {{/responseModel}}{{^responseModel}} - {{/responseModel}} - {{/errorList}} + /** + * {{summary}} + * {{notes}} +{{#allParams}} * @param {{paramName}} {{description}} +{{/allParams}} * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} + */ public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}} {{nickname}} ({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException { Object postBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; diff --git a/modules/swagger-codegen/src/main/resources/scala/api.mustache b/modules/swagger-codegen/src/main/resources/scala/api.mustache index 1de17ce60f59..0610123ce8bc 100644 --- a/modules/swagger-codegen/src/main/resources/scala/api.mustache +++ b/modules/swagger-codegen/src/main/resources/scala/api.mustache @@ -19,6 +19,12 @@ class {{classname}}(val defBasePath: String = "{{basePath}}", def addHeader(key: String, value: String) = apiInvoker.defaultHeaders += key -> value {{#operation}} + /** + * {{summary}} + * {{notes}} +{{#allParams}} * @param {{paramName}} {{description}} +{{/allParams}} * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} + */ def {{nickname}} ({{#allParams}}{{paramName}}: {{dataType}}{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) {{#returnType}}: Option[{{returnType}}]{{/returnType}} = { // create path and map variables val path = "{{path}}".replaceAll("\\{format\\}","json"){{#pathParams}}.replaceAll("\\{" + "{{baseName}}" + "\\}",apiInvoker.escape({{paramName}})) @@ -66,4 +72,4 @@ class {{classname}}(val defBasePath: String = "{{basePath}}", } {{/operation}} } -{{/operations}} \ No newline at end of file +{{/operations}} diff --git a/samples/client/petstore/android-java/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/android-java/src/main/java/io/swagger/client/api/PetApi.java index 93d9963d5e58..c8da678b2f98 100644 --- a/samples/client/petstore/android-java/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/android-java/src/main/java/io/swagger/client/api/PetApi.java @@ -38,7 +38,12 @@ public class PetApi { } - + /** + * Update an existing pet + * + * @param body Pet object that needs to be added to the store + * @return void + */ public void updatePet (Pet body) throws ApiException { Object postBody = body; @@ -88,7 +93,12 @@ public class PetApi { } } - + /** + * Add a new pet to the store + * + * @param body Pet object that needs to be added to the store + * @return void + */ public void addPet (Pet body) throws ApiException { Object postBody = body; @@ -138,7 +148,12 @@ public class PetApi { } } - + /** + * Finds Pets by status + * Multiple status values can be provided with comma seperated strings + * @param status Status values that need to be considered for filter + * @return List + */ public List findPetsByStatus (List status) throws ApiException { Object postBody = null; @@ -190,7 +205,12 @@ public class PetApi { } } - + /** + * Finds Pets by tags + * Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by + * @return List + */ public List findPetsByTags (List tags) throws ApiException { Object postBody = null; @@ -242,7 +262,12 @@ public class PetApi { } } - + /** + * Find pet by ID + * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + * @param petId ID of pet that needs to be fetched + * @return Pet + */ public Pet getPetById (Long petId) throws ApiException { Object postBody = null; @@ -292,7 +317,14 @@ public class PetApi { } } - + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated + * @param name Updated name of the pet + * @param status Updated status of the pet + * @return void + */ public void updatePetWithForm (String petId, String name, String status) throws ApiException { Object postBody = null; @@ -352,7 +384,13 @@ public class PetApi { } } - + /** + * Deletes a pet + * + * @param apiKey + * @param petId Pet id to delete + * @return void + */ public void deletePet (String apiKey, Long petId) throws ApiException { Object postBody = null; @@ -403,7 +441,14 @@ public class PetApi { } } - + /** + * uploads an image + * + * @param petId ID of pet to update + * @param additionalMetadata Additional data to pass to server + * @param file file to upload + * @return void + */ public void uploadFile (Long petId, String additionalMetadata, File file) throws ApiException { Object postBody = null; diff --git a/samples/client/petstore/android-java/src/main/java/io/swagger/client/api/StoreApi.java b/samples/client/petstore/android-java/src/main/java/io/swagger/client/api/StoreApi.java index 3a8ebbaedaa8..1e2ff3bba8a7 100644 --- a/samples/client/petstore/android-java/src/main/java/io/swagger/client/api/StoreApi.java +++ b/samples/client/petstore/android-java/src/main/java/io/swagger/client/api/StoreApi.java @@ -38,7 +38,11 @@ public class StoreApi { } - + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return Map + */ public Map getInventory () throws ApiException { Object postBody = null; @@ -88,7 +92,12 @@ public class StoreApi { } } - + /** + * Place an order for a pet + * + * @param body order placed for purchasing the pet + * @return Order + */ public Order placeOrder (Order body) throws ApiException { Object postBody = body; @@ -138,7 +147,12 @@ public class StoreApi { } } - + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @param orderId ID of pet that needs to be fetched + * @return Order + */ public Order getOrderById (String orderId) throws ApiException { Object postBody = null; @@ -188,7 +202,12 @@ public class StoreApi { } } - + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted + * @return void + */ public void deleteOrder (String orderId) throws ApiException { Object postBody = null; diff --git a/samples/client/petstore/android-java/src/main/java/io/swagger/client/api/UserApi.java b/samples/client/petstore/android-java/src/main/java/io/swagger/client/api/UserApi.java index 2e3aba0acd6f..da105638c5f5 100644 --- a/samples/client/petstore/android-java/src/main/java/io/swagger/client/api/UserApi.java +++ b/samples/client/petstore/android-java/src/main/java/io/swagger/client/api/UserApi.java @@ -38,7 +38,12 @@ public class UserApi { } - + /** + * Create user + * This can only be done by the logged in user. + * @param body Created user object + * @return void + */ public void createUser (User body) throws ApiException { Object postBody = body; @@ -88,7 +93,12 @@ public class UserApi { } } - + /** + * Creates list of users with given input array + * + * @param body List of user object + * @return void + */ public void createUsersWithArrayInput (List body) throws ApiException { Object postBody = body; @@ -138,7 +148,12 @@ public class UserApi { } } - + /** + * Creates list of users with given input array + * + * @param body List of user object + * @return void + */ public void createUsersWithListInput (List body) throws ApiException { Object postBody = body; @@ -188,7 +203,13 @@ public class UserApi { } } - + /** + * Logs user into the system + * + * @param username The user name for login + * @param password The password for login in clear text + * @return String + */ public String loginUser (String username, String password) throws ApiException { Object postBody = null; @@ -242,7 +263,11 @@ public class UserApi { } } - + /** + * Logs out current logged in user session + * + * @return void + */ public void logoutUser () throws ApiException { Object postBody = null; @@ -292,7 +317,12 @@ public class UserApi { } } - + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. + * @return User + */ public User getUserByName (String username) throws ApiException { Object postBody = null; @@ -342,7 +372,13 @@ public class UserApi { } } - + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted + * @param body Updated user object + * @return void + */ public void updateUser (String username, User body) throws ApiException { Object postBody = body; @@ -392,7 +428,12 @@ public class UserApi { } } - + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted + * @return void + */ public void deleteUser (String username) throws ApiException { Object postBody = null; diff --git a/samples/client/petstore/scala/src/main/scala/io/swagger/client/api/PetApi.scala b/samples/client/petstore/scala/src/main/scala/io/swagger/client/api/PetApi.scala index 9af297b52525..242f64e5aecb 100644 --- a/samples/client/petstore/scala/src/main/scala/io/swagger/client/api/PetApi.scala +++ b/samples/client/petstore/scala/src/main/scala/io/swagger/client/api/PetApi.scala @@ -18,6 +18,12 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2", def addHeader(key: String, value: String) = apiInvoker.defaultHeaders += key -> value + /** + * Update an existing pet + * + * @param body Pet object that needs to be added to the store + * @return void + */ def updatePet (body: Pet) = { // create path and map variables val path = "/pet".replaceAll("\\{format\\}","json") @@ -53,6 +59,12 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2", } } + /** + * Add a new pet to the store + * + * @param body Pet object that needs to be added to the store + * @return void + */ def addPet (body: Pet) = { // create path and map variables val path = "/pet".replaceAll("\\{format\\}","json") @@ -88,6 +100,12 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2", } } + /** + * Finds Pets by status + * Multiple status values can be provided with comma seperated strings + * @param status Status values that need to be considered for filter + * @return List[Pet] + */ def findPetsByStatus (status: List[String]) : Option[List[Pet]] = { // create path and map variables val path = "/pet/findByStatus".replaceAll("\\{format\\}","json") @@ -122,6 +140,12 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2", } } + /** + * Finds Pets by tags + * Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by + * @return List[Pet] + */ def findPetsByTags (tags: List[String]) : Option[List[Pet]] = { // create path and map variables val path = "/pet/findByTags".replaceAll("\\{format\\}","json") @@ -156,6 +180,12 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2", } } + /** + * Find pet by ID + * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + * @param petId ID of pet that needs to be fetched + * @return Pet + */ def getPetById (petId: Long) : Option[Pet] = { // create path and map variables val path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}",apiInvoker.escape(petId)) @@ -191,6 +221,14 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2", } } + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated + * @param name Updated name of the pet + * @param status Updated status of the pet + * @return void + */ def updatePetWithForm (petId: String, name: String, status: String) = { // create path and map variables val path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}",apiInvoker.escape(petId)) @@ -225,6 +263,13 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2", } } + /** + * Deletes a pet + * + * @param api_key + * @param petId Pet id to delete + * @return void + */ def deletePet (api_key: String, petId: Long) = { // create path and map variables val path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}",apiInvoker.escape(petId)) @@ -260,6 +305,14 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2", } } + /** + * uploads an image + * + * @param petId ID of pet to update + * @param additionalMetadata Additional data to pass to server + * @param file file to upload + * @return void + */ def uploadFile (petId: Long, additionalMetadata: String, file: File) = { // create path and map variables val path = "/pet/{petId}/uploadImage".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}",apiInvoker.escape(petId)) diff --git a/samples/client/petstore/scala/src/main/scala/io/swagger/client/api/StoreApi.scala b/samples/client/petstore/scala/src/main/scala/io/swagger/client/api/StoreApi.scala index c5fa105fca96..9c7e1cfe5838 100644 --- a/samples/client/petstore/scala/src/main/scala/io/swagger/client/api/StoreApi.scala +++ b/samples/client/petstore/scala/src/main/scala/io/swagger/client/api/StoreApi.scala @@ -17,6 +17,11 @@ class StoreApi(val defBasePath: String = "http://petstore.swagger.io/v2", def addHeader(key: String, value: String) = apiInvoker.defaultHeaders += key -> value + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return Map[String, Integer] + */ def getInventory () : Option[Map[String, Integer]] = { // create path and map variables val path = "/store/inventory".replaceAll("\\{format\\}","json") @@ -50,6 +55,12 @@ class StoreApi(val defBasePath: String = "http://petstore.swagger.io/v2", } } + /** + * Place an order for a pet + * + * @param body order placed for purchasing the pet + * @return Order + */ def placeOrder (body: Order) : Option[Order] = { // create path and map variables val path = "/store/order".replaceAll("\\{format\\}","json") @@ -86,6 +97,12 @@ class StoreApi(val defBasePath: String = "http://petstore.swagger.io/v2", } } + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @param orderId ID of pet that needs to be fetched + * @return Order + */ def getOrderById (orderId: String) : Option[Order] = { // create path and map variables val path = "/store/order/{orderId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "orderId" + "\\}",apiInvoker.escape(orderId)) @@ -121,6 +138,12 @@ class StoreApi(val defBasePath: String = "http://petstore.swagger.io/v2", } } + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted + * @return void + */ def deleteOrder (orderId: String) = { // create path and map variables val path = "/store/order/{orderId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "orderId" + "\\}",apiInvoker.escape(orderId)) diff --git a/samples/client/petstore/scala/src/main/scala/io/swagger/client/api/UserApi.scala b/samples/client/petstore/scala/src/main/scala/io/swagger/client/api/UserApi.scala index a46f19b9e683..62d96f90cfbf 100644 --- a/samples/client/petstore/scala/src/main/scala/io/swagger/client/api/UserApi.scala +++ b/samples/client/petstore/scala/src/main/scala/io/swagger/client/api/UserApi.scala @@ -17,6 +17,12 @@ class UserApi(val defBasePath: String = "http://petstore.swagger.io/v2", def addHeader(key: String, value: String) = apiInvoker.defaultHeaders += key -> value + /** + * Create user + * This can only be done by the logged in user. + * @param body Created user object + * @return void + */ def createUser (body: User) = { // create path and map variables val path = "/user".replaceAll("\\{format\\}","json") @@ -52,6 +58,12 @@ class UserApi(val defBasePath: String = "http://petstore.swagger.io/v2", } } + /** + * Creates list of users with given input array + * + * @param body List of user object + * @return void + */ def createUsersWithArrayInput (body: List[User]) = { // create path and map variables val path = "/user/createWithArray".replaceAll("\\{format\\}","json") @@ -87,6 +99,12 @@ class UserApi(val defBasePath: String = "http://petstore.swagger.io/v2", } } + /** + * Creates list of users with given input array + * + * @param body List of user object + * @return void + */ def createUsersWithListInput (body: List[User]) = { // create path and map variables val path = "/user/createWithList".replaceAll("\\{format\\}","json") @@ -122,6 +140,13 @@ class UserApi(val defBasePath: String = "http://petstore.swagger.io/v2", } } + /** + * Logs user into the system + * + * @param username The user name for login + * @param password The password for login in clear text + * @return String + */ def loginUser (username: String, password: String) : Option[String] = { // create path and map variables val path = "/user/login".replaceAll("\\{format\\}","json") @@ -157,6 +182,11 @@ class UserApi(val defBasePath: String = "http://petstore.swagger.io/v2", } } + /** + * Logs out current logged in user session + * + * @return void + */ def logoutUser () = { // create path and map variables val path = "/user/logout".replaceAll("\\{format\\}","json") @@ -189,6 +219,12 @@ class UserApi(val defBasePath: String = "http://petstore.swagger.io/v2", } } + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. + * @return User + */ def getUserByName (username: String) : Option[User] = { // create path and map variables val path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}",apiInvoker.escape(username)) @@ -224,6 +260,13 @@ class UserApi(val defBasePath: String = "http://petstore.swagger.io/v2", } } + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted + * @param body Updated user object + * @return void + */ def updateUser (username: String, body: User) = { // create path and map variables val path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}",apiInvoker.escape(username)) @@ -261,6 +304,12 @@ class UserApi(val defBasePath: String = "http://petstore.swagger.io/v2", } } + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted + * @return void + */ def deleteUser (username: String) = { // create path and map variables val path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}",apiInvoker.escape(username))