From acc98953751d0c764eab527cebb57616ca19bfc4 Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Mon, 3 May 2021 21:54:52 -0400 Subject: [PATCH 1/6] [swift5] Map file and binary to Data Fixes: https://github.com/OpenAPITools/openapi-generator/issues/9308 --- .../codegen/languages/Swift5ClientCodegen.java | 7 +++---- .../codegen/swift5/Swift5ClientCodegenTest.java | 4 ++-- .../org/openapitools/codegen/swift5/Swift5ModelTest.java | 4 ++-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift5ClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift5ClientCodegen.java index 4766e2a9c911..7b3a26b16f9d 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift5ClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift5ClientCodegen.java @@ -120,7 +120,6 @@ public Swift5ClientCodegen() { "Bool", "Void", "String", - "URL", "Data", "Date", "Character", @@ -224,8 +223,8 @@ public Swift5ClientCodegen() { typeMapping.put("float", "Float"); typeMapping.put("number", "Double"); typeMapping.put("double", "Double"); - typeMapping.put("file", "URL"); - typeMapping.put("binary", "URL"); + typeMapping.put("file", "Data"); + typeMapping.put("binary", "Data"); typeMapping.put("ByteArray", "Data"); typeMapping.put("UUID", "UUID"); typeMapping.put("URI", "String"); @@ -602,7 +601,7 @@ public String getSchemaType(Schema p) { @Override public boolean isDataTypeFile(String dataType) { - return "URL".equals(dataType); + return "Data".equals(dataType); } @Override diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/swift5/Swift5ClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/swift5/Swift5ClientCodegenTest.java index c56d675a663f..0f5e71366cc2 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/swift5/Swift5ClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/swift5/Swift5ClientCodegenTest.java @@ -106,8 +106,8 @@ public void binaryDataTest() { final Operation p = openAPI.getPaths().get(path).getPost(); final CodegenOperation op = codegen.fromOperation(path, "post", p, null); - Assert.assertEquals(op.returnType, "URL"); - Assert.assertEquals(op.bodyParam.dataType, "URL"); + Assert.assertEquals(op.returnType, "Data"); + Assert.assertEquals(op.bodyParam.dataType, "Data"); Assert.assertTrue(op.bodyParam.isBinary); Assert.assertTrue(op.responses.get(0).isBinary); } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/swift5/Swift5ModelTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/swift5/Swift5ModelTest.java index 895bb1703bc1..e63e184cea72 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/swift5/Swift5ModelTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/swift5/Swift5ModelTest.java @@ -87,10 +87,10 @@ public void simpleModelTest() { final CodegenProperty property4 = cm.vars.get(3); Assert.assertEquals(property4.baseName, "binary"); - Assert.assertEquals(property4.dataType, "URL"); + Assert.assertEquals(property4.dataType, "Data"); Assert.assertEquals(property4.name, "binary"); Assert.assertNull(property4.defaultValue); - Assert.assertEquals(property4.baseType, "URL"); + Assert.assertEquals(property4.baseType, "Data"); Assert.assertFalse(property4.required); Assert.assertFalse(property4.isContainer); From ec371921e30d481884d481384f46631117d2a0a6 Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Thu, 6 May 2021 18:50:56 -0400 Subject: [PATCH 2/6] Update samples --- .../Classes/OpenAPIs/APIs/FakeAPI.swift | 4 ++-- .../Classes/OpenAPIs/APIs/PetAPI.swift | 8 ++++---- .../Classes/OpenAPIs/Models/FormatTest.swift | 4 ++-- .../petstore/swift5/alamofireLibrary/docs/FakeAPI.md | 6 +++--- .../swift5/alamofireLibrary/docs/FormatTest.md | 2 +- .../petstore/swift5/alamofireLibrary/docs/PetAPI.md | 12 ++++++------ .../Classes/OpenAPIs/APIs/FakeAPI.swift | 4 ++-- .../Classes/OpenAPIs/APIs/PetAPI.swift | 8 ++++---- .../Classes/OpenAPIs/Models/FormatTest.swift | 4 ++-- .../petstore/swift5/combineLibrary/docs/FakeAPI.md | 6 +++--- .../swift5/combineLibrary/docs/FormatTest.md | 2 +- .../petstore/swift5/combineLibrary/docs/PetAPI.md | 12 ++++++------ .../Classes/OpenAPIs/APIs/FakeAPI.swift | 4 ++-- .../Classes/OpenAPIs/APIs/PetAPI.swift | 8 ++++---- .../Classes/OpenAPIs/Models/FormatTest.swift | 4 ++-- .../client/petstore/swift5/default/docs/FakeAPI.md | 6 +++--- .../petstore/swift5/default/docs/FormatTest.md | 2 +- .../client/petstore/swift5/default/docs/PetAPI.md | 12 ++++++------ .../Classes/OpenAPIs/APIs/PetAPI.swift | 4 ++-- .../client/petstore/swift5/deprecated/docs/PetAPI.md | 6 +++--- .../Classes/OpenAPIs/APIs/FakeAPI.swift | 4 ++-- .../Classes/OpenAPIs/APIs/PetAPI.swift | 8 ++++---- .../Classes/OpenAPIs/Models/FormatTest.swift | 4 ++-- .../petstore/swift5/nonPublicApi/docs/FakeAPI.md | 6 +++--- .../petstore/swift5/nonPublicApi/docs/FormatTest.md | 2 +- .../petstore/swift5/nonPublicApi/docs/PetAPI.md | 12 ++++++------ .../Classes/OpenAPIs/APIs/FakeAPI.swift | 4 ++-- .../Classes/OpenAPIs/APIs/PetAPI.swift | 8 ++++---- .../Classes/OpenAPIs/Models/FormatTest.swift | 4 ++-- .../petstore/swift5/objcCompatible/docs/FakeAPI.md | 6 +++--- .../swift5/objcCompatible/docs/FormatTest.md | 2 +- .../petstore/swift5/objcCompatible/docs/PetAPI.md | 12 ++++++------ .../Classes/OpenAPIs/APIs/FakeAPI.swift | 4 ++-- .../Classes/OpenAPIs/APIs/PetAPI.swift | 8 ++++---- .../Classes/OpenAPIs/Models/FormatTest.swift | 4 ++-- .../swift5/promisekitLibrary/docs/FakeAPI.md | 6 +++--- .../swift5/promisekitLibrary/docs/FormatTest.md | 2 +- .../petstore/swift5/promisekitLibrary/docs/PetAPI.md | 12 ++++++------ .../Classes/OpenAPIs/APIs/FakeAPI.swift | 4 ++-- .../Classes/OpenAPIs/APIs/PetAPI.swift | 8 ++++---- .../Classes/OpenAPIs/Models/FormatTest.swift | 4 ++-- .../swift5/readonlyProperties/docs/FakeAPI.md | 6 +++--- .../swift5/readonlyProperties/docs/FormatTest.md | 2 +- .../swift5/readonlyProperties/docs/PetAPI.md | 12 ++++++------ .../Classes/OpenAPIs/APIs/FakeAPI.swift | 4 ++-- .../Classes/OpenAPIs/APIs/PetAPI.swift | 8 ++++---- .../Classes/OpenAPIs/Models/FormatTest.swift | 4 ++-- .../petstore/swift5/resultLibrary/docs/FakeAPI.md | 6 +++--- .../petstore/swift5/resultLibrary/docs/FormatTest.md | 2 +- .../petstore/swift5/resultLibrary/docs/PetAPI.md | 12 ++++++------ .../Classes/OpenAPIs/APIs/FakeAPI.swift | 4 ++-- .../Classes/OpenAPIs/APIs/PetAPI.swift | 8 ++++---- .../Classes/OpenAPIs/Models/FormatTest.swift | 4 ++-- .../petstore/swift5/rxswiftLibrary/docs/FakeAPI.md | 6 +++--- .../swift5/rxswiftLibrary/docs/FormatTest.md | 2 +- .../petstore/swift5/rxswiftLibrary/docs/PetAPI.md | 12 ++++++------ .../Sources/PetstoreClient/APIs/FakeAPI.swift | 4 ++-- .../Sources/PetstoreClient/APIs/PetAPI.swift | 8 ++++---- .../Sources/PetstoreClient/Models/FormatTest.swift | 4 ++-- .../swift5/urlsessionLibrary/docs/FakeAPI.md | 6 +++--- .../swift5/urlsessionLibrary/docs/FormatTest.md | 2 +- .../petstore/swift5/urlsessionLibrary/docs/PetAPI.md | 12 ++++++------ 62 files changed, 185 insertions(+), 185 deletions(-) diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index cf92424d9cc1..4a16bb585577 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -321,7 +321,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: Data? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testEndpointParametersWithRequestBuilder(number: number, double: double, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -355,7 +355,7 @@ open class FakeAPI { - parameter callback: (form) None (optional) - returns: RequestBuilder */ - open class func testEndpointParametersWithRequestBuilder(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil) -> RequestBuilder { + open class func testEndpointParametersWithRequestBuilder(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: Data? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil) -> RequestBuilder { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path let formParams: [String: Any?] = [ diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index a1fe0d12b1da..37c0edcb59b4 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -373,7 +373,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -395,7 +395,7 @@ open class PetAPI { - parameter file: (form) file to upload (optional) - returns: RequestBuilder */ - open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil) -> RequestBuilder { + open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil) -> RequestBuilder { var path = "/pet/{petId}/uploadImage" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" @@ -431,7 +431,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { + open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -453,7 +453,7 @@ open class PetAPI { - parameter additionalMetadata: (form) Additional data to pass to server (optional) - returns: RequestBuilder */ - open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil) -> RequestBuilder { + open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil) -> RequestBuilder { var path = "/fake/{petId}/uploadImageWithRequiredFile" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift index 114c884efc5e..e407645ef988 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift @@ -20,13 +20,13 @@ public struct FormatTest: Codable, Hashable { public var double: Double? public var string: String? public var byte: Data - public var binary: URL? + public var binary: Data? public var date: Date public var dateTime: Date? public var uuid: UUID? public var password: String - public init(integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, number: Double, float: Float? = nil, double: Double? = nil, string: String? = nil, byte: Data, binary: URL? = nil, date: Date, dateTime: Date? = nil, uuid: UUID? = nil, password: String) { + public init(integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, number: Double, float: Float? = nil, double: Double? = nil, string: String? = nil, byte: Data, binary: Data? = nil, date: Date, dateTime: Date? = nil, uuid: UUID? = nil, password: String) { self.integer = integer self.int32 = int32 self.int64 = int64 diff --git a/samples/client/petstore/swift5/alamofireLibrary/docs/FakeAPI.md b/samples/client/petstore/swift5/alamofireLibrary/docs/FakeAPI.md index 543869c0d2e0..e5c4e3bb035f 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/docs/FakeAPI.md +++ b/samples/client/petstore/swift5/alamofireLibrary/docs/FakeAPI.md @@ -364,7 +364,7 @@ No authorization required # **testEndpointParameters** ```swift - open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) + open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: Data? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) ``` Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -385,7 +385,7 @@ let int32 = 987 // Int | None (optional) let int64 = 987 // Int64 | None (optional) let float = 987 // Float | None (optional) let string = "string_example" // String | None (optional) -let binary = URL(string: "https://example.com")! // URL | None (optional) +let binary = 987 // Data | None (optional) let date = Date() // Date | None (optional) let dateTime = Date() // Date | None (optional) let password = "password_example" // String | None (optional) @@ -417,7 +417,7 @@ Name | Type | Description | Notes **int64** | **Int64** | None | [optional] **float** | **Float** | None | [optional] **string** | **String** | None | [optional] - **binary** | **URL** | None | [optional] + **binary** | **Data** | None | [optional] **date** | **Date** | None | [optional] **dateTime** | **Date** | None | [optional] **password** | **String** | None | [optional] diff --git a/samples/client/petstore/swift5/alamofireLibrary/docs/FormatTest.md b/samples/client/petstore/swift5/alamofireLibrary/docs/FormatTest.md index f74d94f6c46a..04e7113e3dc6 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/docs/FormatTest.md +++ b/samples/client/petstore/swift5/alamofireLibrary/docs/FormatTest.md @@ -11,7 +11,7 @@ Name | Type | Description | Notes **double** | **Double** | | [optional] **string** | **String** | | [optional] **byte** | **Data** | | -**binary** | **URL** | | [optional] +**binary** | **Data** | | [optional] **date** | **Date** | | **dateTime** | **Date** | | [optional] **uuid** | **UUID** | | [optional] diff --git a/samples/client/petstore/swift5/alamofireLibrary/docs/PetAPI.md b/samples/client/petstore/swift5/alamofireLibrary/docs/PetAPI.md index 27efe0833476..76a34913c823 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/docs/PetAPI.md +++ b/samples/client/petstore/swift5/alamofireLibrary/docs/PetAPI.md @@ -365,7 +365,7 @@ Void (empty response body) # **uploadFile** ```swift - open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) ``` uploads an image @@ -377,7 +377,7 @@ import PetstoreClient let petId = 987 // Int64 | ID of pet to update let additionalMetadata = "additionalMetadata_example" // String | Additional data to pass to server (optional) -let file = URL(string: "https://example.com")! // URL | file to upload (optional) +let file = 987 // Data | file to upload (optional) // uploads an image PetAPI.uploadFile(petId: petId, additionalMetadata: additionalMetadata, file: file) { (response, error) in @@ -398,7 +398,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Int64** | ID of pet to update | **additionalMetadata** | **String** | Additional data to pass to server | [optional] - **file** | **URL** | file to upload | [optional] + **file** | **Data** | file to upload | [optional] ### Return type @@ -417,7 +417,7 @@ Name | Type | Description | Notes # **uploadFileWithRequiredFile** ```swift - open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) + open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) ``` uploads an image (required) @@ -428,7 +428,7 @@ uploads an image (required) import PetstoreClient let petId = 987 // Int64 | ID of pet to update -let requiredFile = URL(string: "https://example.com")! // URL | file to upload +let requiredFile = 987 // Data | file to upload let additionalMetadata = "additionalMetadata_example" // String | Additional data to pass to server (optional) // uploads an image (required) @@ -449,7 +449,7 @@ PetAPI.uploadFileWithRequiredFile(petId: petId, requiredFile: requiredFile, addi Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Int64** | ID of pet to update | - **requiredFile** | **URL** | file to upload | + **requiredFile** | **Data** | file to upload | **additionalMetadata** | **String** | Additional data to pass to server | [optional] ### Return type diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index 20e0b55d9e8c..e9dab2bdf432 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -361,7 +361,7 @@ open class FakeAPI { */ #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { + open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: Data? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in testEndpointParametersWithRequestBuilder(number: number, double: double, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback).execute(apiResponseQueue) { result -> Void in switch result { @@ -398,7 +398,7 @@ open class FakeAPI { - parameter callback: (form) None (optional) - returns: RequestBuilder */ - open class func testEndpointParametersWithRequestBuilder(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil) -> RequestBuilder { + open class func testEndpointParametersWithRequestBuilder(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: Data? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil) -> RequestBuilder { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path let formParams: [String: Any?] = [ diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 10ce86076cf1..b64adf6f9a8c 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -413,7 +413,7 @@ open class PetAPI { */ #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute(apiResponseQueue) { result -> Void in switch result { @@ -438,7 +438,7 @@ open class PetAPI { - parameter file: (form) file to upload (optional) - returns: RequestBuilder */ - open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil) -> RequestBuilder { + open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil) -> RequestBuilder { var path = "/pet/{petId}/uploadImage" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" @@ -476,7 +476,7 @@ open class PetAPI { */ #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { + open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute(apiResponseQueue) { result -> Void in switch result { @@ -501,7 +501,7 @@ open class PetAPI { - parameter additionalMetadata: (form) Additional data to pass to server (optional) - returns: RequestBuilder */ - open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil) -> RequestBuilder { + open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil) -> RequestBuilder { var path = "/fake/{petId}/uploadImageWithRequiredFile" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift index 114c884efc5e..e407645ef988 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift @@ -20,13 +20,13 @@ public struct FormatTest: Codable, Hashable { public var double: Double? public var string: String? public var byte: Data - public var binary: URL? + public var binary: Data? public var date: Date public var dateTime: Date? public var uuid: UUID? public var password: String - public init(integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, number: Double, float: Float? = nil, double: Double? = nil, string: String? = nil, byte: Data, binary: URL? = nil, date: Date, dateTime: Date? = nil, uuid: UUID? = nil, password: String) { + public init(integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, number: Double, float: Float? = nil, double: Double? = nil, string: String? = nil, byte: Data, binary: Data? = nil, date: Date, dateTime: Date? = nil, uuid: UUID? = nil, password: String) { self.integer = integer self.int32 = int32 self.int64 = int64 diff --git a/samples/client/petstore/swift5/combineLibrary/docs/FakeAPI.md b/samples/client/petstore/swift5/combineLibrary/docs/FakeAPI.md index 543869c0d2e0..e5c4e3bb035f 100644 --- a/samples/client/petstore/swift5/combineLibrary/docs/FakeAPI.md +++ b/samples/client/petstore/swift5/combineLibrary/docs/FakeAPI.md @@ -364,7 +364,7 @@ No authorization required # **testEndpointParameters** ```swift - open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) + open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: Data? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) ``` Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -385,7 +385,7 @@ let int32 = 987 // Int | None (optional) let int64 = 987 // Int64 | None (optional) let float = 987 // Float | None (optional) let string = "string_example" // String | None (optional) -let binary = URL(string: "https://example.com")! // URL | None (optional) +let binary = 987 // Data | None (optional) let date = Date() // Date | None (optional) let dateTime = Date() // Date | None (optional) let password = "password_example" // String | None (optional) @@ -417,7 +417,7 @@ Name | Type | Description | Notes **int64** | **Int64** | None | [optional] **float** | **Float** | None | [optional] **string** | **String** | None | [optional] - **binary** | **URL** | None | [optional] + **binary** | **Data** | None | [optional] **date** | **Date** | None | [optional] **dateTime** | **Date** | None | [optional] **password** | **String** | None | [optional] diff --git a/samples/client/petstore/swift5/combineLibrary/docs/FormatTest.md b/samples/client/petstore/swift5/combineLibrary/docs/FormatTest.md index f74d94f6c46a..04e7113e3dc6 100644 --- a/samples/client/petstore/swift5/combineLibrary/docs/FormatTest.md +++ b/samples/client/petstore/swift5/combineLibrary/docs/FormatTest.md @@ -11,7 +11,7 @@ Name | Type | Description | Notes **double** | **Double** | | [optional] **string** | **String** | | [optional] **byte** | **Data** | | -**binary** | **URL** | | [optional] +**binary** | **Data** | | [optional] **date** | **Date** | | **dateTime** | **Date** | | [optional] **uuid** | **UUID** | | [optional] diff --git a/samples/client/petstore/swift5/combineLibrary/docs/PetAPI.md b/samples/client/petstore/swift5/combineLibrary/docs/PetAPI.md index 27efe0833476..76a34913c823 100644 --- a/samples/client/petstore/swift5/combineLibrary/docs/PetAPI.md +++ b/samples/client/petstore/swift5/combineLibrary/docs/PetAPI.md @@ -365,7 +365,7 @@ Void (empty response body) # **uploadFile** ```swift - open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) ``` uploads an image @@ -377,7 +377,7 @@ import PetstoreClient let petId = 987 // Int64 | ID of pet to update let additionalMetadata = "additionalMetadata_example" // String | Additional data to pass to server (optional) -let file = URL(string: "https://example.com")! // URL | file to upload (optional) +let file = 987 // Data | file to upload (optional) // uploads an image PetAPI.uploadFile(petId: petId, additionalMetadata: additionalMetadata, file: file) { (response, error) in @@ -398,7 +398,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Int64** | ID of pet to update | **additionalMetadata** | **String** | Additional data to pass to server | [optional] - **file** | **URL** | file to upload | [optional] + **file** | **Data** | file to upload | [optional] ### Return type @@ -417,7 +417,7 @@ Name | Type | Description | Notes # **uploadFileWithRequiredFile** ```swift - open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) + open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) ``` uploads an image (required) @@ -428,7 +428,7 @@ uploads an image (required) import PetstoreClient let petId = 987 // Int64 | ID of pet to update -let requiredFile = URL(string: "https://example.com")! // URL | file to upload +let requiredFile = 987 // Data | file to upload let additionalMetadata = "additionalMetadata_example" // String | Additional data to pass to server (optional) // uploads an image (required) @@ -449,7 +449,7 @@ PetAPI.uploadFileWithRequiredFile(petId: petId, requiredFile: requiredFile, addi Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Int64** | ID of pet to update | - **requiredFile** | **URL** | file to upload | + **requiredFile** | **Data** | file to upload | **additionalMetadata** | **String** | Additional data to pass to server | [optional] ### Return type diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index 6d02c24d05f9..6053e3c76c70 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -364,7 +364,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: Data? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testEndpointParametersWithRequestBuilder(number: number, double: double, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -398,7 +398,7 @@ open class FakeAPI { - parameter callback: (form) None (optional) - returns: RequestBuilder */ - open class func testEndpointParametersWithRequestBuilder(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil) -> RequestBuilder { + open class func testEndpointParametersWithRequestBuilder(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: Data? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil) -> RequestBuilder { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path let formParams: [String: Any?] = [ diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 5c220c11bb5f..2508cdaa417b 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -373,7 +373,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -395,7 +395,7 @@ open class PetAPI { - parameter file: (form) file to upload (optional) - returns: RequestBuilder */ - open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil) -> RequestBuilder { + open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil) -> RequestBuilder { var path = "/pet/{petId}/uploadImage" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" @@ -431,7 +431,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { + open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -453,7 +453,7 @@ open class PetAPI { - parameter additionalMetadata: (form) Additional data to pass to server (optional) - returns: RequestBuilder */ - open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil) -> RequestBuilder { + open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil) -> RequestBuilder { var path = "/fake/{petId}/uploadImageWithRequiredFile" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift index 60eafb2febe1..31f10e9fc0fc 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift @@ -20,14 +20,14 @@ public struct FormatTest: Codable, Hashable { public var double: Double? public var string: String? public var byte: Data - public var binary: URL? + public var binary: Data? public var date: Date public var dateTime: Date? public var uuid: UUID? public var password: String public var bigDecimal: Decimal? - public init(integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, number: Double, float: Float? = nil, double: Double? = nil, string: String? = nil, byte: Data, binary: URL? = nil, date: Date, dateTime: Date? = nil, uuid: UUID? = nil, password: String, bigDecimal: Decimal? = nil) { + public init(integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, number: Double, float: Float? = nil, double: Double? = nil, string: String? = nil, byte: Data, binary: Data? = nil, date: Date, dateTime: Date? = nil, uuid: UUID? = nil, password: String, bigDecimal: Decimal? = nil) { self.integer = integer self.int32 = int32 self.int64 = int64 diff --git a/samples/client/petstore/swift5/default/docs/FakeAPI.md b/samples/client/petstore/swift5/default/docs/FakeAPI.md index 46599ecd3b12..02f71eae3b20 100644 --- a/samples/client/petstore/swift5/default/docs/FakeAPI.md +++ b/samples/client/petstore/swift5/default/docs/FakeAPI.md @@ -416,7 +416,7 @@ No authorization required # **testEndpointParameters** ```swift - open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) + open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: Data? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) ``` Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -437,7 +437,7 @@ let int32 = 987 // Int | None (optional) let int64 = 987 // Int64 | None (optional) let float = 987 // Float | None (optional) let string = "string_example" // String | None (optional) -let binary = URL(string: "https://example.com")! // URL | None (optional) +let binary = 987 // Data | None (optional) let date = Date() // Date | None (optional) let dateTime = Date() // Date | None (optional) let password = "password_example" // String | None (optional) @@ -469,7 +469,7 @@ Name | Type | Description | Notes **int64** | **Int64** | None | [optional] **float** | **Float** | None | [optional] **string** | **String** | None | [optional] - **binary** | **URL** | None | [optional] + **binary** | **Data** | None | [optional] **date** | **Date** | None | [optional] **dateTime** | **Date** | None | [optional] **password** | **String** | None | [optional] diff --git a/samples/client/petstore/swift5/default/docs/FormatTest.md b/samples/client/petstore/swift5/default/docs/FormatTest.md index 55de2e05ecd9..6e6c67b2a4ff 100644 --- a/samples/client/petstore/swift5/default/docs/FormatTest.md +++ b/samples/client/petstore/swift5/default/docs/FormatTest.md @@ -11,7 +11,7 @@ Name | Type | Description | Notes **double** | **Double** | | [optional] **string** | **String** | | [optional] **byte** | **Data** | | -**binary** | **URL** | | [optional] +**binary** | **Data** | | [optional] **date** | **Date** | | **dateTime** | **Date** | | [optional] **uuid** | **UUID** | | [optional] diff --git a/samples/client/petstore/swift5/default/docs/PetAPI.md b/samples/client/petstore/swift5/default/docs/PetAPI.md index 1daf96285825..9f49985afb20 100644 --- a/samples/client/petstore/swift5/default/docs/PetAPI.md +++ b/samples/client/petstore/swift5/default/docs/PetAPI.md @@ -365,7 +365,7 @@ Void (empty response body) # **uploadFile** ```swift - open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) ``` uploads an image @@ -377,7 +377,7 @@ import PetstoreClient let petId = 987 // Int64 | ID of pet to update let additionalMetadata = "additionalMetadata_example" // String | Additional data to pass to server (optional) -let file = URL(string: "https://example.com")! // URL | file to upload (optional) +let file = 987 // Data | file to upload (optional) // uploads an image PetAPI.uploadFile(petId: petId, additionalMetadata: additionalMetadata, file: file) { (response, error) in @@ -398,7 +398,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Int64** | ID of pet to update | **additionalMetadata** | **String** | Additional data to pass to server | [optional] - **file** | **URL** | file to upload | [optional] + **file** | **Data** | file to upload | [optional] ### Return type @@ -417,7 +417,7 @@ Name | Type | Description | Notes # **uploadFileWithRequiredFile** ```swift - open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) + open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) ``` uploads an image (required) @@ -428,7 +428,7 @@ uploads an image (required) import PetstoreClient let petId = 987 // Int64 | ID of pet to update -let requiredFile = URL(string: "https://example.com")! // URL | file to upload +let requiredFile = 987 // Data | file to upload let additionalMetadata = "additionalMetadata_example" // String | Additional data to pass to server (optional) // uploads an image (required) @@ -449,7 +449,7 @@ PetAPI.uploadFileWithRequiredFile(petId: petId, requiredFile: requiredFile, addi Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Int64** | ID of pet to update | - **requiredFile** | **URL** | file to upload | + **requiredFile** | **Data** | file to upload | **additionalMetadata** | **String** | Additional data to pass to server | [optional] ### Return type diff --git a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 10fd471343e7..cf7a7a245023 100644 --- a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -373,7 +373,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -395,7 +395,7 @@ open class PetAPI { - parameter file: (form) file to upload (optional) - returns: RequestBuilder */ - open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil) -> RequestBuilder { + open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil) -> RequestBuilder { var path = "/pet/{petId}/uploadImage" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" diff --git a/samples/client/petstore/swift5/deprecated/docs/PetAPI.md b/samples/client/petstore/swift5/deprecated/docs/PetAPI.md index 3dd174824793..37ce9aac8f02 100644 --- a/samples/client/petstore/swift5/deprecated/docs/PetAPI.md +++ b/samples/client/petstore/swift5/deprecated/docs/PetAPI.md @@ -364,7 +364,7 @@ Void (empty response body) # **uploadFile** ```swift - open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) ``` uploads an image @@ -376,7 +376,7 @@ import PetstoreClient let petId = 987 // Int64 | ID of pet to update let additionalMetadata = "additionalMetadata_example" // String | Additional data to pass to server (optional) -let file = URL(string: "https://example.com")! // URL | file to upload (optional) +let file = 987 // Data | file to upload (optional) // uploads an image PetAPI.uploadFile(petId: petId, additionalMetadata: additionalMetadata, file: file) { (response, error) in @@ -397,7 +397,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Int64** | ID of pet to update | **additionalMetadata** | **String** | Additional data to pass to server | [optional] - **file** | **URL** | file to upload | [optional] + **file** | **Data** | file to upload | [optional] ### Return type diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index 99317dab5072..922761d41081 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -321,7 +321,7 @@ internal class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - internal class func testEndpointParameters(integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, number: Double, float: Float? = nil, double: Double, string: String? = nil, patternWithoutDelimiter: String, byte: Data, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + internal class func testEndpointParameters(integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, number: Double, float: Float? = nil, double: Double, string: String? = nil, patternWithoutDelimiter: String, byte: Data, binary: Data? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testEndpointParametersWithRequestBuilder(integer: integer, int32: int32, int64: int64, number: number, float: float, double: double, string: string, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -355,7 +355,7 @@ internal class FakeAPI { - parameter callback: (form) None (optional) - returns: RequestBuilder */ - internal class func testEndpointParametersWithRequestBuilder(integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, number: Double, float: Float? = nil, double: Double, string: String? = nil, patternWithoutDelimiter: String, byte: Data, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil) -> RequestBuilder { + internal class func testEndpointParametersWithRequestBuilder(integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, number: Double, float: Float? = nil, double: Double, string: String? = nil, patternWithoutDelimiter: String, byte: Data, binary: Data? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil) -> RequestBuilder { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path let formParams: [String: Any?] = [ diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index ab2066aa50c8..d31b0faad356 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -373,7 +373,7 @@ internal class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - internal class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { + internal class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -395,7 +395,7 @@ internal class PetAPI { - parameter file: (form) file to upload (optional) - returns: RequestBuilder */ - internal class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil) -> RequestBuilder { + internal class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil) -> RequestBuilder { var path = "/pet/{petId}/uploadImage" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" @@ -431,7 +431,7 @@ internal class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - internal class func uploadFileWithRequiredFile(petId: Int64, additionalMetadata: String? = nil, requiredFile: URL, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { + internal class func uploadFileWithRequiredFile(petId: Int64, additionalMetadata: String? = nil, requiredFile: Data, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { uploadFileWithRequiredFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, requiredFile: requiredFile).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -453,7 +453,7 @@ internal class PetAPI { - parameter requiredFile: (form) file to upload - returns: RequestBuilder */ - internal class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, requiredFile: URL) -> RequestBuilder { + internal class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, requiredFile: Data) -> RequestBuilder { var path = "/fake/{petId}/uploadImageWithRequiredFile" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift index c1eff9ffd18a..ca70e1b3f779 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift @@ -20,13 +20,13 @@ internal struct FormatTest: Codable, Hashable { internal var double: Double? internal var string: String? internal var byte: Data - internal var binary: URL? + internal var binary: Data? internal var date: Date internal var dateTime: Date? internal var uuid: UUID? internal var password: String - internal init(integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, number: Double, float: Float? = nil, double: Double? = nil, string: String? = nil, byte: Data, binary: URL? = nil, date: Date, dateTime: Date? = nil, uuid: UUID? = nil, password: String) { + internal init(integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, number: Double, float: Float? = nil, double: Double? = nil, string: String? = nil, byte: Data, binary: Data? = nil, date: Date, dateTime: Date? = nil, uuid: UUID? = nil, password: String) { self.integer = integer self.int32 = int32 self.int64 = int64 diff --git a/samples/client/petstore/swift5/nonPublicApi/docs/FakeAPI.md b/samples/client/petstore/swift5/nonPublicApi/docs/FakeAPI.md index 3b14781480ff..d87ab32309de 100644 --- a/samples/client/petstore/swift5/nonPublicApi/docs/FakeAPI.md +++ b/samples/client/petstore/swift5/nonPublicApi/docs/FakeAPI.md @@ -364,7 +364,7 @@ No authorization required # **testEndpointParameters** ```swift - internal class func testEndpointParameters(integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, number: Double, float: Float? = nil, double: Double, string: String? = nil, patternWithoutDelimiter: String, byte: Data, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) + internal class func testEndpointParameters(integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, number: Double, float: Float? = nil, double: Double, string: String? = nil, patternWithoutDelimiter: String, byte: Data, binary: Data? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) ``` Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -385,7 +385,7 @@ let double = 987 // Double | None let string = "string_example" // String | None (optional) let patternWithoutDelimiter = "patternWithoutDelimiter_example" // String | None let byte = 987 // Data | None -let binary = URL(string: "https://example.com")! // URL | None (optional) +let binary = 987 // Data | None (optional) let date = Date() // Date | None (optional) let dateTime = Date() // Date | None (optional) let password = "password_example" // String | None (optional) @@ -417,7 +417,7 @@ Name | Type | Description | Notes **string** | **String** | None | [optional] **patternWithoutDelimiter** | **String** | None | **byte** | **Data** | None | - **binary** | **URL** | None | [optional] + **binary** | **Data** | None | [optional] **date** | **Date** | None | [optional] **dateTime** | **Date** | None | [optional] **password** | **String** | None | [optional] diff --git a/samples/client/petstore/swift5/nonPublicApi/docs/FormatTest.md b/samples/client/petstore/swift5/nonPublicApi/docs/FormatTest.md index f74d94f6c46a..04e7113e3dc6 100644 --- a/samples/client/petstore/swift5/nonPublicApi/docs/FormatTest.md +++ b/samples/client/petstore/swift5/nonPublicApi/docs/FormatTest.md @@ -11,7 +11,7 @@ Name | Type | Description | Notes **double** | **Double** | | [optional] **string** | **String** | | [optional] **byte** | **Data** | | -**binary** | **URL** | | [optional] +**binary** | **Data** | | [optional] **date** | **Date** | | **dateTime** | **Date** | | [optional] **uuid** | **UUID** | | [optional] diff --git a/samples/client/petstore/swift5/nonPublicApi/docs/PetAPI.md b/samples/client/petstore/swift5/nonPublicApi/docs/PetAPI.md index 8fd9872c0e9a..8cc01d2f30ba 100644 --- a/samples/client/petstore/swift5/nonPublicApi/docs/PetAPI.md +++ b/samples/client/petstore/swift5/nonPublicApi/docs/PetAPI.md @@ -365,7 +365,7 @@ Void (empty response body) # **uploadFile** ```swift - internal class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) + internal class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) ``` uploads an image @@ -377,7 +377,7 @@ import PetstoreClient let petId = 987 // Int64 | ID of pet to update let additionalMetadata = "additionalMetadata_example" // String | Additional data to pass to server (optional) -let file = URL(string: "https://example.com")! // URL | file to upload (optional) +let file = 987 // Data | file to upload (optional) // uploads an image PetAPI.uploadFile(petId: petId, additionalMetadata: additionalMetadata, file: file) { (response, error) in @@ -398,7 +398,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Int64** | ID of pet to update | **additionalMetadata** | **String** | Additional data to pass to server | [optional] - **file** | **URL** | file to upload | [optional] + **file** | **Data** | file to upload | [optional] ### Return type @@ -417,7 +417,7 @@ Name | Type | Description | Notes # **uploadFileWithRequiredFile** ```swift - internal class func uploadFileWithRequiredFile(petId: Int64, additionalMetadata: String? = nil, requiredFile: URL, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) + internal class func uploadFileWithRequiredFile(petId: Int64, additionalMetadata: String? = nil, requiredFile: Data, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) ``` uploads an image (required) @@ -429,7 +429,7 @@ import PetstoreClient let petId = 987 // Int64 | ID of pet to update let additionalMetadata = "additionalMetadata_example" // String | Additional data to pass to server (optional) -let requiredFile = URL(string: "https://example.com")! // URL | file to upload +let requiredFile = 987 // Data | file to upload // uploads an image (required) PetAPI.uploadFileWithRequiredFile(petId: petId, additionalMetadata: additionalMetadata, requiredFile: requiredFile) { (response, error) in @@ -450,7 +450,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Int64** | ID of pet to update | **additionalMetadata** | **String** | Additional data to pass to server | [optional] - **requiredFile** | **URL** | file to upload | + **requiredFile** | **Data** | file to upload | ### Return type diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index f37371daf503..ccb06468f58f 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -321,7 +321,7 @@ import Foundation - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: Data? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testEndpointParametersWithRequestBuilder(number: number, double: double, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -355,7 +355,7 @@ import Foundation - parameter callback: (form) None (optional) - returns: RequestBuilder */ - open class func testEndpointParametersWithRequestBuilder(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil) -> RequestBuilder { + open class func testEndpointParametersWithRequestBuilder(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: Data? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil) -> RequestBuilder { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path let formParams: [String: Any?] = [ diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index a46c4b36d5c0..b971c7dc918d 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -373,7 +373,7 @@ import Foundation - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -395,7 +395,7 @@ import Foundation - parameter file: (form) file to upload (optional) - returns: RequestBuilder */ - open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil) -> RequestBuilder { + open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil) -> RequestBuilder { var path = "/pet/{petId}/uploadImage" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" @@ -431,7 +431,7 @@ import Foundation - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { + open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -453,7 +453,7 @@ import Foundation - parameter additionalMetadata: (form) Additional data to pass to server (optional) - returns: RequestBuilder */ - open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil) -> RequestBuilder { + open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil) -> RequestBuilder { var path = "/fake/{petId}/uploadImageWithRequiredFile" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift index 70920c84fa8c..22721d60b179 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift @@ -45,13 +45,13 @@ import AnyCodable } public var string: String? public var byte: Data - public var binary: URL? + public var binary: Data? public var date: Date public var dateTime: Date? public var uuid: UUID? public var password: String - public init(integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, number: Double, float: Float? = nil, double: Double? = nil, string: String? = nil, byte: Data, binary: URL? = nil, date: Date, dateTime: Date? = nil, uuid: UUID? = nil, password: String) { + public init(integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, number: Double, float: Float? = nil, double: Double? = nil, string: String? = nil, byte: Data, binary: Data? = nil, date: Date, dateTime: Date? = nil, uuid: UUID? = nil, password: String) { self.integer = integer self.int32 = int32 self.int64 = int64 diff --git a/samples/client/petstore/swift5/objcCompatible/docs/FakeAPI.md b/samples/client/petstore/swift5/objcCompatible/docs/FakeAPI.md index 712fa591f2f4..95f2338fd6a9 100644 --- a/samples/client/petstore/swift5/objcCompatible/docs/FakeAPI.md +++ b/samples/client/petstore/swift5/objcCompatible/docs/FakeAPI.md @@ -364,7 +364,7 @@ No authorization required # **testEndpointParameters** ```swift - open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) + open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: Data? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) ``` Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -385,7 +385,7 @@ let int32 = 987 // Int | None (optional) let int64 = 987 // Int64 | None (optional) let float = 987 // Float | None (optional) let string = "string_example" // String | None (optional) -let binary = URL(string: "https://example.com")! // URL | None (optional) +let binary = 987 // Data | None (optional) let date = Date() // Date | None (optional) let dateTime = Date() // Date | None (optional) let password = "password_example" // String | None (optional) @@ -417,7 +417,7 @@ Name | Type | Description | Notes **int64** | **Int64** | None | [optional] **float** | **Float** | None | [optional] **string** | **String** | None | [optional] - **binary** | **URL** | None | [optional] + **binary** | **Data** | None | [optional] **date** | **Date** | None | [optional] **dateTime** | **Date** | None | [optional] **password** | **String** | None | [optional] diff --git a/samples/client/petstore/swift5/objcCompatible/docs/FormatTest.md b/samples/client/petstore/swift5/objcCompatible/docs/FormatTest.md index f74d94f6c46a..04e7113e3dc6 100644 --- a/samples/client/petstore/swift5/objcCompatible/docs/FormatTest.md +++ b/samples/client/petstore/swift5/objcCompatible/docs/FormatTest.md @@ -11,7 +11,7 @@ Name | Type | Description | Notes **double** | **Double** | | [optional] **string** | **String** | | [optional] **byte** | **Data** | | -**binary** | **URL** | | [optional] +**binary** | **Data** | | [optional] **date** | **Date** | | **dateTime** | **Date** | | [optional] **uuid** | **UUID** | | [optional] diff --git a/samples/client/petstore/swift5/objcCompatible/docs/PetAPI.md b/samples/client/petstore/swift5/objcCompatible/docs/PetAPI.md index c03e60bc084e..bc9ffab82d3d 100644 --- a/samples/client/petstore/swift5/objcCompatible/docs/PetAPI.md +++ b/samples/client/petstore/swift5/objcCompatible/docs/PetAPI.md @@ -365,7 +365,7 @@ Void (empty response body) # **uploadFile** ```swift - open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) ``` uploads an image @@ -377,7 +377,7 @@ import PetstoreClient let petId = 987 // Int64 | ID of pet to update let additionalMetadata = "additionalMetadata_example" // String | Additional data to pass to server (optional) -let file = URL(string: "https://example.com")! // URL | file to upload (optional) +let file = 987 // Data | file to upload (optional) // uploads an image PetAPI.uploadFile(petId: petId, additionalMetadata: additionalMetadata, file: file) { (response, error) in @@ -398,7 +398,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Int64** | ID of pet to update | **additionalMetadata** | **String** | Additional data to pass to server | [optional] - **file** | **URL** | file to upload | [optional] + **file** | **Data** | file to upload | [optional] ### Return type @@ -417,7 +417,7 @@ Name | Type | Description | Notes # **uploadFileWithRequiredFile** ```swift - open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) + open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) ``` uploads an image (required) @@ -428,7 +428,7 @@ uploads an image (required) import PetstoreClient let petId = 987 // Int64 | ID of pet to update -let requiredFile = URL(string: "https://example.com")! // URL | file to upload +let requiredFile = 987 // Data | file to upload let additionalMetadata = "additionalMetadata_example" // String | Additional data to pass to server (optional) // uploads an image (required) @@ -449,7 +449,7 @@ PetAPI.uploadFileWithRequiredFile(petId: petId, requiredFile: requiredFile, addi Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Int64** | ID of pet to update | - **requiredFile** | **URL** | file to upload | + **requiredFile** | **Data** | file to upload | **additionalMetadata** | **String** | Additional data to pass to server | [optional] ### Return type diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index eadb85f7b623..c3d566748fa7 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -336,7 +336,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Promise */ - open class func testEndpointParameters( number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Promise { + open class func testEndpointParameters( number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: Data? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Promise { let deferred = Promise.pending() testEndpointParametersWithRequestBuilder(number: number, double: double, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback).execute(apiResponseQueue) { result -> Void in switch result { @@ -372,7 +372,7 @@ open class FakeAPI { - parameter callback: (form) None (optional) - returns: RequestBuilder */ - open class func testEndpointParametersWithRequestBuilder(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil) -> RequestBuilder { + open class func testEndpointParametersWithRequestBuilder(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: Data? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil) -> RequestBuilder { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path let formParams: [String: Any?] = [ diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 4160df0cc9e0..c22c84feb337 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -388,7 +388,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Promise */ - open class func uploadFile( petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Promise { + open class func uploadFile( petId: Int64, additionalMetadata: String? = nil, file: Data? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Promise { let deferred = Promise.pending() uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute(apiResponseQueue) { result -> Void in switch result { @@ -412,7 +412,7 @@ open class PetAPI { - parameter file: (form) file to upload (optional) - returns: RequestBuilder */ - open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil) -> RequestBuilder { + open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil) -> RequestBuilder { var path = "/pet/{petId}/uploadImage" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" @@ -448,7 +448,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Promise */ - open class func uploadFileWithRequiredFile( petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Promise { + open class func uploadFileWithRequiredFile( petId: Int64, requiredFile: Data, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Promise { let deferred = Promise.pending() uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute(apiResponseQueue) { result -> Void in switch result { @@ -472,7 +472,7 @@ open class PetAPI { - parameter additionalMetadata: (form) Additional data to pass to server (optional) - returns: RequestBuilder */ - open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil) -> RequestBuilder { + open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil) -> RequestBuilder { var path = "/fake/{petId}/uploadImageWithRequiredFile" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift index 114c884efc5e..e407645ef988 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift @@ -20,13 +20,13 @@ public struct FormatTest: Codable, Hashable { public var double: Double? public var string: String? public var byte: Data - public var binary: URL? + public var binary: Data? public var date: Date public var dateTime: Date? public var uuid: UUID? public var password: String - public init(integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, number: Double, float: Float? = nil, double: Double? = nil, string: String? = nil, byte: Data, binary: URL? = nil, date: Date, dateTime: Date? = nil, uuid: UUID? = nil, password: String) { + public init(integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, number: Double, float: Float? = nil, double: Double? = nil, string: String? = nil, byte: Data, binary: Data? = nil, date: Date, dateTime: Date? = nil, uuid: UUID? = nil, password: String) { self.integer = integer self.int32 = int32 self.int64 = int64 diff --git a/samples/client/petstore/swift5/promisekitLibrary/docs/FakeAPI.md b/samples/client/petstore/swift5/promisekitLibrary/docs/FakeAPI.md index f2b3e2abe1e1..579c4ef79645 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/docs/FakeAPI.md +++ b/samples/client/petstore/swift5/promisekitLibrary/docs/FakeAPI.md @@ -343,7 +343,7 @@ No authorization required # **testEndpointParameters** ```swift - open class func testEndpointParameters( number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil) -> Promise + open class func testEndpointParameters( number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: Data? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil) -> Promise ``` Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -364,7 +364,7 @@ let int32 = 987 // Int | None (optional) let int64 = 987 // Int64 | None (optional) let float = 987 // Float | None (optional) let string = "string_example" // String | None (optional) -let binary = URL(string: "https://example.com")! // URL | None (optional) +let binary = 987 // Data | None (optional) let date = Date() // Date | None (optional) let dateTime = Date() // Date | None (optional) let password = "password_example" // String | None (optional) @@ -393,7 +393,7 @@ Name | Type | Description | Notes **int64** | **Int64** | None | [optional] **float** | **Float** | None | [optional] **string** | **String** | None | [optional] - **binary** | **URL** | None | [optional] + **binary** | **Data** | None | [optional] **date** | **Date** | None | [optional] **dateTime** | **Date** | None | [optional] **password** | **String** | None | [optional] diff --git a/samples/client/petstore/swift5/promisekitLibrary/docs/FormatTest.md b/samples/client/petstore/swift5/promisekitLibrary/docs/FormatTest.md index f74d94f6c46a..04e7113e3dc6 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/docs/FormatTest.md +++ b/samples/client/petstore/swift5/promisekitLibrary/docs/FormatTest.md @@ -11,7 +11,7 @@ Name | Type | Description | Notes **double** | **Double** | | [optional] **string** | **String** | | [optional] **byte** | **Data** | | -**binary** | **URL** | | [optional] +**binary** | **Data** | | [optional] **date** | **Date** | | **dateTime** | **Date** | | [optional] **uuid** | **UUID** | | [optional] diff --git a/samples/client/petstore/swift5/promisekitLibrary/docs/PetAPI.md b/samples/client/petstore/swift5/promisekitLibrary/docs/PetAPI.md index e767ea772f89..2decebaf14e7 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/docs/PetAPI.md +++ b/samples/client/petstore/swift5/promisekitLibrary/docs/PetAPI.md @@ -344,7 +344,7 @@ Void (empty response body) # **uploadFile** ```swift - open class func uploadFile( petId: Int64, additionalMetadata: String? = nil, file: URL? = nil) -> Promise + open class func uploadFile( petId: Int64, additionalMetadata: String? = nil, file: Data? = nil) -> Promise ``` uploads an image @@ -356,7 +356,7 @@ import PetstoreClient let petId = 987 // Int64 | ID of pet to update let additionalMetadata = "additionalMetadata_example" // String | Additional data to pass to server (optional) -let file = URL(string: "https://example.com")! // URL | file to upload (optional) +let file = 987 // Data | file to upload (optional) // uploads an image PetAPI.uploadFile(petId: petId, additionalMetadata: additionalMetadata, file: file).then { @@ -374,7 +374,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Int64** | ID of pet to update | **additionalMetadata** | **String** | Additional data to pass to server | [optional] - **file** | **URL** | file to upload | [optional] + **file** | **Data** | file to upload | [optional] ### Return type @@ -393,7 +393,7 @@ Name | Type | Description | Notes # **uploadFileWithRequiredFile** ```swift - open class func uploadFileWithRequiredFile( petId: Int64, requiredFile: URL, additionalMetadata: String? = nil) -> Promise + open class func uploadFileWithRequiredFile( petId: Int64, requiredFile: Data, additionalMetadata: String? = nil) -> Promise ``` uploads an image (required) @@ -404,7 +404,7 @@ uploads an image (required) import PetstoreClient let petId = 987 // Int64 | ID of pet to update -let requiredFile = URL(string: "https://example.com")! // URL | file to upload +let requiredFile = 987 // Data | file to upload let additionalMetadata = "additionalMetadata_example" // String | Additional data to pass to server (optional) // uploads an image (required) @@ -422,7 +422,7 @@ PetAPI.uploadFileWithRequiredFile(petId: petId, requiredFile: requiredFile, addi Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Int64** | ID of pet to update | - **requiredFile** | **URL** | file to upload | + **requiredFile** | **Data** | file to upload | **additionalMetadata** | **String** | Additional data to pass to server | [optional] ### Return type diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index cf92424d9cc1..4a16bb585577 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -321,7 +321,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: Data? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testEndpointParametersWithRequestBuilder(number: number, double: double, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -355,7 +355,7 @@ open class FakeAPI { - parameter callback: (form) None (optional) - returns: RequestBuilder */ - open class func testEndpointParametersWithRequestBuilder(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil) -> RequestBuilder { + open class func testEndpointParametersWithRequestBuilder(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: Data? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil) -> RequestBuilder { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path let formParams: [String: Any?] = [ diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index a1fe0d12b1da..37c0edcb59b4 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -373,7 +373,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -395,7 +395,7 @@ open class PetAPI { - parameter file: (form) file to upload (optional) - returns: RequestBuilder */ - open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil) -> RequestBuilder { + open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil) -> RequestBuilder { var path = "/pet/{petId}/uploadImage" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" @@ -431,7 +431,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { + open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -453,7 +453,7 @@ open class PetAPI { - parameter additionalMetadata: (form) Additional data to pass to server (optional) - returns: RequestBuilder */ - open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil) -> RequestBuilder { + open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil) -> RequestBuilder { var path = "/fake/{petId}/uploadImageWithRequiredFile" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift index bf2d4131948e..1f5c40b7b6f7 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift @@ -20,13 +20,13 @@ public struct FormatTest: Codable, Hashable { public private(set) var double: Double? public private(set) var string: String? public private(set) var byte: Data - public private(set) var binary: URL? + public private(set) var binary: Data? public private(set) var date: Date public private(set) var dateTime: Date? public private(set) var uuid: UUID? public private(set) var password: String - public init(integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, number: Double, float: Float? = nil, double: Double? = nil, string: String? = nil, byte: Data, binary: URL? = nil, date: Date, dateTime: Date? = nil, uuid: UUID? = nil, password: String) { + public init(integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, number: Double, float: Float? = nil, double: Double? = nil, string: String? = nil, byte: Data, binary: Data? = nil, date: Date, dateTime: Date? = nil, uuid: UUID? = nil, password: String) { self.integer = integer self.int32 = int32 self.int64 = int64 diff --git a/samples/client/petstore/swift5/readonlyProperties/docs/FakeAPI.md b/samples/client/petstore/swift5/readonlyProperties/docs/FakeAPI.md index 543869c0d2e0..e5c4e3bb035f 100644 --- a/samples/client/petstore/swift5/readonlyProperties/docs/FakeAPI.md +++ b/samples/client/petstore/swift5/readonlyProperties/docs/FakeAPI.md @@ -364,7 +364,7 @@ No authorization required # **testEndpointParameters** ```swift - open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) + open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: Data? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) ``` Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -385,7 +385,7 @@ let int32 = 987 // Int | None (optional) let int64 = 987 // Int64 | None (optional) let float = 987 // Float | None (optional) let string = "string_example" // String | None (optional) -let binary = URL(string: "https://example.com")! // URL | None (optional) +let binary = 987 // Data | None (optional) let date = Date() // Date | None (optional) let dateTime = Date() // Date | None (optional) let password = "password_example" // String | None (optional) @@ -417,7 +417,7 @@ Name | Type | Description | Notes **int64** | **Int64** | None | [optional] **float** | **Float** | None | [optional] **string** | **String** | None | [optional] - **binary** | **URL** | None | [optional] + **binary** | **Data** | None | [optional] **date** | **Date** | None | [optional] **dateTime** | **Date** | None | [optional] **password** | **String** | None | [optional] diff --git a/samples/client/petstore/swift5/readonlyProperties/docs/FormatTest.md b/samples/client/petstore/swift5/readonlyProperties/docs/FormatTest.md index f74d94f6c46a..04e7113e3dc6 100644 --- a/samples/client/petstore/swift5/readonlyProperties/docs/FormatTest.md +++ b/samples/client/petstore/swift5/readonlyProperties/docs/FormatTest.md @@ -11,7 +11,7 @@ Name | Type | Description | Notes **double** | **Double** | | [optional] **string** | **String** | | [optional] **byte** | **Data** | | -**binary** | **URL** | | [optional] +**binary** | **Data** | | [optional] **date** | **Date** | | **dateTime** | **Date** | | [optional] **uuid** | **UUID** | | [optional] diff --git a/samples/client/petstore/swift5/readonlyProperties/docs/PetAPI.md b/samples/client/petstore/swift5/readonlyProperties/docs/PetAPI.md index 27efe0833476..76a34913c823 100644 --- a/samples/client/petstore/swift5/readonlyProperties/docs/PetAPI.md +++ b/samples/client/petstore/swift5/readonlyProperties/docs/PetAPI.md @@ -365,7 +365,7 @@ Void (empty response body) # **uploadFile** ```swift - open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) ``` uploads an image @@ -377,7 +377,7 @@ import PetstoreClient let petId = 987 // Int64 | ID of pet to update let additionalMetadata = "additionalMetadata_example" // String | Additional data to pass to server (optional) -let file = URL(string: "https://example.com")! // URL | file to upload (optional) +let file = 987 // Data | file to upload (optional) // uploads an image PetAPI.uploadFile(petId: petId, additionalMetadata: additionalMetadata, file: file) { (response, error) in @@ -398,7 +398,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Int64** | ID of pet to update | **additionalMetadata** | **String** | Additional data to pass to server | [optional] - **file** | **URL** | file to upload | [optional] + **file** | **Data** | file to upload | [optional] ### Return type @@ -417,7 +417,7 @@ Name | Type | Description | Notes # **uploadFileWithRequiredFile** ```swift - open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) + open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) ``` uploads an image (required) @@ -428,7 +428,7 @@ uploads an image (required) import PetstoreClient let petId = 987 // Int64 | ID of pet to update -let requiredFile = URL(string: "https://example.com")! // URL | file to upload +let requiredFile = 987 // Data | file to upload let additionalMetadata = "additionalMetadata_example" // String | Additional data to pass to server (optional) // uploads an image (required) @@ -449,7 +449,7 @@ PetAPI.uploadFileWithRequiredFile(petId: petId, requiredFile: requiredFile, addi Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Int64** | ID of pet to update | - **requiredFile** | **URL** | file to upload | + **requiredFile** | **Data** | file to upload | **additionalMetadata** | **String** | Additional data to pass to server | [optional] ### Return type diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index a1eb0539707f..87dbbfac7d9a 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -321,7 +321,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the result */ - open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) { + open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: Data? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) { testEndpointParametersWithRequestBuilder(number: number, double: double, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -355,7 +355,7 @@ open class FakeAPI { - parameter callback: (form) None (optional) - returns: RequestBuilder */ - open class func testEndpointParametersWithRequestBuilder(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil) -> RequestBuilder { + open class func testEndpointParametersWithRequestBuilder(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: Data? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil) -> RequestBuilder { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path let formParams: [String: Any?] = [ diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 521125d8db8b..4715f57fef03 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -373,7 +373,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the result */ - open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) { + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) { uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -395,7 +395,7 @@ open class PetAPI { - parameter file: (form) file to upload (optional) - returns: RequestBuilder */ - open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil) -> RequestBuilder { + open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil) -> RequestBuilder { var path = "/pet/{petId}/uploadImage" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" @@ -431,7 +431,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the result */ - open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) { + open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) { uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -453,7 +453,7 @@ open class PetAPI { - parameter additionalMetadata: (form) Additional data to pass to server (optional) - returns: RequestBuilder */ - open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil) -> RequestBuilder { + open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil) -> RequestBuilder { var path = "/fake/{petId}/uploadImageWithRequiredFile" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift index 114c884efc5e..e407645ef988 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift @@ -20,13 +20,13 @@ public struct FormatTest: Codable, Hashable { public var double: Double? public var string: String? public var byte: Data - public var binary: URL? + public var binary: Data? public var date: Date public var dateTime: Date? public var uuid: UUID? public var password: String - public init(integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, number: Double, float: Float? = nil, double: Double? = nil, string: String? = nil, byte: Data, binary: URL? = nil, date: Date, dateTime: Date? = nil, uuid: UUID? = nil, password: String) { + public init(integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, number: Double, float: Float? = nil, double: Double? = nil, string: String? = nil, byte: Data, binary: Data? = nil, date: Date, dateTime: Date? = nil, uuid: UUID? = nil, password: String) { self.integer = integer self.int32 = int32 self.int64 = int64 diff --git a/samples/client/petstore/swift5/resultLibrary/docs/FakeAPI.md b/samples/client/petstore/swift5/resultLibrary/docs/FakeAPI.md index 543869c0d2e0..e5c4e3bb035f 100644 --- a/samples/client/petstore/swift5/resultLibrary/docs/FakeAPI.md +++ b/samples/client/petstore/swift5/resultLibrary/docs/FakeAPI.md @@ -364,7 +364,7 @@ No authorization required # **testEndpointParameters** ```swift - open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) + open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: Data? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) ``` Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -385,7 +385,7 @@ let int32 = 987 // Int | None (optional) let int64 = 987 // Int64 | None (optional) let float = 987 // Float | None (optional) let string = "string_example" // String | None (optional) -let binary = URL(string: "https://example.com")! // URL | None (optional) +let binary = 987 // Data | None (optional) let date = Date() // Date | None (optional) let dateTime = Date() // Date | None (optional) let password = "password_example" // String | None (optional) @@ -417,7 +417,7 @@ Name | Type | Description | Notes **int64** | **Int64** | None | [optional] **float** | **Float** | None | [optional] **string** | **String** | None | [optional] - **binary** | **URL** | None | [optional] + **binary** | **Data** | None | [optional] **date** | **Date** | None | [optional] **dateTime** | **Date** | None | [optional] **password** | **String** | None | [optional] diff --git a/samples/client/petstore/swift5/resultLibrary/docs/FormatTest.md b/samples/client/petstore/swift5/resultLibrary/docs/FormatTest.md index f74d94f6c46a..04e7113e3dc6 100644 --- a/samples/client/petstore/swift5/resultLibrary/docs/FormatTest.md +++ b/samples/client/petstore/swift5/resultLibrary/docs/FormatTest.md @@ -11,7 +11,7 @@ Name | Type | Description | Notes **double** | **Double** | | [optional] **string** | **String** | | [optional] **byte** | **Data** | | -**binary** | **URL** | | [optional] +**binary** | **Data** | | [optional] **date** | **Date** | | **dateTime** | **Date** | | [optional] **uuid** | **UUID** | | [optional] diff --git a/samples/client/petstore/swift5/resultLibrary/docs/PetAPI.md b/samples/client/petstore/swift5/resultLibrary/docs/PetAPI.md index 27efe0833476..76a34913c823 100644 --- a/samples/client/petstore/swift5/resultLibrary/docs/PetAPI.md +++ b/samples/client/petstore/swift5/resultLibrary/docs/PetAPI.md @@ -365,7 +365,7 @@ Void (empty response body) # **uploadFile** ```swift - open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) ``` uploads an image @@ -377,7 +377,7 @@ import PetstoreClient let petId = 987 // Int64 | ID of pet to update let additionalMetadata = "additionalMetadata_example" // String | Additional data to pass to server (optional) -let file = URL(string: "https://example.com")! // URL | file to upload (optional) +let file = 987 // Data | file to upload (optional) // uploads an image PetAPI.uploadFile(petId: petId, additionalMetadata: additionalMetadata, file: file) { (response, error) in @@ -398,7 +398,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Int64** | ID of pet to update | **additionalMetadata** | **String** | Additional data to pass to server | [optional] - **file** | **URL** | file to upload | [optional] + **file** | **Data** | file to upload | [optional] ### Return type @@ -417,7 +417,7 @@ Name | Type | Description | Notes # **uploadFileWithRequiredFile** ```swift - open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) + open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) ``` uploads an image (required) @@ -428,7 +428,7 @@ uploads an image (required) import PetstoreClient let petId = 987 // Int64 | ID of pet to update -let requiredFile = URL(string: "https://example.com")! // URL | file to upload +let requiredFile = 987 // Data | file to upload let additionalMetadata = "additionalMetadata_example" // String | Additional data to pass to server (optional) // uploads an image (required) @@ -449,7 +449,7 @@ PetAPI.uploadFileWithRequiredFile(petId: petId, requiredFile: requiredFile, addi Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Int64** | ID of pet to update | - **requiredFile** | **URL** | file to upload | + **requiredFile** | **Data** | file to upload | **additionalMetadata** | **String** | Additional data to pass to server | [optional] ### Return type diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index 06b88c2a71fb..1d70f5eb5f15 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -350,7 +350,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Observable */ - open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable { + open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: Data? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable { return Observable.create { observer -> Disposable in testEndpointParametersWithRequestBuilder(number: number, double: double, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback).execute(apiResponseQueue) { result -> Void in switch result { @@ -388,7 +388,7 @@ open class FakeAPI { - parameter callback: (form) None (optional) - returns: RequestBuilder */ - open class func testEndpointParametersWithRequestBuilder(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil) -> RequestBuilder { + open class func testEndpointParametersWithRequestBuilder(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: Data? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil) -> RequestBuilder { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path let formParams: [String: Any?] = [ diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index bb299e77d8c9..27f13f76d266 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -402,7 +402,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Observable */ - open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable { + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable { return Observable.create { observer -> Disposable in uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute(apiResponseQueue) { result -> Void in switch result { @@ -428,7 +428,7 @@ open class PetAPI { - parameter file: (form) file to upload (optional) - returns: RequestBuilder */ - open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil) -> RequestBuilder { + open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil) -> RequestBuilder { var path = "/pet/{petId}/uploadImage" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" @@ -464,7 +464,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Observable */ - open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable { + open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable { return Observable.create { observer -> Disposable in uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute(apiResponseQueue) { result -> Void in switch result { @@ -490,7 +490,7 @@ open class PetAPI { - parameter additionalMetadata: (form) Additional data to pass to server (optional) - returns: RequestBuilder */ - open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil) -> RequestBuilder { + open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil) -> RequestBuilder { var path = "/fake/{petId}/uploadImageWithRequiredFile" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift index 114c884efc5e..e407645ef988 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift @@ -20,13 +20,13 @@ public struct FormatTest: Codable, Hashable { public var double: Double? public var string: String? public var byte: Data - public var binary: URL? + public var binary: Data? public var date: Date public var dateTime: Date? public var uuid: UUID? public var password: String - public init(integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, number: Double, float: Float? = nil, double: Double? = nil, string: String? = nil, byte: Data, binary: URL? = nil, date: Date, dateTime: Date? = nil, uuid: UUID? = nil, password: String) { + public init(integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, number: Double, float: Float? = nil, double: Double? = nil, string: String? = nil, byte: Data, binary: Data? = nil, date: Date, dateTime: Date? = nil, uuid: UUID? = nil, password: String) { self.integer = integer self.int32 = int32 self.int64 = int64 diff --git a/samples/client/petstore/swift5/rxswiftLibrary/docs/FakeAPI.md b/samples/client/petstore/swift5/rxswiftLibrary/docs/FakeAPI.md index 9ca07180e074..1885346e940f 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/docs/FakeAPI.md +++ b/samples/client/petstore/swift5/rxswiftLibrary/docs/FakeAPI.md @@ -300,7 +300,7 @@ No authorization required # **testEndpointParameters** ```swift - open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil) -> Observable + open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: Data? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil) -> Observable ``` Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -321,7 +321,7 @@ let int32 = 987 // Int | None (optional) let int64 = 987 // Int64 | None (optional) let float = 987 // Float | None (optional) let string = "string_example" // String | None (optional) -let binary = URL(string: "https://example.com")! // URL | None (optional) +let binary = 987 // Data | None (optional) let date = Date() // Date | None (optional) let dateTime = Date() // Date | None (optional) let password = "password_example" // String | None (optional) @@ -343,7 +343,7 @@ Name | Type | Description | Notes **int64** | **Int64** | None | [optional] **float** | **Float** | None | [optional] **string** | **String** | None | [optional] - **binary** | **URL** | None | [optional] + **binary** | **Data** | None | [optional] **date** | **Date** | None | [optional] **dateTime** | **Date** | None | [optional] **password** | **String** | None | [optional] diff --git a/samples/client/petstore/swift5/rxswiftLibrary/docs/FormatTest.md b/samples/client/petstore/swift5/rxswiftLibrary/docs/FormatTest.md index f74d94f6c46a..04e7113e3dc6 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/docs/FormatTest.md +++ b/samples/client/petstore/swift5/rxswiftLibrary/docs/FormatTest.md @@ -11,7 +11,7 @@ Name | Type | Description | Notes **double** | **Double** | | [optional] **string** | **String** | | [optional] **byte** | **Data** | | -**binary** | **URL** | | [optional] +**binary** | **Data** | | [optional] **date** | **Date** | | **dateTime** | **Date** | | [optional] **uuid** | **UUID** | | [optional] diff --git a/samples/client/petstore/swift5/rxswiftLibrary/docs/PetAPI.md b/samples/client/petstore/swift5/rxswiftLibrary/docs/PetAPI.md index c0ec8a91fb4c..12885aa977fc 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/docs/PetAPI.md +++ b/samples/client/petstore/swift5/rxswiftLibrary/docs/PetAPI.md @@ -295,7 +295,7 @@ Void (empty response body) # **uploadFile** ```swift - open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil) -> Observable + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil) -> Observable ``` uploads an image @@ -307,7 +307,7 @@ import PetstoreClient let petId = 987 // Int64 | ID of pet to update let additionalMetadata = "additionalMetadata_example" // String | Additional data to pass to server (optional) -let file = URL(string: "https://example.com")! // URL | file to upload (optional) +let file = 987 // Data | file to upload (optional) // TODO RxSwift sample code not yet implemented. To contribute, please open a ticket via http://github.com/OpenAPITools/openapi-generator/issues/new ``` @@ -318,7 +318,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Int64** | ID of pet to update | **additionalMetadata** | **String** | Additional data to pass to server | [optional] - **file** | **URL** | file to upload | [optional] + **file** | **Data** | file to upload | [optional] ### Return type @@ -337,7 +337,7 @@ Name | Type | Description | Notes # **uploadFileWithRequiredFile** ```swift - open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil) -> Observable + open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil) -> Observable ``` uploads an image (required) @@ -348,7 +348,7 @@ uploads an image (required) import PetstoreClient let petId = 987 // Int64 | ID of pet to update -let requiredFile = URL(string: "https://example.com")! // URL | file to upload +let requiredFile = 987 // Data | file to upload let additionalMetadata = "additionalMetadata_example" // String | Additional data to pass to server (optional) // TODO RxSwift sample code not yet implemented. To contribute, please open a ticket via http://github.com/OpenAPITools/openapi-generator/issues/new @@ -359,7 +359,7 @@ let additionalMetadata = "additionalMetadata_example" // String | Additional dat Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Int64** | ID of pet to update | - **requiredFile** | **URL** | file to upload | + **requiredFile** | **Data** | file to upload | **additionalMetadata** | **String** | Additional data to pass to server | [optional] ### Return type diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift index cf92424d9cc1..4a16bb585577 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift @@ -321,7 +321,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: Data? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testEndpointParametersWithRequestBuilder(number: number, double: double, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -355,7 +355,7 @@ open class FakeAPI { - parameter callback: (form) None (optional) - returns: RequestBuilder */ - open class func testEndpointParametersWithRequestBuilder(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil) -> RequestBuilder { + open class func testEndpointParametersWithRequestBuilder(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: Data? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil) -> RequestBuilder { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path let formParams: [String: Any?] = [ diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs/PetAPI.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs/PetAPI.swift index a1fe0d12b1da..37c0edcb59b4 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs/PetAPI.swift @@ -373,7 +373,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -395,7 +395,7 @@ open class PetAPI { - parameter file: (form) file to upload (optional) - returns: RequestBuilder */ - open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil) -> RequestBuilder { + open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil) -> RequestBuilder { var path = "/pet/{petId}/uploadImage" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" @@ -431,7 +431,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { + open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -453,7 +453,7 @@ open class PetAPI { - parameter additionalMetadata: (form) Additional data to pass to server (optional) - returns: RequestBuilder */ - open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil) -> RequestBuilder { + open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil) -> RequestBuilder { var path = "/fake/{petId}/uploadImageWithRequiredFile" let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/FormatTest.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/FormatTest.swift index 0ae5bd7d8a2b..546a229931ec 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/FormatTest.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/FormatTest.swift @@ -20,13 +20,13 @@ public final class FormatTest: Codable, Hashable { public var double: Double? public var string: String? public var byte: Data - public var binary: URL? + public var binary: Data? public var date: Date public var dateTime: Date? public var uuid: UUID? public var password: String - public init(integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, number: Double, float: Float? = nil, double: Double? = nil, string: String? = nil, byte: Data, binary: URL? = nil, date: Date, dateTime: Date? = nil, uuid: UUID? = nil, password: String) { + public init(integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, number: Double, float: Float? = nil, double: Double? = nil, string: String? = nil, byte: Data, binary: Data? = nil, date: Date, dateTime: Date? = nil, uuid: UUID? = nil, password: String) { self.integer = integer self.int32 = int32 self.int64 = int64 diff --git a/samples/client/petstore/swift5/urlsessionLibrary/docs/FakeAPI.md b/samples/client/petstore/swift5/urlsessionLibrary/docs/FakeAPI.md index 543869c0d2e0..e5c4e3bb035f 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/docs/FakeAPI.md +++ b/samples/client/petstore/swift5/urlsessionLibrary/docs/FakeAPI.md @@ -364,7 +364,7 @@ No authorization required # **testEndpointParameters** ```swift - open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) + open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: Data? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) ``` Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -385,7 +385,7 @@ let int32 = 987 // Int | None (optional) let int64 = 987 // Int64 | None (optional) let float = 987 // Float | None (optional) let string = "string_example" // String | None (optional) -let binary = URL(string: "https://example.com")! // URL | None (optional) +let binary = 987 // Data | None (optional) let date = Date() // Date | None (optional) let dateTime = Date() // Date | None (optional) let password = "password_example" // String | None (optional) @@ -417,7 +417,7 @@ Name | Type | Description | Notes **int64** | **Int64** | None | [optional] **float** | **Float** | None | [optional] **string** | **String** | None | [optional] - **binary** | **URL** | None | [optional] + **binary** | **Data** | None | [optional] **date** | **Date** | None | [optional] **dateTime** | **Date** | None | [optional] **password** | **String** | None | [optional] diff --git a/samples/client/petstore/swift5/urlsessionLibrary/docs/FormatTest.md b/samples/client/petstore/swift5/urlsessionLibrary/docs/FormatTest.md index f74d94f6c46a..04e7113e3dc6 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/docs/FormatTest.md +++ b/samples/client/petstore/swift5/urlsessionLibrary/docs/FormatTest.md @@ -11,7 +11,7 @@ Name | Type | Description | Notes **double** | **Double** | | [optional] **string** | **String** | | [optional] **byte** | **Data** | | -**binary** | **URL** | | [optional] +**binary** | **Data** | | [optional] **date** | **Date** | | **dateTime** | **Date** | | [optional] **uuid** | **UUID** | | [optional] diff --git a/samples/client/petstore/swift5/urlsessionLibrary/docs/PetAPI.md b/samples/client/petstore/swift5/urlsessionLibrary/docs/PetAPI.md index 27efe0833476..76a34913c823 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/docs/PetAPI.md +++ b/samples/client/petstore/swift5/urlsessionLibrary/docs/PetAPI.md @@ -365,7 +365,7 @@ Void (empty response body) # **uploadFile** ```swift - open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) ``` uploads an image @@ -377,7 +377,7 @@ import PetstoreClient let petId = 987 // Int64 | ID of pet to update let additionalMetadata = "additionalMetadata_example" // String | Additional data to pass to server (optional) -let file = URL(string: "https://example.com")! // URL | file to upload (optional) +let file = 987 // Data | file to upload (optional) // uploads an image PetAPI.uploadFile(petId: petId, additionalMetadata: additionalMetadata, file: file) { (response, error) in @@ -398,7 +398,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Int64** | ID of pet to update | **additionalMetadata** | **String** | Additional data to pass to server | [optional] - **file** | **URL** | file to upload | [optional] + **file** | **Data** | file to upload | [optional] ### Return type @@ -417,7 +417,7 @@ Name | Type | Description | Notes # **uploadFileWithRequiredFile** ```swift - open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) + open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) ``` uploads an image (required) @@ -428,7 +428,7 @@ uploads an image (required) import PetstoreClient let petId = 987 // Int64 | ID of pet to update -let requiredFile = URL(string: "https://example.com")! // URL | file to upload +let requiredFile = 987 // Data | file to upload let additionalMetadata = "additionalMetadata_example" // String | Additional data to pass to server (optional) // uploads an image (required) @@ -449,7 +449,7 @@ PetAPI.uploadFileWithRequiredFile(petId: petId, requiredFile: requiredFile, addi Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Int64** | ID of pet to update | - **requiredFile** | **URL** | file to upload | + **requiredFile** | **Data** | file to upload | **additionalMetadata** | **String** | Additional data to pass to server | [optional] ### Return type From c7c2a48cdc391d8b2ac6e59c60794950a0174f8a Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Mon, 3 May 2021 21:56:32 -0400 Subject: [PATCH 3/6] [swift5] Add useClasses cliOption --- .../codegen/languages/Swift5ClientCodegen.java | 13 +++++++++++++ .../codegen/options/Swift5OptionsProvider.java | 1 + 2 files changed, 14 insertions(+) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift5ClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift5ClientCodegen.java index 7b3a26b16f9d..2ea92bc722d4 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift5ClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift5ClientCodegen.java @@ -63,11 +63,13 @@ public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig public static final String LENIENT_TYPE_CAST = "lenientTypeCast"; public static final String USE_SPM_FILE_STRUCTURE = "useSPMFileStructure"; public static final String SWIFT_PACKAGE_PATH = "swiftPackagePath"; + public static final String USE_CLASSES = "useClasses"; public static final String USE_BACKTICK_ESCAPES = "useBacktickEscapes"; public static final String GENERATE_MODEL_ADDITIONAL_PROPERTIES = "generateModelAdditionalProperties"; public static final String HASHABLE_MODELS = "hashableModels"; protected static final String LIBRARY_ALAMOFIRE = "alamofire"; protected static final String LIBRARY_URLSESSION = "urlsession"; + protected static final String LIBRARY_VAPOR = "vapor"; protected static final String RESPONSE_LIBRARY_PROMISE_KIT = "PromiseKit"; protected static final String RESPONSE_LIBRARY_RX_SWIFT = "RxSwift"; protected static final String RESPONSE_LIBRARY_RESULT = "Result"; @@ -81,6 +83,7 @@ public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig protected boolean swiftUseApiNamespace = false; protected boolean useSPMFileStructure = false; protected String swiftPackagePath = "Classes" + File.separator + "OpenAPIs"; + protected boolean useClasses = false; protected boolean useBacktickEscapes = false; protected boolean generateModelAdditionalProperties = true; protected boolean hashableModels = true; @@ -280,6 +283,8 @@ public Swift5ClientCodegen() { + " and set the source path to Sources" + File.separator + "{{projectName}} (default: false).")); cliOptions.add(new CliOption(SWIFT_PACKAGE_PATH, "Set a custom source path instead of " + projectName + File.separator + "Classes" + File.separator + "OpenAPIs" + ".")); + cliOptions.add(new CliOption(USE_CLASSES, "Use final classes for models instead of structs (default: false)") + .defaultValue(Boolean.FALSE.toString())); cliOptions.add(new CliOption(HASHABLE_MODELS, "Make hashable models (default: true)") @@ -469,6 +474,10 @@ public void processOpts() { } additionalProperties.put(HASHABLE_MODELS, hashableModels); + if (additionalProperties.containsKey(USE_CLASSES)) { + setUseClasses(convertPropertyToBooleanAndWriteBack(USE_CLASSES)); + } + setLenientTypeCast(convertPropertyToBooleanAndWriteBack(LENIENT_TYPE_CAST)); // make api and model doc path available in mustache template @@ -881,6 +890,10 @@ public void setSwiftPackagePath(String swiftPackagePath) { this.swiftPackagePath = swiftPackagePath; } + public void setUseClasses(boolean useClasses) { + this.useClasses = useClasses; + } + public void setUseBacktickEscapes(boolean useBacktickEscapes) { this.useBacktickEscapes = useBacktickEscapes; } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/Swift5OptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/Swift5OptionsProvider.java index 979da734eacb..4ac2c82429e6 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/Swift5OptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/Swift5OptionsProvider.java @@ -95,6 +95,7 @@ public Map createOptions() { .put(Swift5ClientCodegen.SWIFT_PACKAGE_PATH, SWIFT_PACKAGE_PATH_VALUE) .put(Swift5ClientCodegen.GENERATE_MODEL_ADDITIONAL_PROPERTIES, GENERATE_MODEL_ADDITIONAL_PROPERTIES_VALUE) .put(Swift5ClientCodegen.HASHABLE_MODELS, HASHABLE_MODELS_VALUE) + .put(Swift5ClientCodegen.USE_CLASSES, "false") .build(); } From 88fdb79c20db1dab706197b2911762f846405a52 Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Thu, 6 May 2021 18:57:10 -0400 Subject: [PATCH 4/6] [swift5] Add Vapor client library --- bin/configs/swift5-vapor.yaml | 11 ++ .../languages/Swift5ClientCodegen.java | 74 +++++---- .../main/resources/swift5/APIHelper.mustache | 3 +- .../src/main/resources/swift5/APIs.mustache | 23 ++- .../resources/swift5/Configuration.mustache | 6 +- .../main/resources/swift5/Extensions.mustache | 43 ++++- .../resources/swift5/Package.swift.mustache | 10 +- .../src/main/resources/swift5/README.mustache | 9 +- .../src/main/resources/swift5/api.mustache | 152 ++++++++++++++++-- .../main/resources/swift5/api_doc.mustache | 44 +++++ .../AlamofireImplementations.mustache | 2 +- .../URLSessionImplementations.mustache | 4 +- .../src/main/resources/swift5/model.mustache | 3 +- .../main/resources/swift5/modelEnum.mustache | 4 +- .../modelInlineEnumDeclaration.mustache | 4 +- .../resources/swift5/modelObject.mustache | 16 +- .../main/resources/swift5/modelOneOf.mustache | 2 +- 17 files changed, 334 insertions(+), 76 deletions(-) create mode 100644 bin/configs/swift5-vapor.yaml diff --git a/bin/configs/swift5-vapor.yaml b/bin/configs/swift5-vapor.yaml new file mode 100644 index 000000000000..b6ab637084d2 --- /dev/null +++ b/bin/configs/swift5-vapor.yaml @@ -0,0 +1,11 @@ +generatorName: swift5 +outputDir: samples/client/petstore/swift5/vaporLibrary +library: vapor +inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml +templateDir: modules/openapi-generator/src/main/resources/swift5 +generateAliasAsModel: true +additionalProperties: + projectName: PetstoreClient + useSPMFileStructure: true + useClasses: true + useBacktickEscapes: true diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift5ClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift5ClientCodegen.java index 2ea92bc722d4..8b04f95d5846 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift5ClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift5ClientCodegen.java @@ -292,6 +292,7 @@ public Swift5ClientCodegen() { supportedLibraries.put(LIBRARY_URLSESSION, "[DEFAULT] HTTP client: URLSession"); supportedLibraries.put(LIBRARY_ALAMOFIRE, "HTTP client: Alamofire"); + supportedLibraries.put(LIBRARY_VAPOR, "HTTP client: Vapor"); CliOption libraryOption = new CliOption(CodegenConstants.LIBRARY, "Library template (sub-template) to use"); libraryOption.setEnum(supportedLibraries); @@ -441,7 +442,7 @@ public void processOpts() { additionalProperties.put(READONLY_PROPERTIES, readonlyProperties); // Setup swiftUseApiNamespace option, which makes all the API - // classes inner-class of {{projectName}}API + // classes inner-class of {{projectName}} if (additionalProperties.containsKey(SWIFT_USE_API_NAMESPACE)) { setSwiftUseApiNamespace(convertPropertyToBooleanAndWriteBack(SWIFT_USE_API_NAMESPACE)); } @@ -484,57 +485,59 @@ public void processOpts() { additionalProperties.put("apiDocPath", apiDocPath); additionalProperties.put("modelDocPath", modelDocPath); - supportingFiles.add(new SupportingFile("Podspec.mustache", - "", - projectName + ".podspec")); - supportingFiles.add(new SupportingFile("Cartfile.mustache", - "", - "Cartfile")); + if (!getLibrary().equals(LIBRARY_VAPOR)) { + supportingFiles.add(new SupportingFile("Podspec.mustache", + "", + projectName + ".podspec")); + supportingFiles.add(new SupportingFile("Cartfile.mustache", + "", + "Cartfile")); + supportingFiles.add(new SupportingFile("CodableHelper.mustache", + sourceFolder, + "CodableHelper.swift")); + supportingFiles.add(new SupportingFile("OpenISO8601DateFormatter.mustache", + sourceFolder, + "OpenISO8601DateFormatter.swift")); + supportingFiles.add(new SupportingFile("JSONDataEncoding.mustache", + sourceFolder, + "JSONDataEncoding.swift")); + supportingFiles.add(new SupportingFile("JSONEncodingHelper.mustache", + sourceFolder, + "JSONEncodingHelper.swift")); + supportingFiles.add(new SupportingFile("git_push.sh.mustache", + "", + "git_push.sh")); + supportingFiles.add(new SupportingFile("SynchronizedDictionary.mustache", + sourceFolder, + "SynchronizedDictionary.swift")); + supportingFiles.add(new SupportingFile("XcodeGen.mustache", + "", + "project.yml")); + supportingFiles.add(new SupportingFile("APIHelper.mustache", + sourceFolder, + "APIHelper.swift")); + supportingFiles.add(new SupportingFile("Models.mustache", + sourceFolder, + "Models.swift")); + } supportingFiles.add(new SupportingFile("Package.swift.mustache", "", "Package.swift")); - supportingFiles.add(new SupportingFile("APIHelper.mustache", - sourceFolder, - "APIHelper.swift")); supportingFiles.add(new SupportingFile("Configuration.mustache", sourceFolder, "Configuration.swift")); supportingFiles.add(new SupportingFile("Extensions.mustache", sourceFolder, "Extensions.swift")); - supportingFiles.add(new SupportingFile("Models.mustache", - sourceFolder, - "Models.swift")); supportingFiles.add(new SupportingFile("APIs.mustache", sourceFolder, "APIs.swift")); - supportingFiles.add(new SupportingFile("CodableHelper.mustache", - sourceFolder, - "CodableHelper.swift")); - supportingFiles.add(new SupportingFile("OpenISO8601DateFormatter.mustache", - sourceFolder, - "OpenISO8601DateFormatter.swift")); - supportingFiles.add(new SupportingFile("JSONDataEncoding.mustache", - sourceFolder, - "JSONDataEncoding.swift")); - supportingFiles.add(new SupportingFile("JSONEncodingHelper.mustache", - sourceFolder, - "JSONEncodingHelper.swift")); - supportingFiles.add(new SupportingFile("git_push.sh.mustache", - "", - "git_push.sh")); - supportingFiles.add(new SupportingFile("SynchronizedDictionary.mustache", - sourceFolder, - "SynchronizedDictionary.swift")); supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore")); supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); - supportingFiles.add(new SupportingFile("XcodeGen.mustache", - "", - "project.yml")); switch (getLibrary()) { case LIBRARY_ALAMOFIRE: @@ -549,6 +552,9 @@ public void processOpts() { sourceFolder, "URLSessionImplementations.swift")); break; + case LIBRARY_VAPOR: + additionalProperties.put("useVapor", true); + break; default: break; } diff --git a/modules/openapi-generator/src/main/resources/swift5/APIHelper.mustache b/modules/openapi-generator/src/main/resources/swift5/APIHelper.mustache index 94dc810006a6..e535c7df4c44 100644 --- a/modules/openapi-generator/src/main/resources/swift5/APIHelper.mustache +++ b/modules/openapi-generator/src/main/resources/swift5/APIHelper.mustache @@ -4,7 +4,8 @@ // https://openapi-generator.tech // -import Foundation +import Foundation{{#useVapor}} +import Vapor{{/useVapor}} {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} struct APIHelper { {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static func rejectNil(_ source: [String: Any?]) -> [String: Any]? { diff --git a/modules/openapi-generator/src/main/resources/swift5/APIs.mustache b/modules/openapi-generator/src/main/resources/swift5/APIs.mustache index 42bdf74007f1..b0322bd9c5fd 100644 --- a/modules/openapi-generator/src/main/resources/swift5/APIs.mustache +++ b/modules/openapi-generator/src/main/resources/swift5/APIs.mustache @@ -5,16 +5,25 @@ // import Foundation +{{#useVapor}} +import Vapor +{{/useVapor}} -{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class {{projectName}}API { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class {{projectName}} { {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static var basePath = "{{{basePath}}}" - {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static var credential: URLCredential? - {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static var customHeaders: [String: String] = [:]{{#useAlamofire}} + {{#useVapor}} + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static var customHeaders: HTTPHeaders = [:] + {{/useVapor}} + {{^useVapor}} + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static var customHeaders: [String: String] = [:] + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static var credential: URLCredential?{{#useAlamofire}} {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static var requestBuilderFactory: RequestBuilderFactory = AlamofireRequestBuilderFactory(){{/useAlamofire}}{{#useURLSession}} {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static var requestBuilderFactory: RequestBuilderFactory = URLSessionRequestBuilderFactory(){{/useURLSession}} {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static var apiResponseQueue: DispatchQueue = .main + {{/useVapor}} } +{{#useVapor}}{{/useVapor}}{{^useVapor}} {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class RequestBuilder { var credential: URLCredential? var headers: [String: String] @@ -33,7 +42,7 @@ import Foundation self.parameters = parameters self.headers = headers - addHeaders({{projectName}}API.customHeaders) + addHeaders({{projectName}}.customHeaders) } {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func addHeaders(_ aHeaders: [String: String]) { @@ -42,7 +51,7 @@ import Foundation } } - {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func execute(_ apiResponseQueue: DispatchQueue = {{projectName}}API.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, Error>) -> Void) { } + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func execute(_ apiResponseQueue: DispatchQueue = {{projectName}}.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, Error>) -> Void) { } {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} func addHeader(name: String, value: String) -> Self { if !value.isEmpty { @@ -52,7 +61,7 @@ import Foundation } {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func addCredential() -> Self { - credential = {{projectName}}API.credential + credential = {{projectName}}.credential return self } } @@ -60,4 +69,4 @@ import Foundation {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} protocol RequestBuilderFactory { func getNonDecodableBuilder() -> RequestBuilder.Type func getBuilder() -> RequestBuilder.Type -} +}{{/useVapor}} diff --git a/modules/openapi-generator/src/main/resources/swift5/Configuration.mustache b/modules/openapi-generator/src/main/resources/swift5/Configuration.mustache index 78f54279711d..5d261ac0739f 100644 --- a/modules/openapi-generator/src/main/resources/swift5/Configuration.mustache +++ b/modules/openapi-generator/src/main/resources/swift5/Configuration.mustache @@ -5,10 +5,14 @@ // import Foundation +{{#useVapor}}import Vapor{{/useVapor}} {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class Configuration { + {{#useVapor}}{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static var apiClient: Vapor.Client? = nil + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static var apiWrapper: (inout Vapor.ClientRequest) throws -> () = { _ in } + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static var contentConfiguration = ContentConfiguration.default(){{/useVapor}}{{^useVapor}} // This value is used to configure the date formatter that is used to serialize dates into JSON format. // You must set it prior to encoding any dates, and it will only be read once. @available(*, unavailable, message: "To set a different date format, use CodableHelper.dateFormatter instead.") - {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static var dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ" + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static var dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ"{{/useVapor}} } diff --git a/modules/openapi-generator/src/main/resources/swift5/Extensions.mustache b/modules/openapi-generator/src/main/resources/swift5/Extensions.mustache index e3b069f432c2..26edd3f9a400 100644 --- a/modules/openapi-generator/src/main/resources/swift5/Extensions.mustache +++ b/modules/openapi-generator/src/main/resources/swift5/Extensions.mustache @@ -8,8 +8,10 @@ import Foundation #if canImport(AnyCodable) import AnyCodable #endif{{#usePromiseKit}} -import PromiseKit{{/usePromiseKit}} +import PromiseKit{{/usePromiseKit}}{{#useVapor}} +import Vapor{{/useVapor}} +{{^useVapor}} extension Bool: JSONEncodable { func encodeToJSON() -> Any { return self as Any } } @@ -94,7 +96,7 @@ extension UUID: JSONEncodable { func encodeToJSON() -> Any { return self.uuidString } -}{{#generateModelAdditionalProperties}} +}{{/useVapor}}{{#generateModelAdditionalProperties}} extension String: CodingKey { @@ -180,13 +182,13 @@ extension KeyedDecodingContainerProtocol { return map } -}{{/generateModelAdditionalProperties}} +}{{/generateModelAdditionalProperties}}{{^useVapor}} extension HTTPURLResponse { var isStatusCodeSuccessful: Bool { return Array(200 ..< 300).contains(statusCode) } -}{{#usePromiseKit}} +}{{/useVapor}}{{#usePromiseKit}} extension RequestBuilder { {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} func execute() -> Promise> { @@ -202,6 +204,39 @@ extension RequestBuilder { return deferred.promise } }{{/usePromiseKit}} +{{#useVapor}} + +extension UUID: Content { } + +extension URL: Content { } + +extension Bool: Content { } + +extension Set: ResponseEncodable where Element: Content { + public func encodeResponse(for request: Vapor.Request) -> EventLoopFuture { + let response = Vapor.Response() + do { + try response.content.encode(Array(self)) + } catch { + return request.eventLoop.makeFailedFuture(error) + } + return request.eventLoop.makeSucceededFuture(response) + } +} + +extension Set: RequestDecodable where Element: Content { + public static func decodeRequest(_ request: Vapor.Request) -> EventLoopFuture { + do { + let content = try request.content.decode([Element].self) + return request.eventLoop.makeSucceededFuture(Set(content)) + } catch { + return request.eventLoop.makeFailedFuture(error) + } + } +} + +extension Set: Content where Element: Content { } +{{/useVapor}} #if canImport(AnyCodable) extension AnyCodable: Hashable { diff --git a/modules/openapi-generator/src/main/resources/swift5/Package.swift.mustache b/modules/openapi-generator/src/main/resources/swift5/Package.swift.mustache index 353c6e9f3415..c3c3eba59ed3 100644 --- a/modules/openapi-generator/src/main/resources/swift5/Package.swift.mustache +++ b/modules/openapi-generator/src/main/resources/swift5/Package.swift.mustache @@ -5,10 +5,15 @@ import PackageDescription let package = Package( name: "{{projectName}}", platforms: [ + {{#useVapor}} + .macOS(.v10_15), + {{/useVapor}} + {{^useVapor}} .iOS(.v9), .macOS(.v10_11), .tvOS(.v9), .watchOS(.v3), + {{/useVapor}} ], products: [ // Products define the executables and libraries produced by a package, and make them visible to other packages. @@ -23,6 +28,9 @@ let package = Package( {{#useAlamofire}} .package(url: "https://github.com/Alamofire/Alamofire.git", from: "4.9.1"), {{/useAlamofire}} + {{#useVapor}} + .package(url: "https://github.com/vapor/vapor.git", from: "4.0.0") + {{/useVapor}} {{#usePromiseKit}} .package(url: "https://github.com/mxcl/PromiseKit.git", from: "6.12.0"), {{/usePromiseKit}} @@ -35,7 +43,7 @@ let package = Package( // Targets can depend on other targets in this package, and on products in packages which this package depends on. .target( name: "{{projectName}}", - dependencies: ["AnyCodable", {{#useAlamofire}}"Alamofire", {{/useAlamofire}}{{#usePromiseKit}}"PromiseKit", {{/usePromiseKit}}{{#useRxSwift}}"RxSwift"{{/useRxSwift}}], + dependencies: ["AnyCodable", {{#useVapor}}"Vapor", {{/useVapor}}{{#useAlamofire}}"Alamofire", {{/useAlamofire}}{{#usePromiseKit}}"PromiseKit", {{/usePromiseKit}}{{#useRxSwift}}"RxSwift"{{/useRxSwift}}], path: "{{#swiftPackagePath}}{{swiftPackagePath}}{{/swiftPackagePath}}{{^swiftPackagePath}}{{#useSPMFileStructure}}Sources/{{projectName}}{{/useSPMFileStructure}}{{^useSPMFileStructure}}{{projectName}}/Classes{{/useSPMFileStructure}}{{/swiftPackagePath}}" ), ] diff --git a/modules/openapi-generator/src/main/resources/swift5/README.mustache b/modules/openapi-generator/src/main/resources/swift5/README.mustache index 4e15bc40b0bc..2fc73bcdbc16 100644 --- a/modules/openapi-generator/src/main/resources/swift5/README.mustache +++ b/modules/openapi-generator/src/main/resources/swift5/README.mustache @@ -19,6 +19,13 @@ For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) ## Installation +{{#useVapor}} +Add the following entry in your Package.swift: + +> .package(path: "./{{{projectName}}}") + +{{/useVapor}} +{{^useVapor}} ### Carthage Run `carthage update` @@ -27,7 +34,7 @@ Run `carthage update` Run `pod install` -## Documentation for API Endpoints +{{/useVapor}}## Documentation for API Endpoints All URIs are relative to *{{basePath}}* diff --git a/modules/openapi-generator/src/main/resources/swift5/api.mustache b/modules/openapi-generator/src/main/resources/swift5/api.mustache index ac3b4b3d9541..8a96435266be 100644 --- a/modules/openapi-generator/src/main/resources/swift5/api.mustache +++ b/modules/openapi-generator/src/main/resources/swift5/api.mustache @@ -10,21 +10,23 @@ import PromiseKit{{/usePromiseKit}}{{#useRxSwift}} import RxSwift{{/useRxSwift}}{{#useCombine}} #if canImport(Combine) import Combine -#endif{{/useCombine}}{{#swiftUseApiNamespace}} +#endif{{/useCombine}}{{#useVapor}} +import Vapor{{/useVapor}}{{#swiftUseApiNamespace}} -extension {{projectName}}API { +extension {{projectName}} { {{/swiftUseApiNamespace}} {{#description}} -/** {{description}} */{{/description}} +/** {{{description}}} */{{/description}} {{#objcCompatible}}@objc {{/objcCompatible}}{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class {{classname}}{{#objcCompatible}} : NSObject{{/objcCompatible}} { {{#operation}} + {{#allParams}} {{#isEnum}} /** * enum for parameter {{paramName}} */ - {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum {{enumName}}_{{operationId}}: {{^isContainer}}{{{dataType}}}{{/isContainer}}{{#isContainer}}String{{/isContainer}}, CaseIterable { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum {{enumName}}_{{operationId}}: {{^isContainer}}{{{dataType}}}{{/isContainer}}{{#isContainer}}String{{/isContainer}}, CaseIterable{{#useVapor}}, Content{{/useVapor}} { {{#allowableValues}} {{#enumVars}} case {{name}} = {{{value}}} @@ -34,6 +36,7 @@ extension {{projectName}}API { {{/isEnum}} {{/allParams}} +{{^useVapor}} {{^usePromiseKit}} {{^useRxSwift}} {{^useResult}} @@ -49,7 +52,7 @@ extension {{projectName}}API { {{#isDeprecated}} @available(*, deprecated, message: "This operation is deprecated.") {{/isDeprecated}} - {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func {{operationId}}({{#allParams}}{{paramName}}: {{#isEnum}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}apiResponseQueue: DispatchQueue = {{projectName}}API.apiResponseQueue, completion: @escaping ((_ data: {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}?, _ error: Error?) -> Void)) { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func {{operationId}}({{#allParams}}{{paramName}}: {{#isEnum}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}apiResponseQueue: DispatchQueue = {{projectName}}.apiResponseQueue, completion: @escaping ((_ data: {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}?, _ error: Error?) -> Void)) { {{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}).execute(apiResponseQueue) { result -> Void in switch result { {{#returnType}} @@ -69,6 +72,7 @@ extension {{projectName}}API { {{/useResult}} {{/useRxSwift}} {{/usePromiseKit}} +{{/useVapor}} {{#usePromiseKit}} /** {{#summary}} @@ -81,7 +85,7 @@ extension {{projectName}}API { {{#isDeprecated}} @available(*, deprecated, message: "This operation is deprecated.") {{/isDeprecated}} - {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func {{operationId}}({{#allParams}} {{paramName}}: {{#isEnum}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}apiResponseQueue: DispatchQueue = {{projectName}}API.apiResponseQueue) -> Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func {{operationId}}({{#allParams}} {{paramName}}: {{#isEnum}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}apiResponseQueue: DispatchQueue = {{projectName}}.apiResponseQueue) -> Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> { let deferred = Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}>.pending() {{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}).execute(apiResponseQueue) { result -> Void in switch result { @@ -112,7 +116,7 @@ extension {{projectName}}API { {{#isDeprecated}} @available(*, deprecated, message: "This operation is deprecated.") {{/isDeprecated}} - {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func {{operationId}}({{#allParams}}{{paramName}}: {{#isEnum}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}apiResponseQueue: DispatchQueue = {{projectName}}API.apiResponseQueue) -> Observable<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func {{operationId}}({{#allParams}}{{paramName}}: {{#isEnum}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}apiResponseQueue: DispatchQueue = {{projectName}}.apiResponseQueue) -> Observable<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> { return Observable.create { observer -> Disposable in {{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}).execute(apiResponseQueue) { result -> Void in switch result { @@ -147,7 +151,7 @@ extension {{projectName}}API { @available(*, deprecated, message: "This operation is deprecated.") {{/isDeprecated}} @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func {{operationId}}({{#allParams}}{{paramName}}: {{#isEnum}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}apiResponseQueue: DispatchQueue = {{projectName}}API.apiResponseQueue) -> AnyPublisher<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}, Error> { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func {{operationId}}({{#allParams}}{{paramName}}: {{#isEnum}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}apiResponseQueue: DispatchQueue = {{projectName}}.apiResponseQueue) -> AnyPublisher<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}, Error> { return Future<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}, Error>.init { promise in {{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}).execute(apiResponseQueue) { result -> Void in switch result { @@ -179,7 +183,7 @@ extension {{projectName}}API { {{#isDeprecated}} @available(*, deprecated, message: "This operation is deprecated.") {{/isDeprecated}} - open class func {{operationId}}({{#allParams}}{{paramName}}: {{#isEnum}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{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}}}{{/returnType}}{{^returnType}}Void{{/returnType}}, Error>) -> Void)) { + open class func {{operationId}}({{#allParams}}{{paramName}}: {{#isEnum}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}apiResponseQueue: DispatchQueue = {{projectName}}.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}, Error>) -> Void)) { {{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}).execute(apiResponseQueue) { result -> Void in switch result { {{#returnType}} @@ -196,7 +200,132 @@ extension {{projectName}}API { } } {{/useResult}} +{{#useVapor}} + /** + {{#summary}} + {{{summary}}} + {{/summary}} + + {{httpMethod}} {{{path}}}{{#notes}} + + {{{notes}}}{{/notes}}{{#subresourceOperation}} + subresourceOperation: {{subresourceOperation}}{{/subresourceOperation}}{{#defaultResponse}} + defaultResponse: {{defaultResponse}}{{/defaultResponse}} + + {{#authMethods}} + - {{#isBasic}}BASIC{{/isBasic}}{{#isOAuth}}OAuth{{/isOAuth}}{{#isApiKey}}API Key{{/isApiKey}}: + - type: {{type}}{{#keyParamName}} {{keyParamName}} {{#isKeyInQuery}}(QUERY){{/isKeyInQuery}}{{#isKeyInHeaer}}(HEADER){{/isKeyInHeaer}}{{/keyParamName}} + - name: {{name}} + {{/authMethods}} + {{#hasResponseHeaders}} + - responseHeaders: [{{#responseHeaders}}{{{baseName}}}({{{dataType}}}){{^-last}}, {{/-last}}{{/responseHeaders}}] + {{/hasResponseHeaders}} + {{#externalDocs}} + - externalDocs: {{externalDocs}} + {{/externalDocs}} + {{#allParams}} + - parameter {{paramName}}: ({{#isFormParam}}form{{/isFormParam}}{{#isQueryParam}}query{{/isQueryParam}}{{#isPathParam}}path{{/isPathParam}}{{#isHeaderParam}}header{{/isHeaderParam}}{{#isBodyParam}}body{{/isBodyParam}}) {{{description}}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}} + {{/allParams}} + - returns: `EventLoopFuture` of `ClientResponse` {{{description}}} + */ + {{#isDeprecated}} + @available(*, deprecated, message: "This operation is deprecated.") + {{/isDeprecated}} + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func {{operationId}}Raw({{#allParams}}{{paramName}}: {{#isEnum}}{{#isArray}}[{{enumName}}_{{operationId}}]{{/isArray}}{{^isArray}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isArray}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}headers: HTTPHeaders = {{projectName}}.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + {{^pathParams}}let{{/pathParams}}{{#pathParams}}{{#-first}}var{{/-first}}{{/pathParams}} path = "{{{path}}}"{{#pathParams}} + let {{paramName}}PreEscape = String(describing: {{#isEnum}}{{paramName}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}.rawValue{{/isContainer}}{{/isEnum}}{{^isEnum}}{{paramName}}{{/isEnum}}) + let {{paramName}}PostEscape = {{paramName}}PreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + path = path.replacingOccurrences(of: "{{=<% %>=}}{<%baseName%>}<%={{ }}=%>", with: {{paramName}}PostEscape, options: .literal, range: nil){{/pathParams}} + let URLString = {{projectName}}.basePath + path + + guard let apiClient = {{#swiftUseApiNamespace}}{{projectName}}.{{/swiftUseApiNamespace}}Configuration.apiClient else { + fatalError("Configuration.apiClient is not set.") + } + + return apiClient.send(.{{httpMethod}}, headers: headers, to: URI(string: URLString)) { request in + try {{#swiftUseApiNamespace}}{{projectName}}.{{/swiftUseApiNamespace}}Configuration.apiWrapper(&request) + {{#hasHeaderParams}}{{#headerParams}} + request.headers.add(name: "{{baseName}}", value: {{#isArray}}{{paramName}}{{^required}}?{{/required}}.map { $0{{#isEnum}}.rawValue{{/isEnum}}.description }.description{{/isArray}}{{^isArray}}{{#isEnum}}{{paramName}}{{^required}}?{{/required}}.rawValue.description{{/isEnum}}{{^isEnum}}{{paramName}}{{^required}}?{{/required}}.description{{/isEnum}}{{/isArray}}{{^required}} ?? ""{{/required}}) + {{/headerParams}}{{/hasHeaderParams}} + {{#hasQueryParams}}struct QueryParams: Content { + {{#queryParams}} + var {{paramName}}: {{#isEnum}}{{#isArray}}[{{enumName}}_{{operationId}}]{{/isArray}}{{^isArray}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isArray}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}?{{/required}} + {{/queryParams}} + } + try request.query.encode(QueryParams({{#queryParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/queryParams}})){{/hasQueryParams}} + {{#hasBodyParam}} + {{#bodyParam}}{{#required}}{{#isBinary}}request.body = ByteBuffer(data: {{paramName}}){{/isBinary}}{{^isBinary}}{{#isFile}}request.body = ByteBuffer(data: {{paramName}}){{/isFile}}try request.content.encode({{paramName}}, using: Configuration.contentConfiguration.requireEncoder(for: {{{dataType}}}.defaultContentType)){{/isBinary}}{{/required}}{{^required}}if let body = {{paramName}} { + + {{#isBinary}}request.body = ByteBuffer(data: body){{/isBinary}}{{^isBinary}}{{#isFile}}request.body = ByteBuffer(data: body){{/isFile}}try request.content.encode(body){{/isBinary}} + }{{/required}}{{/bodyParam}} + {{/hasBodyParam}} + {{#hasFormParams}}struct FormParams: Content { + static let defaultContentType = Vapor.HTTPMediaType.formData + {{#formParams}} + var {{paramName}}: {{#isEnum}}{{#isArray}}[{{enumName}}_{{operationId}}]{{/isArray}}{{^isArray}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isArray}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}?{{/required}} + {{/formParams}} + } + try request.content.encode(FormParams({{#formParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/formParams}}), using: Configuration.contentConfiguration.requireEncoder(for: FormParams.defaultContentType)){{/hasFormParams}} + try beforeSend(&request) + } + } + + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum {{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}} { + {{#responses}} + case http{{code}}(value: {{#dataType}}{{{dataType}}}{{/dataType}}{{^dataType}}Void{{/dataType}}, raw: ClientResponse) + {{/responses}} + {{^hasDefaultResponse}} + case http0(value: {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}, raw: ClientResponse) + {{/hasDefaultResponse}} + } + + /** + {{#summary}} + {{{summary}}} + {{/summary}} + + {{httpMethod}} {{{path}}}{{#notes}} + + {{{notes}}}{{/notes}}{{#subresourceOperation}} + subresourceOperation: {{subresourceOperation}}{{/subresourceOperation}}{{#defaultResponse}} + defaultResponse: {{defaultResponse}}{{/defaultResponse}} + + {{#authMethods}} + - {{#isBasic}}BASIC{{/isBasic}}{{#isOAuth}}OAuth{{/isOAuth}}{{#isApiKey}}API Key{{/isApiKey}}: + - type: {{type}}{{#keyParamName}} {{keyParamName}} {{#isKeyInQuery}}(QUERY){{/isKeyInQuery}}{{#isKeyInHeaer}}(HEADER){{/isKeyInHeaer}}{{/keyParamName}} + - name: {{name}} + {{/authMethods}} + {{#hasResponseHeaders}} + - responseHeaders: [{{#responseHeaders}}{{{baseName}}}({{{dataType}}}){{^-last}}, {{/-last}}{{/responseHeaders}}] + {{/hasResponseHeaders}} + {{#externalDocs}} + - externalDocs: {{externalDocs}} + {{/externalDocs}} + {{#allParams}} + - parameter {{paramName}}: ({{#isFormParam}}form{{/isFormParam}}{{#isQueryParam}}query{{/isQueryParam}}{{#isPathParam}}path{{/isPathParam}}{{#isHeaderParam}}header{{/isHeaderParam}}{{#isBodyParam}}body{{/isBodyParam}}) {{{description}}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}} + {{/allParams}} + - returns: `EventLoopFuture` of `{{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}` {{{description}}} + */ + {{#isDeprecated}} + @available(*, deprecated, message: "This operation is deprecated.") + {{/isDeprecated}} + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func {{operationId}}({{#allParams}}{{paramName}}: {{#isEnum}}{{#isArray}}[{{enumName}}_{{operationId}}]{{/isArray}}{{^isArray}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isArray}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}headers: HTTPHeaders = {{projectName}}.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture<{{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}> { + return {{operationId}}Raw({{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> {{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}} in + switch response.status.code { + {{#responses}} + {{#isDefault}}default{{/isDefault}}{{^isDefault}}case {{code}}{{/isDefault}}: + return .http{{code}}(value: {{#dataType}}{{#isBinary}}Data(buffer: response.body ?? ByteBuffer()){{/isBinary}}{{^isBinary}}{{#isFile}}Data(buffer: response.body ?? ByteBuffer()){{/isFile}}{{^isFile}}try response.content.decode({{{dataType}}}.self, using: Configuration.contentConfiguration.requireDecoder(for: {{{dataType}}}.defaultContentType)){{/isFile}}{{/isBinary}}{{/dataType}}{{^dataType}}(){{/dataType}}, raw: response) + {{/responses}} + {{^hasDefaultResponse}} + default: + return .http0(value: {{#returnType}}{{#isResponseBinary}}Data(buffer: response.body ?? ByteBuffer()){{/isResponseBinary}}{{^isResponseBinary}}try response.content.decode({{{returnType}}}.self, using: Configuration.contentConfiguration.requireDecoder(for: {{{returnType}}}.defaultContentType)){{/isResponseBinary}}{{/returnType}}{{^returnType}}(){{/returnType}}, raw: response) + {{/hasDefaultResponse}} + } + } + } +{{/useVapor}} +{{^useVapor}} /** {{#summary}} {{{summary}}} @@ -229,7 +358,7 @@ extension {{projectName}}API { let {{paramName}}PreEscape = "\({{#isEnum}}{{paramName}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}.rawValue{{/isContainer}}{{/isEnum}}{{^isEnum}}APIHelper.mapValueToPathItem({{paramName}}){{/isEnum}})" let {{paramName}}PostEscape = {{paramName}}PreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{{=<% %>=}}{<%baseName%>}<%={{ }}=%>", with: {{paramName}}PostEscape, options: .literal, range: nil){{/pathParams}} - let URLString = {{projectName}}API.basePath + path + let URLString = {{projectName}}.basePath + path {{#bodyParam}} let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: {{paramName}}) {{/bodyParam}} @@ -264,10 +393,11 @@ extension {{projectName}}API { let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders) - let requestBuilder: RequestBuilder<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}>.Type = {{projectName}}API.requestBuilderFactory.{{#returnType}}getBuilder(){{/returnType}}{{^returnType}}getNonDecodableBuilder(){{/returnType}} + let requestBuilder: RequestBuilder<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}>.Type = {{projectName}}.requestBuilderFactory.{{#returnType}}getBuilder(){{/returnType}}{{^returnType}}getNonDecodableBuilder(){{/returnType}} return requestBuilder.init(method: "{{httpMethod}}", URLString: (urlComponents?.string ?? URLString), parameters: parameters, headers: headerParameters) } +{{/useVapor}} {{/operation}} } diff --git a/modules/openapi-generator/src/main/resources/swift5/api_doc.mustache b/modules/openapi-generator/src/main/resources/swift5/api_doc.mustache index f57a93153c66..93b51e32535d 100644 --- a/modules/openapi-generator/src/main/resources/swift5/api_doc.mustache +++ b/modules/openapi-generator/src/main/resources/swift5/api_doc.mustache @@ -14,7 +14,9 @@ Method | HTTP request | Description ```swift {{^usePromiseKit}} {{^useRxSwift}} +{{^useVapor}} {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func {{operationId}}({{#allParams}}{{paramName}}: {{#isEnum}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}completion: @escaping (_ data: {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}?, _ error: Error?) -> Void) +{{/useVapor}} {{/useRxSwift}} {{/usePromiseKit}} {{#usePromiseKit}} @@ -23,6 +25,9 @@ Method | HTTP request | Description {{#useRxSwift}} {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func {{operationId}}({{#allParams}}{{paramName}}: {{#isEnum}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) -> Observable<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{/useRxSwift}} +{{#useVapor}} + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func {{operationId}}({{#allParams}}{{paramName}}: {{#isEnum}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}headers: HTTPHeaders = {{projectName}}.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture<{{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}> +{{/useVapor}} ``` {{{summary}}}{{#notes}} @@ -39,6 +44,7 @@ import {{{projectName}}} {{^usePromiseKit}} {{^useRxSwift}} +{{^useVapor}} {{#summary}} // {{{.}}} {{/summary}} @@ -52,6 +58,7 @@ import {{{projectName}}} dump(response) } } +{{/useVapor}} {{/useRxSwift}} {{/usePromiseKit}} {{#usePromiseKit}} @@ -69,6 +76,27 @@ import {{{projectName}}} {{#useRxSwift}} // TODO RxSwift sample code not yet implemented. To contribute, please open a ticket via http://github.com/OpenAPITools/openapi-generator/issues/new {{/useRxSwift}} +{{#useVapor}} +{{#summary}} +// {{{.}}} +{{/summary}} +{{classname}}.{{{operationId}}}({{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}).whenComplete { result in + switch result { + case .failure(let error): + // process error + case .success(let response): + switch response { + // process decoded response value or raw ClientResponse + {{#responses}} + case .http{{code}}(let value, let raw): + {{/responses}} + {{^hasDefaultResponse}} + case .http0(let value, let raw): + {{/hasDefaultResponse}} + } + } +} +{{/useVapor}} ``` ### Parameters @@ -80,7 +108,23 @@ Name | Type | Description | Notes ### Return type +{{#useVapor}} +#### {{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}} + +```swift +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum {{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}} { + {{#responses}} + case http{{code}}(value: {{#dataType}}{{dataType}}?{{/dataType}}{{^dataType}}Void?{{/dataType}}, raw: ClientResponse) + {{/responses}} + {{^hasDefaultResponse}} + case http0(value: {{#returnType}}{{returnType}}?{{/returnType}}{{^returnType}}Void?{{/returnType}}, raw: ClientResponse) + {{/hasDefaultResponse}} +} +``` +{{/useVapor}} +{{^useVapor}} {{#returnType}}{{#returnTypeIsPrimitive}}**{{{returnType}}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{{returnType}}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}Void (empty response body){{/returnType}} +{{/useVapor}} ### Authorization diff --git a/modules/openapi-generator/src/main/resources/swift5/libraries/alamofire/AlamofireImplementations.mustache b/modules/openapi-generator/src/main/resources/swift5/libraries/alamofire/AlamofireImplementations.mustache index 71e9670965bf..786aa1faab19 100644 --- a/modules/openapi-generator/src/main/resources/swift5/libraries/alamofire/AlamofireImplementations.mustache +++ b/modules/openapi-generator/src/main/resources/swift5/libraries/alamofire/AlamofireImplementations.mustache @@ -76,7 +76,7 @@ private var managerStore = SynchronizedDictionary, Error>) -> Void) { + override {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func execute(_ apiResponseQueue: DispatchQueue = {{projectName}}.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, Error>) -> Void) { let managerId = UUID().uuidString // Create a new manager for each request to customize its request header let manager = createSessionManager() diff --git a/modules/openapi-generator/src/main/resources/swift5/libraries/urlsession/URLSessionImplementations.mustache b/modules/openapi-generator/src/main/resources/swift5/libraries/urlsession/URLSessionImplementations.mustache index 294dc7418ea6..9c26e5c4fdff 100644 --- a/modules/openapi-generator/src/main/resources/swift5/libraries/urlsession/URLSessionImplementations.mustache +++ b/modules/openapi-generator/src/main/resources/swift5/libraries/urlsession/URLSessionImplementations.mustache @@ -93,7 +93,7 @@ private var urlSessionStore = SynchronizedDictionary() return modifiedRequest } - override {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func execute(_ apiResponseQueue: DispatchQueue = {{projectName}}API.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, Error>) -> Void) { + override {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func execute(_ apiResponseQueue: DispatchQueue = {{projectName}}.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, Error>) -> Void) { let urlSessionId = UUID().uuidString // Create a new manager for each request to customize its request header let urlSession = createURLSession() @@ -244,7 +244,7 @@ private var urlSessionStore = SynchronizedDictionary() for (key, value) in headers { httpHeaders[key] = value } - for (key, value) in {{projectName}}API.customHeaders { + for (key, value) in {{projectName}}.customHeaders { httpHeaders[key] = value } return httpHeaders diff --git a/modules/openapi-generator/src/main/resources/swift5/model.mustache b/modules/openapi-generator/src/main/resources/swift5/model.mustache index 53892df270e7..f439c94ad885 100644 --- a/modules/openapi-generator/src/main/resources/swift5/model.mustache +++ b/modules/openapi-generator/src/main/resources/swift5/model.mustache @@ -8,7 +8,8 @@ import Foundation #if canImport(AnyCodable) import AnyCodable -#endif +#endif{{#useVapor}} +import Vapor{{/useVapor}} {{#description}} /** {{description}} */{{/description}}{{#isDeprecated}} diff --git a/modules/openapi-generator/src/main/resources/swift5/modelEnum.mustache b/modules/openapi-generator/src/main/resources/swift5/modelEnum.mustache index b10347d63db3..4d868682a1e3 100644 --- a/modules/openapi-generator/src/main/resources/swift5/modelEnum.mustache +++ b/modules/openapi-generator/src/main/resources/swift5/modelEnum.mustache @@ -1,7 +1,7 @@ -{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum {{classname}}: {{dataType}}, Codable, CaseIterable { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum {{classname}}: {{dataType}}, {{#useVapor}}Content, Hashable{{/useVapor}}{{^useVapor}}Codable{{/useVapor}}, CaseIterable { {{#allowableValues}} {{#enumVars}} - case {{name}} = {{{value}}} + case {{{name}}} = {{{value}}} {{/enumVars}} {{/allowableValues}} } \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/swift5/modelInlineEnumDeclaration.mustache b/modules/openapi-generator/src/main/resources/swift5/modelInlineEnumDeclaration.mustache index 1c749e0b6cd9..039bae3cb73d 100644 --- a/modules/openapi-generator/src/main/resources/swift5/modelInlineEnumDeclaration.mustache +++ b/modules/openapi-generator/src/main/resources/swift5/modelInlineEnumDeclaration.mustache @@ -1,7 +1,7 @@ - {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum {{enumName}}: {{^isContainer}}{{dataType}}{{/isContainer}}{{#isContainer}}String{{/isContainer}}, Codable, CaseIterable { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum {{enumName}}: {{^isContainer}}{{dataType}}{{/isContainer}}{{#isContainer}}String{{/isContainer}}, {{#useVapor}}Content, Hashable{{/useVapor}}{{^useVapor}}Codable{{/useVapor}}, CaseIterable { {{#allowableValues}} {{#enumVars}} - case {{name}} = {{{value}}} + case {{{name}}} = {{{value}}} {{/enumVars}} {{/allowableValues}} } \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/swift5/modelObject.mustache b/modules/openapi-generator/src/main/resources/swift5/modelObject.mustache index 336ee3467c85..665050633141 100644 --- a/modules/openapi-generator/src/main/resources/swift5/modelObject.mustache +++ b/modules/openapi-generator/src/main/resources/swift5/modelObject.mustache @@ -1,4 +1,4 @@ -{{^objcCompatible}}{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} {{#useClasses}}final class{{/useClasses}}{{^useClasses}}struct{{/useClasses}} {{classname}}: Codable{{#vendorExtensions.x-swift-hashable}}, Hashable{{/vendorExtensions.x-swift-hashable}} { +{{^objcCompatible}}{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} {{#useClasses}}final class{{/useClasses}}{{^useClasses}}struct{{/useClasses}} {{{classname}}}: {{#useVapor}}Content{{/useVapor}}{{^useVapor}}Codable{{/useVapor}}{{#vendorExtensions.x-swift-hashable}}, Hashable{{/vendorExtensions.x-swift-hashable}} { {{/objcCompatible}}{{#objcCompatible}}@objc {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} class {{classname}}: NSObject, Codable { {{/objcCompatible}} @@ -9,12 +9,12 @@ {{/allVars}} {{#allVars}} {{#isEnum}} - {{#description}}/** {{description}} */ + {{#description}}/** {{{description}}} */ {{/description}}{{#deprecated}}@available(*, deprecated, message: "This property is deprecated.") {{/deprecated}}{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} {{#readonlyProperties}}private(set) {{/readonlyProperties}}var {{{name}}}: {{{datatypeWithEnum}}}{{#required}}{{#isNullable}}?{{/isNullable}}{{/required}}{{^required}}?{{/required}}{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}} {{/isEnum}} {{^isEnum}} - {{#description}}/** {{description}} */ + {{#description}}/** {{{description}}} */ {{/description}}{{#deprecated}}@available(*, deprecated, message: "This property is deprecated.") {{/deprecated}}{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} {{#readonlyProperties}}private(set) {{/readonlyProperties}}var {{{name}}}: {{{datatype}}}{{#required}}{{#isNullable}}?{{/isNullable}}{{/required}}{{^required}}?{{/required}}{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}} {{#objcCompatible}} @@ -76,16 +76,18 @@ // Decodable protocol methods {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}}{{#objcCompatible}} required{{/objcCompatible}} init(from decoder: Decoder) throws { - let container = try decoder.container(keyedBy: String.self) + let container = try decoder.container(keyedBy: CodingKeys.self) {{#allVars}} - {{{name}}} = try container.decode{{#required}}{{#isNullable}}IfPresent{{/isNullable}}{{/required}}{{^required}}IfPresent{{/required}}({{{datatypeWithEnum}}}.self, forKey: "{{{baseName}}}") + {{{name}}} = try container.decode{{#required}}{{#isNullable}}IfPresent{{/isNullable}}{{/required}}{{^required}}IfPresent{{/required}}({{{datatypeWithEnum}}}.self, forKey: .{{{name}}}) {{/allVars}} + {{#additionalPropertiesType}} var nonAdditionalPropertyKeys = Set() {{#allVars}} nonAdditionalPropertyKeys.insert("{{{baseName}}}") {{/allVars}} - additionalProperties = try container.decodeMap({{{additionalPropertiesType}}}.self, excludedKeys: nonAdditionalPropertyKeys) + let additionalPropertiesContainer = try decoder.container(keyedBy: String.self) + additionalProperties = try additionalPropertiesContainer.decodeMap({{{additionalPropertiesType}}}.self, excludedKeys: nonAdditionalPropertyKeys) }{{/additionalPropertiesType}}{{/generateModelAdditionalProperties}}{{^objcCompatible}}{{#useClasses}}{{#vendorExtensions.x-swift-hashable}} {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static func == (lhs: {{classname}}, rhs: {{classname}}) -> Bool { @@ -101,4 +103,4 @@ {{/allVars}} {{#generateModelAdditionalProperties}}{{#additionalPropertiesType}}hasher.combine(additionalProperties.hashValue){{/additionalPropertiesType}}{{/generateModelAdditionalProperties}} }{{/vendorExtensions.x-swift-hashable}}{{/useClasses}}{{/objcCompatible}} -} \ No newline at end of file +} diff --git a/modules/openapi-generator/src/main/resources/swift5/modelOneOf.mustache b/modules/openapi-generator/src/main/resources/swift5/modelOneOf.mustache index 8aeddcc3c123..fae34faa975e 100644 --- a/modules/openapi-generator/src/main/resources/swift5/modelOneOf.mustache +++ b/modules/openapi-generator/src/main/resources/swift5/modelOneOf.mustache @@ -1,4 +1,4 @@ -public enum {{classname}}: Codable { +public enum {{classname}}: {{#useVapor}}Content{{/useVapor}}{{^useVapor}}Codable{{/useVapor}} { {{#oneOf}} case type{{.}}({{.}}) {{/oneOf}} From 25adf9448092cd50b767803518690ee4c68e9d29 Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Wed, 19 May 2021 13:41:44 -0400 Subject: [PATCH 5/6] [swift5] Fix AnyCodable missing in api.mustache and conform it to Content --- .../src/main/resources/swift5/Extensions.mustache | 2 ++ .../openapi-generator/src/main/resources/swift5/api.mustache | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/openapi-generator/src/main/resources/swift5/Extensions.mustache b/modules/openapi-generator/src/main/resources/swift5/Extensions.mustache index 26edd3f9a400..60bda60e3e25 100644 --- a/modules/openapi-generator/src/main/resources/swift5/Extensions.mustache +++ b/modules/openapi-generator/src/main/resources/swift5/Extensions.mustache @@ -236,6 +236,8 @@ extension Set: RequestDecodable where Element: Content { } extension Set: Content where Element: Content { } + +extension AnyCodable: Content {} {{/useVapor}} #if canImport(AnyCodable) diff --git a/modules/openapi-generator/src/main/resources/swift5/api.mustache b/modules/openapi-generator/src/main/resources/swift5/api.mustache index 8a96435266be..137e58196fba 100644 --- a/modules/openapi-generator/src/main/resources/swift5/api.mustache +++ b/modules/openapi-generator/src/main/resources/swift5/api.mustache @@ -11,7 +11,8 @@ import RxSwift{{/useRxSwift}}{{#useCombine}} #if canImport(Combine) import Combine #endif{{/useCombine}}{{#useVapor}} -import Vapor{{/useVapor}}{{#swiftUseApiNamespace}} +import Vapor{{/useVapor}} +import AnyCodable{{#swiftUseApiNamespace}} extension {{projectName}} { {{/swiftUseApiNamespace}} From af4c108502bf8d13f37763d883bb626dd6b17973 Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Wed, 19 May 2021 13:42:20 -0400 Subject: [PATCH 6/6] [swift5] Fix encoding body using ContentConfiguration --- .../openapi-generator/src/main/resources/swift5/api.mustache | 2 +- .../src/main/resources/swift5/modelObject.mustache | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/swift5/api.mustache b/modules/openapi-generator/src/main/resources/swift5/api.mustache index 137e58196fba..1483f145a7ba 100644 --- a/modules/openapi-generator/src/main/resources/swift5/api.mustache +++ b/modules/openapi-generator/src/main/resources/swift5/api.mustache @@ -257,7 +257,7 @@ extension {{projectName}} { {{#hasBodyParam}} {{#bodyParam}}{{#required}}{{#isBinary}}request.body = ByteBuffer(data: {{paramName}}){{/isBinary}}{{^isBinary}}{{#isFile}}request.body = ByteBuffer(data: {{paramName}}){{/isFile}}try request.content.encode({{paramName}}, using: Configuration.contentConfiguration.requireEncoder(for: {{{dataType}}}.defaultContentType)){{/isBinary}}{{/required}}{{^required}}if let body = {{paramName}} { - {{#isBinary}}request.body = ByteBuffer(data: body){{/isBinary}}{{^isBinary}}{{#isFile}}request.body = ByteBuffer(data: body){{/isFile}}try request.content.encode(body){{/isBinary}} + {{#isBinary}}request.body = ByteBuffer(data: body){{/isBinary}}{{^isBinary}}{{#isFile}}request.body = ByteBuffer(data: body){{/isFile}}try request.content.encode(body, using: Configuration.contentConfiguration.requireEncoder(for: {{{dataType}}}.defaultContentType)){{/isBinary}} }{{/required}}{{/bodyParam}} {{/hasBodyParam}} {{#hasFormParams}}struct FormParams: Content { diff --git a/modules/openapi-generator/src/main/resources/swift5/modelObject.mustache b/modules/openapi-generator/src/main/resources/swift5/modelObject.mustache index 665050633141..5a25aed84426 100644 --- a/modules/openapi-generator/src/main/resources/swift5/modelObject.mustache +++ b/modules/openapi-generator/src/main/resources/swift5/modelObject.mustache @@ -81,7 +81,7 @@ {{#allVars}} {{{name}}} = try container.decode{{#required}}{{#isNullable}}IfPresent{{/isNullable}}{{/required}}{{^required}}IfPresent{{/required}}({{{datatypeWithEnum}}}.self, forKey: .{{{name}}}) {{/allVars}} - {{#additionalPropertiesType}} + var nonAdditionalPropertyKeys = Set() {{#allVars}} nonAdditionalPropertyKeys.insert("{{{baseName}}}")