From 8e10dd7be71d9a768f3788393ca8b42544a8618d Mon Sep 17 00:00:00 2001
From: Bruno Coelho <4brunu@users.noreply.github.com>
Date: Fri, 4 Oct 2024 15:52:48 +0100
Subject: [PATCH] [swift6] add samples that test upload files as data (#19780)
* [swift6] upload files as data
* [swift6] upload files as data
* [swift6] upload files as data
* [swift6] upload files as data
* [swift6] upload files as data
* [swift6] upload files as data
---
bin/configs/swift6-api-non-static-method.yaml | 1 +
bin/configs/swift6-urlsessionLibrary.yaml | 1 +
docs/generators/swift6.md | 2 +-
.../languages/Swift6ClientCodegen.java | 2 +-
.../Sources/PetstoreClient/APIs/FakeAPI.swift | 14 +++++-----
.../Sources/PetstoreClient/APIs/PetAPI.swift | 28 +++++++++----------
.../PetstoreClient/Models/FormatTest.swift | 4 +--
.../SwaggerClientTests/PetAPITests.swift | 9 ++----
.../swift6/apiNonStaticMethod/docs/FakeAPI.md | 8 +++---
.../apiNonStaticMethod/docs/FormatTest.md | 2 +-
.../swift6/apiNonStaticMethod/docs/PetAPI.md | 16 +++++------
.../Sources/PetstoreClient/APIs/FakeAPI.swift | 4 +--
.../Sources/PetstoreClient/APIs/PetAPI.swift | 8 +++---
.../PetstoreClient/Models/FormatTest.swift | 4 +--
.../SwaggerClientTests/PetAPITests.swift | 8 ++----
.../swift6/urlsessionLibrary/docs/FakeAPI.md | 6 ++--
.../urlsessionLibrary/docs/FormatTest.md | 2 +-
.../swift6/urlsessionLibrary/docs/PetAPI.md | 12 ++++----
18 files changed, 62 insertions(+), 69 deletions(-)
diff --git a/bin/configs/swift6-api-non-static-method.yaml b/bin/configs/swift6-api-non-static-method.yaml
index de4424cf95d..1c5c19272c9 100644
--- a/bin/configs/swift6-api-non-static-method.yaml
+++ b/bin/configs/swift6-api-non-static-method.yaml
@@ -6,6 +6,7 @@ templateDir: modules/openapi-generator/src/main/resources/swift6
additionalProperties:
responseAs: AsyncAwait,Combine,Result,PromiseKit,RxSwift,ObjcBlock
apiStaticMethod: false
+ mapFileBinaryToData: true
podAuthors: ""
podSummary: PetstoreClient
projectName: PetstoreClient
diff --git a/bin/configs/swift6-urlsessionLibrary.yaml b/bin/configs/swift6-urlsessionLibrary.yaml
index 9b515a7a032..a1d0122c101 100644
--- a/bin/configs/swift6-urlsessionLibrary.yaml
+++ b/bin/configs/swift6-urlsessionLibrary.yaml
@@ -11,5 +11,6 @@ additionalProperties:
projectName: PetstoreClient
podHomepage: https://github.com/openapitools/openapi-generator
useSPMFileStructure: true
+ mapFileBinaryToData: true
useClasses: true
swiftUseApiNamespace: true
diff --git a/docs/generators/swift6.md b/docs/generators/swift6.md
index 804157d09ff..3828b2d89d6 100644
--- a/docs/generators/swift6.md
+++ b/docs/generators/swift6.md
@@ -30,7 +30,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|
- **true**
- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
- **false**
- The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
|true|
|library|Library template (sub-template) to use|- **urlsession**
- [DEFAULT] HTTP client: URLSession
- **alamofire**
- HTTP client: Alamofire
- **vapor**
- HTTP client: Vapor
|urlsession|
-|mapFileBinaryToData|[WARNING] This option will be removed and enabled by default in the future once we've enhanced the code to work with `Data` in all the different situations. Map File and Binary to Data (default: false)| |false|
+|mapFileBinaryToData|Map File and Binary to Data (default: false)| |false|
|nonPublicApi|Generates code with reduced access modifiers; allows embedding elsewhere without exposing non-public API calls to consumers.(default: false)| |null|
|objcCompatible|Add additional properties and methods for Objective-C compatibility (default: false)| |null|
|oneOfUnknownDefaultCase|Add unknownDefault case to oneOf enum (default: false)| |false|
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift6ClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift6ClientCodegen.java
index c9840be8038..091dec2201b 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift6ClientCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift6ClientCodegen.java
@@ -338,7 +338,7 @@ public class Swift6ClientCodegen extends DefaultCodegen implements CodegenConfig
.defaultValue(Boolean.TRUE.toString()));
cliOptions.add(new CliOption(MAP_FILE_BINARY_TO_DATA,
- "[WARNING] This option will be removed and enabled by default in the future once we've enhanced the code to work with `Data` in all the different situations. Map File and Binary to Data (default: false)")
+ "Map File and Binary to Data (default: false)")
.defaultValue(Boolean.FALSE.toString()));
cliOptions.add(new CliOption(USE_CUSTOM_DATE_WITHOUT_TIME,
diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/FakeAPI.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/FakeAPI.swift
index 9e61ba6f619..e846df31d38 100644
--- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/FakeAPI.swift
+++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/FakeAPI.swift
@@ -1034,7 +1034,7 @@ open class FakeAPI {
- parameter completion: completion handler to receive the data and the error objects
*/
@discardableResult
- open 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: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask {
+ open 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: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask {
return 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 { result in
switch result {
case .success:
@@ -1064,7 +1064,7 @@ open class FakeAPI {
- parameter callback: (form) None (optional)
- returns: Promise
*/
- open 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 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 {
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 { result in
switch result {
@@ -1096,7 +1096,7 @@ open class FakeAPI {
- parameter callback: (form) None (optional)
- returns: Observable
*/
- open 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 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 {
return Observable.create { observer -> Disposable in
let requestTask = self.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 { result in
switch result {
@@ -1135,7 +1135,7 @@ open class FakeAPI {
*/
#if canImport(Combine)
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
- open 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) -> AnyPublisher {
+ open 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) -> AnyPublisher {
let requestBuilder = 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)
let requestTask = requestBuilder.requestTask
return Deferred { Future { promise in
@@ -1178,7 +1178,7 @@ open class FakeAPI {
- returns: Void
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
- open 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) async throws(ErrorResponse) {
+ open 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) async throws(ErrorResponse) {
return try await 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().body
}
@@ -1202,7 +1202,7 @@ open class FakeAPI {
- parameter completion: completion handler to receive the result
*/
@discardableResult
- open 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: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask {
+ open 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: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask {
return 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 { result in
switch result {
case .success:
@@ -1237,7 +1237,7 @@ open class FakeAPI {
- returns: RequestBuilder
*/
- open 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 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 localVariablePath = "/fake"
let localVariableURLString = openAPIClient.basePath + localVariablePath
let localVariableFormParams: [String: Any?] = [
diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/PetAPI.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/PetAPI.swift
index f0d49f20f8a..208d8d4de22 100644
--- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/PetAPI.swift
+++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/PetAPI.swift
@@ -1134,7 +1134,7 @@ open class PetAPI {
- parameter completion: completion handler to receive the data and the error objects
*/
@discardableResult
- open func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, completion: @Sendable @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) -> RequestTask {
+ open func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil, completion: @Sendable @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) -> RequestTask {
return uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute { result in
switch result {
case let .success(response):
@@ -1153,7 +1153,7 @@ open class PetAPI {
- parameter file: (form) file to upload (optional)
- returns: Promise
*/
- open func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil) -> Promise {
+ open func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil) -> Promise {
let deferred = Promise.pending()
uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute { result in
switch result {
@@ -1174,7 +1174,7 @@ open class PetAPI {
- parameter file: (form) file to upload (optional)
- returns: Observable
*/
- open func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil) -> Observable {
+ open func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil) -> Observable {
return Observable.create { observer -> Disposable in
let requestTask = self.uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute { result in
switch result {
@@ -1202,7 +1202,7 @@ open class PetAPI {
*/
#if canImport(Combine)
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
- open func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil) -> AnyPublisher {
+ open func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil) -> AnyPublisher {
let requestBuilder = uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file)
let requestTask = requestBuilder.requestTask
return Deferred { Future { promise in
@@ -1234,7 +1234,7 @@ open class PetAPI {
- returns: ApiResponse
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
- open func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil) async throws(ErrorResponse) -> ApiResponse {
+ open func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil) async throws(ErrorResponse) -> ApiResponse {
return try await uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute().body
}
@@ -1247,7 +1247,7 @@ open class PetAPI {
- parameter completion: completion handler to receive the result
*/
@discardableResult
- open func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask {
+ open func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask {
return uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute { result in
switch result {
case let .success(response):
@@ -1270,7 +1270,7 @@ open class PetAPI {
- returns: RequestBuilder
*/
- open func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil) -> RequestBuilder {
+ open func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil) -> RequestBuilder {
var localVariablePath = "/pet/{petId}/uploadImage"
let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))"
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
@@ -1306,7 +1306,7 @@ open class PetAPI {
- parameter completion: completion handler to receive the data and the error objects
*/
@discardableResult
- open func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, completion: @Sendable @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) -> RequestTask {
+ open func uploadFileWithRequiredFile(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil, completion: @Sendable @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) -> RequestTask {
return uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute { result in
switch result {
case let .success(response):
@@ -1325,7 +1325,7 @@ open class PetAPI {
- parameter additionalMetadata: (form) Additional data to pass to server (optional)
- returns: Promise
*/
- open func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil) -> Promise {
+ open func uploadFileWithRequiredFile(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil) -> Promise {
let deferred = Promise.pending()
uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute { result in
switch result {
@@ -1346,7 +1346,7 @@ open class PetAPI {
- parameter additionalMetadata: (form) Additional data to pass to server (optional)
- returns: Observable
*/
- open func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil) -> Observable {
+ open func uploadFileWithRequiredFile(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil) -> Observable {
return Observable.create { observer -> Disposable in
let requestTask = self.uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute { result in
switch result {
@@ -1374,7 +1374,7 @@ open class PetAPI {
*/
#if canImport(Combine)
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
- open func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil) -> AnyPublisher {
+ open func uploadFileWithRequiredFile(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil) -> AnyPublisher {
let requestBuilder = uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata)
let requestTask = requestBuilder.requestTask
return Deferred { Future { promise in
@@ -1406,7 +1406,7 @@ open class PetAPI {
- returns: ApiResponse
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
- open func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil) async throws(ErrorResponse) -> ApiResponse {
+ open func uploadFileWithRequiredFile(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil) async throws(ErrorResponse) -> ApiResponse {
return try await uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute().body
}
@@ -1419,7 +1419,7 @@ open class PetAPI {
- parameter completion: completion handler to receive the result
*/
@discardableResult
- open func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask {
+ open func uploadFileWithRequiredFile(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask {
return uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute { result in
switch result {
case let .success(response):
@@ -1442,7 +1442,7 @@ open class PetAPI {
- returns: RequestBuilder
*/
- open func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil) -> RequestBuilder {
+ open func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil) -> RequestBuilder {
var localVariablePath = "/fake/{petId}/uploadImageWithRequiredFile"
let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))"
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/FormatTest.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/FormatTest.swift
index 90b86307a82..70ec7e278e2 100644
--- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/FormatTest.swift
+++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/FormatTest.swift
@@ -24,13 +24,13 @@ public struct FormatTest: Codable, JSONEncodable, 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/swift6/apiNonStaticMethod/SwaggerClientTests/SwaggerClientTests/PetAPITests.swift b/samples/client/petstore/swift6/apiNonStaticMethod/SwaggerClientTests/SwaggerClientTests/PetAPITests.swift
index 2dbc4efde84..585ba5e5c5e 100644
--- a/samples/client/petstore/swift6/apiNonStaticMethod/SwaggerClientTests/SwaggerClientTests/PetAPITests.swift
+++ b/samples/client/petstore/swift6/apiNonStaticMethod/SwaggerClientTests/SwaggerClientTests/PetAPITests.swift
@@ -52,21 +52,16 @@ class PetAPITests: XCTestCase {
}
func test3UploadFile() async throws {
- let imageName = UUID().uuidString + ".png"
-
guard
let image = UIImage(color: .red, size: CGSize(width: 10, height: 10)),
- let imageURL = FileUtils.saveImage(imageName: imageName, image: image)
+ let imageData = image.pngData()
else {
fatalError()
}
do {
- let _ = try await PetAPI().uploadFile(petId: 1000, additionalMetadata: "additionalMetadata", file: imageURL)
-
- FileUtils.deleteFile(fileURL: imageURL)
+ let _ = try await PetAPI().uploadFile(petId: 1000, additionalMetadata: "additionalMetadata", file: imageData)
} catch {
- FileUtils.deleteFile(fileURL: imageURL)
XCTFail("error uploading file")
}
}
diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/docs/FakeAPI.md b/samples/client/petstore/swift6/apiNonStaticMethod/docs/FakeAPI.md
index 1d8f61802d0..1b34193a2ab 100644
--- a/samples/client/petstore/swift6/apiNonStaticMethod/docs/FakeAPI.md
+++ b/samples/client/petstore/swift6/apiNonStaticMethod/docs/FakeAPI.md
@@ -357,8 +357,8 @@ 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: 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) -> 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) -> Observable
```
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
@@ -379,7 +379,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 = Data([9, 8, 7]) // Data | None (optional)
let date = Date() // Date | None (optional)
let dateTime = Date() // Date | None (optional)
let password = "password_example" // String | None (optional)
@@ -409,7 +409,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/swift6/apiNonStaticMethod/docs/FormatTest.md b/samples/client/petstore/swift6/apiNonStaticMethod/docs/FormatTest.md
index f74d94f6c46..04e7113e3dc 100644
--- a/samples/client/petstore/swift6/apiNonStaticMethod/docs/FormatTest.md
+++ b/samples/client/petstore/swift6/apiNonStaticMethod/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/swift6/apiNonStaticMethod/docs/PetAPI.md b/samples/client/petstore/swift6/apiNonStaticMethod/docs/PetAPI.md
index 38ade060615..b675fdb7bb7 100644
--- a/samples/client/petstore/swift6/apiNonStaticMethod/docs/PetAPI.md
+++ b/samples/client/petstore/swift6/apiNonStaticMethod/docs/PetAPI.md
@@ -358,8 +358,8 @@ 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: URL? = nil) -> Observable
+ open class func uploadFile( petId: Int64, additionalMetadata: String? = nil, file: Data? = nil) -> Promise
+ open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil) -> Observable
```
uploads an image
@@ -371,7 +371,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 = Data([9, 8, 7]) // Data | file to upload (optional)
// uploads an image
PetAPI.uploadFile(petId: petId, additionalMetadata: additionalMetadata, file: file).then {
@@ -390,7 +390,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
@@ -409,8 +409,8 @@ 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: URL, additionalMetadata: String? = nil) -> Observable
+ open class func uploadFileWithRequiredFile( petId: Int64, requiredFile: Data, additionalMetadata: String? = nil) -> Promise
+ open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil) -> Observable
```
uploads an image (required)
@@ -421,7 +421,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 = Data([9, 8, 7]) // Data | file to upload
let additionalMetadata = "additionalMetadata_example" // String | Additional data to pass to server (optional)
// uploads an image (required)
@@ -440,7 +440,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/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift
index ed4e2674496..12fa67f70c9 100644
--- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift
+++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift
@@ -347,7 +347,7 @@ open class FakeAPI {
- parameter completion: completion handler to receive the data and the error objects
*/
@discardableResult
- 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask {
+ 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: Void?, _ error: Error?) -> Void) -> RequestTask {
return 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, openAPIClient: openAPIClient).execute { result in
switch result {
case .success:
@@ -383,7 +383,7 @@ open class FakeAPI {
- parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request.
- 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> 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, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder {
let localVariablePath = "/fake"
let localVariableURLString = openAPIClient.basePath + localVariablePath
let localVariableFormParams: [String: Any?] = [
diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/PetAPI.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/PetAPI.swift
index 31165243838..563d2e2794d 100644
--- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/PetAPI.swift
+++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/PetAPI.swift
@@ -402,7 +402,7 @@ open class PetAPI {
- parameter completion: completion handler to receive the data and the error objects
*/
@discardableResult
- open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) -> RequestTask {
+ open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) -> RequestTask {
return uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file, openAPIClient: openAPIClient).execute { result in
switch result {
case let .success(response):
@@ -426,7 +426,7 @@ open class PetAPI {
- parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request.
- returns: RequestBuilder
*/
- open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder {
+ open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder {
var localVariablePath = "/pet/{petId}/uploadImage"
let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))"
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
@@ -463,7 +463,7 @@ open class PetAPI {
- parameter completion: completion handler to receive the data and the error objects
*/
@discardableResult
- open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) -> RequestTask {
+ open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared, completion: @Sendable @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) -> RequestTask {
return uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata, openAPIClient: openAPIClient).execute { result in
switch result {
case let .success(response):
@@ -487,7 +487,7 @@ open class PetAPI {
- parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request.
- returns: RequestBuilder
*/
- open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder {
+ open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder {
var localVariablePath = "/fake/{petId}/uploadImageWithRequiredFile"
let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))"
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/FormatTest.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/FormatTest.swift
index 78bcc0302b3..c2280609c11 100644
--- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/FormatTest.swift
+++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/FormatTest.swift
@@ -29,13 +29,13 @@ public final class FormatTest: Codable, JSONEncodable, 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/swift6/urlsessionLibrary/SwaggerClientTests/SwaggerClientTests/PetAPITests.swift b/samples/client/petstore/swift6/urlsessionLibrary/SwaggerClientTests/SwaggerClientTests/PetAPITests.swift
index 3271b958714..92b3107bf4f 100644
--- a/samples/client/petstore/swift6/urlsessionLibrary/SwaggerClientTests/SwaggerClientTests/PetAPITests.swift
+++ b/samples/client/petstore/swift6/urlsessionLibrary/SwaggerClientTests/SwaggerClientTests/PetAPITests.swift
@@ -66,23 +66,19 @@ class PetAPITests: XCTestCase {
func test3UploadFile() {
let expectation = self.expectation(description: "testUploadFile")
- let imageName = UUID().uuidString + ".png"
-
guard
let image = UIImage(color: .red, size: CGSize(width: 10, height: 10)),
- let imageURL = FileUtils.saveImage(imageName: imageName, image: image)
+ let imageData = image.pngData()
else {
fatalError()
}
- PetstoreClientAPI.PetAPI.uploadFile(petId: 1000, additionalMetadata: "additionalMetadata", file: imageURL) { (_, error) in
+ PetstoreClientAPI.PetAPI.uploadFile(petId: 1000, additionalMetadata: "additionalMetadata", file: imageData) { (_, error) in
guard error == nil else {
- FileUtils.deleteFile(fileURL: imageURL)
XCTFail("error uploading file")
return
}
- FileUtils.deleteFile(fileURL: imageURL)
expectation.fulfill()
}
diff --git a/samples/client/petstore/swift6/urlsessionLibrary/docs/FakeAPI.md b/samples/client/petstore/swift6/urlsessionLibrary/docs/FakeAPI.md
index 69b1faa2b99..f4348177a71 100644
--- a/samples/client/petstore/swift6/urlsessionLibrary/docs/FakeAPI.md
+++ b/samples/client/petstore/swift6/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 = Data([9, 8, 7]) // 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/swift6/urlsessionLibrary/docs/FormatTest.md b/samples/client/petstore/swift6/urlsessionLibrary/docs/FormatTest.md
index f74d94f6c46..04e7113e3dc 100644
--- a/samples/client/petstore/swift6/urlsessionLibrary/docs/FormatTest.md
+++ b/samples/client/petstore/swift6/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/swift6/urlsessionLibrary/docs/PetAPI.md b/samples/client/petstore/swift6/urlsessionLibrary/docs/PetAPI.md
index e6219c37c4e..2b3e7c15318 100644
--- a/samples/client/petstore/swift6/urlsessionLibrary/docs/PetAPI.md
+++ b/samples/client/petstore/swift6/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 = Data([9, 8, 7]) // 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 = Data([9, 8, 7]) // 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