[swift5][client] improve code formatting (#11124)

* [swift][client] improve code formatting with multiple response as

* [kotlin][vertx] update sample project
This commit is contained in:
Bruno Coelho 2021-12-17 02:19:41 +00:00 committed by GitHub
parent fedc54af9a
commit 42d635b463
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 9 additions and 75 deletions

View File

@ -23,9 +23,9 @@ extension {{projectName}}API {
/** {{{.}}} */{{/description}} /** {{{.}}} */{{/description}}
{{#objcCompatible}}@objc {{/objcCompatible}}{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class {{classname}}{{#objcCompatible}} : NSObject{{/objcCompatible}} { {{#objcCompatible}}@objc {{/objcCompatible}}{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class {{classname}}{{#objcCompatible}} : NSObject{{/objcCompatible}} {
{{#operation}} {{#operation}}
{{#allParams}} {{#allParams}}
{{#isEnum}} {{#isEnum}}
/** /**
* enum for parameter {{paramName}} * enum for parameter {{paramName}}
*/ */
@ -36,7 +36,6 @@ extension {{projectName}}API {
{{/enumVars}} {{/enumVars}}
{{/allowableValues}} {{/allowableValues}}
} }
{{/isEnum}} {{/isEnum}}
{{/allParams}} {{/allParams}}
{{^useVapor}} {{^useVapor}}
@ -45,6 +44,7 @@ extension {{projectName}}API {
{{^useResult}} {{^useResult}}
{{^useCombine}} {{^useCombine}}
{{^useAsyncAwait}} {{^useAsyncAwait}}
/** /**
{{#summary}} {{#summary}}
{{{.}}} {{{.}}}
@ -80,6 +80,7 @@ extension {{projectName}}API {
{{/usePromiseKit}} {{/usePromiseKit}}
{{/useVapor}} {{/useVapor}}
{{#usePromiseKit}} {{#usePromiseKit}}
/** /**
{{#summary}} {{#summary}}
{{{.}}} {{{.}}}
@ -111,6 +112,7 @@ extension {{projectName}}API {
} }
{{/usePromiseKit}} {{/usePromiseKit}}
{{#useRxSwift}} {{#useRxSwift}}
/** /**
{{#summary}} {{#summary}}
{{{.}}} {{{.}}}
@ -147,6 +149,7 @@ extension {{projectName}}API {
} }
{{/useRxSwift}} {{/useRxSwift}}
{{#useCombine}} {{#useCombine}}
/** /**
{{#summary}} {{#summary}}
{{{.}}} {{{.}}}
@ -186,6 +189,7 @@ extension {{projectName}}API {
#endif #endif
{{/useCombine}} {{/useCombine}}
{{#useAsyncAwait}} {{#useAsyncAwait}}
/** /**
{{#summary}} {{#summary}}
{{{.}}} {{{.}}}
@ -229,6 +233,7 @@ extension {{projectName}}API {
} }
{{/useAsyncAwait}} {{/useAsyncAwait}}
{{#useResult}} {{#useResult}}
/** /**
{{#summary}} {{#summary}}
{{{.}}} {{{.}}}
@ -241,7 +246,7 @@ extension {{projectName}}API {
@available(*, deprecated, message: "This operation is deprecated.") @available(*, deprecated, message: "This operation is deprecated.")
{{/isDeprecated}} {{/isDeprecated}}
@discardableResult @discardableResult
open class func {{operationId}}({{#allParams}}{{paramName}}: {{#isEnum}}{{#isContainer}}[{{enumName}}_{{operationId}}]{{/isContainer}}{{^isContainer}}{{enumName}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}apiResponseQueue: DispatchQueue = {{projectName}}API.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<{{{returnType}}}{{^returnType}}Void{{/returnType}}, ErrorResponse>) -> Void)) -> RequestTask { {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func {{operationId}}({{#allParams}}{{paramName}}: {{#isEnum}}{{#isContainer}}[{{enumName}}_{{operationId}}]{{/isContainer}}{{^isContainer}}{{enumName}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}apiResponseQueue: DispatchQueue = {{projectName}}API.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<{{{returnType}}}{{^returnType}}Void{{/returnType}}, ErrorResponse>) -> Void)) -> RequestTask {
return {{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}).execute(apiResponseQueue) { result in return {{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}).execute(apiResponseQueue) { result in
switch result { switch result {
{{#returnType}} {{#returnType}}
@ -259,6 +264,7 @@ extension {{projectName}}API {
} }
{{/useResult}} {{/useResult}}
{{#useVapor}} {{#useVapor}}
/** /**
{{#summary}} {{#summary}}
{{{.}}} {{{.}}}
@ -380,7 +386,6 @@ extension {{projectName}}API {
} }
} }
} }
{{/useVapor}} {{/useVapor}}
{{^useVapor}} {{^useVapor}}

View File

@ -60,5 +60,4 @@ open class AnotherFakeAPI {
} }
} }
} }
} }

View File

@ -61,7 +61,6 @@ open class FakeAPI {
} }
} }
/** /**
POST /fake/outer/boolean POST /fake/outer/boolean
Test serialization of outer boolean types Test serialization of outer boolean types
@ -110,7 +109,6 @@ open class FakeAPI {
} }
} }
/** /**
POST /fake/outer/composite POST /fake/outer/composite
Test serialization of object with outer number type Test serialization of object with outer number type
@ -159,7 +157,6 @@ open class FakeAPI {
} }
} }
/** /**
POST /fake/outer/number POST /fake/outer/number
Test serialization of outer number types Test serialization of outer number types
@ -208,7 +205,6 @@ open class FakeAPI {
} }
} }
/** /**
POST /fake/outer/string POST /fake/outer/string
Test serialization of outer string types Test serialization of outer string types
@ -257,7 +253,6 @@ open class FakeAPI {
} }
} }
/** /**
PUT /fake/body-with-file-schema PUT /fake/body-with-file-schema
For this test, the body for this request much reference a schema named `File`. For this test, the body for this request much reference a schema named `File`.
@ -304,7 +299,6 @@ open class FakeAPI {
} }
} }
/** /**
PUT /fake/body-with-query-params PUT /fake/body-with-query-params
- parameter query: (query) - parameter query: (query)
@ -358,7 +352,6 @@ open class FakeAPI {
} }
} }
/** /**
To test \"client\" model To test \"client\" model
PATCH /fake PATCH /fake
@ -407,7 +400,6 @@ open class FakeAPI {
} }
} }
/** /**
Fake endpoint for testing various parameters Fake endpoint for testing various parameters
POST /fake POST /fake
@ -507,7 +499,6 @@ open class FakeAPI {
} }
} }
/** /**
* enum for parameter enumHeaderStringArray * enum for parameter enumHeaderStringArray
*/ */
@ -661,7 +652,6 @@ open class FakeAPI {
} }
} }
/** /**
Fake endpoint to test group parameters (optional) Fake endpoint to test group parameters (optional)
DELETE /fake DELETE /fake
@ -736,7 +726,6 @@ open class FakeAPI {
} }
} }
/** /**
test inline additionalProperties test inline additionalProperties
POST /fake/inline-additionalProperties POST /fake/inline-additionalProperties
@ -783,7 +772,6 @@ open class FakeAPI {
} }
} }
/** /**
test json serialization of form data test json serialization of form data
GET /fake/jsonFormData GET /fake/jsonFormData
@ -836,7 +824,6 @@ open class FakeAPI {
} }
} }
/** /**
PUT /fake/test-query-parameters PUT /fake/test-query-parameters
To test the collection format in query parameters To test the collection format in query parameters
@ -904,5 +891,4 @@ open class FakeAPI {
} }
} }
} }
} }

View File

@ -66,5 +66,4 @@ open class FakeClassnameTags123API {
} }
} }
} }
} }

View File

@ -68,7 +68,6 @@ open class PetAPI {
} }
} }
/** /**
Deletes a pet Deletes a pet
DELETE /pet/{petId} DELETE /pet/{petId}
@ -130,7 +129,6 @@ open class PetAPI {
} }
} }
/** /**
* enum for parameter status * enum for parameter status
*/ */
@ -203,7 +201,6 @@ open class PetAPI {
} }
} }
/** /**
Finds Pets by tags Finds Pets by tags
GET /pet/findByTags GET /pet/findByTags
@ -269,7 +266,6 @@ open class PetAPI {
} }
} }
/** /**
Find pet by ID Find pet by ID
GET /pet/{petId} GET /pet/{petId}
@ -332,7 +328,6 @@ open class PetAPI {
} }
} }
/** /**
Update an existing pet Update an existing pet
PUT /pet PUT /pet
@ -394,7 +389,6 @@ open class PetAPI {
} }
} }
/** /**
Updates a pet in the store with form data Updates a pet in the store with form data
POST /pet/{petId} POST /pet/{petId}
@ -458,7 +452,6 @@ open class PetAPI {
} }
} }
/** /**
uploads an image uploads an image
POST /pet/{petId}/uploadImage POST /pet/{petId}/uploadImage
@ -522,7 +515,6 @@ open class PetAPI {
} }
} }
/** /**
uploads an image (required) uploads an image (required)
POST /fake/{petId}/uploadImageWithRequiredFile POST /fake/{petId}/uploadImageWithRequiredFile
@ -585,5 +577,4 @@ open class PetAPI {
} }
} }
} }
} }

View File

@ -66,7 +66,6 @@ open class StoreAPI {
} }
} }
/** /**
Returns pet inventories by status Returns pet inventories by status
GET /store/inventory GET /store/inventory
@ -118,7 +117,6 @@ open class StoreAPI {
} }
} }
/** /**
Find purchase order by ID Find purchase order by ID
GET /store/order/{order_id} GET /store/order/{order_id}
@ -175,7 +173,6 @@ open class StoreAPI {
} }
} }
/** /**
Place an order for a pet Place an order for a pet
POST /store/order POST /store/order
@ -224,5 +221,4 @@ open class StoreAPI {
} }
} }
} }
} }

View File

@ -58,7 +58,6 @@ open class UserAPI {
} }
} }
/** /**
Creates list of users with given input array Creates list of users with given input array
POST /user/createWithArray POST /user/createWithArray
@ -102,7 +101,6 @@ open class UserAPI {
} }
} }
/** /**
Creates list of users with given input array Creates list of users with given input array
POST /user/createWithList POST /user/createWithList
@ -146,7 +144,6 @@ open class UserAPI {
} }
} }
/** /**
Delete user Delete user
DELETE /user/{username} DELETE /user/{username}
@ -200,7 +197,6 @@ open class UserAPI {
} }
} }
/** /**
Get user by user name Get user by user name
GET /user/{username} GET /user/{username}
@ -255,7 +251,6 @@ open class UserAPI {
} }
} }
/** /**
Logs user into the system Logs user into the system
GET /user/login GET /user/login
@ -317,7 +312,6 @@ open class UserAPI {
} }
} }
/** /**
Logs out current logged in user session Logs out current logged in user session
GET /user/logout GET /user/logout
@ -358,7 +352,6 @@ open class UserAPI {
} }
} }
/** /**
Updated user Updated user
PUT /user/{username} PUT /user/{username}
@ -414,5 +407,4 @@ open class UserAPI {
} }
} }
} }
} }

View File

@ -1,34 +0,0 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.server.api.model
import com.google.gson.annotations.SerializedName
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
import com.fasterxml.jackson.annotation.JsonInclude
/**
* Describes the result of uploading an image resource
* @param code
* @param type
* @param message
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
data class ApiResponse (
var code: kotlin.Int? = null,
var type: kotlin.String? = null,
var message: kotlin.String? = null
) {
}