From 1a5b5924ed79bcbc62c240497f12fc5e66117798 Mon Sep 17 00:00:00 2001 From: Bruno Coelho <4brunu@users.noreply.github.com> Date: Tue, 19 Jul 2022 14:03:12 +0100 Subject: [PATCH] [Swift][client] update samples (#12923) --- .../Classes/OpenAPIs/URLSessionImplementations.swift | 4 ++-- .../Classes/OpenAPIs/URLSessionImplementations.swift | 4 ++-- .../Classes/OpenAPIs/URLSessionImplementations.swift | 4 ++-- .../Classes/OpenAPIs/URLSessionImplementations.swift | 4 ++-- .../Classes/OpenAPIs/URLSessionImplementations.swift | 4 ++-- .../Classes/OpenAPIs/URLSessionImplementations.swift | 4 ++-- .../Classes/OpenAPIs/URLSessionImplementations.swift | 4 ++-- .../Classes/OpenAPIs/URLSessionImplementations.swift | 4 ++-- .../Classes/OpenAPIs/URLSessionImplementations.swift | 4 ++-- .../Classes/OpenAPIs/URLSessionImplementations.swift | 4 ++-- .../Classes/OpenAPIs/URLSessionImplementations.swift | 4 ++-- .../Classes/OpenAPIs/URLSessionImplementations.swift | 4 ++-- .../Sources/PetstoreClient/URLSessionImplementations.swift | 4 ++-- .../Classes/OpenAPIs/URLSessionImplementations.swift | 4 ++-- 14 files changed, 28 insertions(+), 28 deletions(-) diff --git a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index a12e0bb4025..3c6578585ac 100644 --- a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -353,8 +353,8 @@ open class URLSessionDecodableRequestBuilder: URLSessionRequestBui default: guard let data = data, !data.isEmpty else { - if T.self is ExpressibleByNilLiteral.Type { - completion(.success(Response(response: httpResponse, body: Optional.none as! T))) + if let E = T.self as? ExpressibleByNilLiteral.Type { + completion(.success(Response(response: httpResponse, body: E.init(nilLiteral: ()) as! T))) } else { completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, response, DecodableRequestBuilderError.emptyDataResponse))) } diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index a12e0bb4025..3c6578585ac 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -353,8 +353,8 @@ open class URLSessionDecodableRequestBuilder: URLSessionRequestBui default: guard let data = data, !data.isEmpty else { - if T.self is ExpressibleByNilLiteral.Type { - completion(.success(Response(response: httpResponse, body: Optional.none as! T))) + if let E = T.self as? ExpressibleByNilLiteral.Type { + completion(.success(Response(response: httpResponse, body: E.init(nilLiteral: ()) as! T))) } else { completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, response, DecodableRequestBuilderError.emptyDataResponse))) } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index a12e0bb4025..3c6578585ac 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -353,8 +353,8 @@ open class URLSessionDecodableRequestBuilder: URLSessionRequestBui default: guard let data = data, !data.isEmpty else { - if T.self is ExpressibleByNilLiteral.Type { - completion(.success(Response(response: httpResponse, body: Optional.none as! T))) + if let E = T.self as? ExpressibleByNilLiteral.Type { + completion(.success(Response(response: httpResponse, body: E.init(nilLiteral: ()) as! T))) } else { completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, response, DecodableRequestBuilderError.emptyDataResponse))) } diff --git a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index a12e0bb4025..3c6578585ac 100644 --- a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -353,8 +353,8 @@ open class URLSessionDecodableRequestBuilder: URLSessionRequestBui default: guard let data = data, !data.isEmpty else { - if T.self is ExpressibleByNilLiteral.Type { - completion(.success(Response(response: httpResponse, body: Optional.none as! T))) + if let E = T.self as? ExpressibleByNilLiteral.Type { + completion(.success(Response(response: httpResponse, body: E.init(nilLiteral: ()) as! T))) } else { completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, response, DecodableRequestBuilderError.emptyDataResponse))) } diff --git a/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index a12e0bb4025..3c6578585ac 100644 --- a/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -353,8 +353,8 @@ open class URLSessionDecodableRequestBuilder: URLSessionRequestBui default: guard let data = data, !data.isEmpty else { - if T.self is ExpressibleByNilLiteral.Type { - completion(.success(Response(response: httpResponse, body: Optional.none as! T))) + if let E = T.self as? ExpressibleByNilLiteral.Type { + completion(.success(Response(response: httpResponse, body: E.init(nilLiteral: ()) as! T))) } else { completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, response, DecodableRequestBuilderError.emptyDataResponse))) } diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index 2502c1043e3..01831084210 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -353,8 +353,8 @@ internal class URLSessionDecodableRequestBuilder: URLSessionReques default: guard let data = data, !data.isEmpty else { - if T.self is ExpressibleByNilLiteral.Type { - completion(.success(Response(response: httpResponse, body: Optional.none as! T))) + if let E = T.self as? ExpressibleByNilLiteral.Type { + completion(.success(Response(response: httpResponse, body: E.init(nilLiteral: ()) as! T))) } else { completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, response, DecodableRequestBuilderError.emptyDataResponse))) } diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index a12e0bb4025..3c6578585ac 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -353,8 +353,8 @@ open class URLSessionDecodableRequestBuilder: URLSessionRequestBui default: guard let data = data, !data.isEmpty else { - if T.self is ExpressibleByNilLiteral.Type { - completion(.success(Response(response: httpResponse, body: Optional.none as! T))) + if let E = T.self as? ExpressibleByNilLiteral.Type { + completion(.success(Response(response: httpResponse, body: E.init(nilLiteral: ()) as! T))) } else { completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, response, DecodableRequestBuilderError.emptyDataResponse))) } diff --git a/samples/client/petstore/swift5/oneOf/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/oneOf/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index a12e0bb4025..3c6578585ac 100644 --- a/samples/client/petstore/swift5/oneOf/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/oneOf/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -353,8 +353,8 @@ open class URLSessionDecodableRequestBuilder: URLSessionRequestBui default: guard let data = data, !data.isEmpty else { - if T.self is ExpressibleByNilLiteral.Type { - completion(.success(Response(response: httpResponse, body: Optional.none as! T))) + if let E = T.self as? ExpressibleByNilLiteral.Type { + completion(.success(Response(response: httpResponse, body: E.init(nilLiteral: ()) as! T))) } else { completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, response, DecodableRequestBuilderError.emptyDataResponse))) } diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index a12e0bb4025..3c6578585ac 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -353,8 +353,8 @@ open class URLSessionDecodableRequestBuilder: URLSessionRequestBui default: guard let data = data, !data.isEmpty else { - if T.self is ExpressibleByNilLiteral.Type { - completion(.success(Response(response: httpResponse, body: Optional.none as! T))) + if let E = T.self as? ExpressibleByNilLiteral.Type { + completion(.success(Response(response: httpResponse, body: E.init(nilLiteral: ()) as! T))) } else { completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, response, DecodableRequestBuilderError.emptyDataResponse))) } diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index a12e0bb4025..3c6578585ac 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -353,8 +353,8 @@ open class URLSessionDecodableRequestBuilder: URLSessionRequestBui default: guard let data = data, !data.isEmpty else { - if T.self is ExpressibleByNilLiteral.Type { - completion(.success(Response(response: httpResponse, body: Optional.none as! T))) + if let E = T.self as? ExpressibleByNilLiteral.Type { + completion(.success(Response(response: httpResponse, body: E.init(nilLiteral: ()) as! T))) } else { completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, response, DecodableRequestBuilderError.emptyDataResponse))) } diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index a12e0bb4025..3c6578585ac 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -353,8 +353,8 @@ open class URLSessionDecodableRequestBuilder: URLSessionRequestBui default: guard let data = data, !data.isEmpty else { - if T.self is ExpressibleByNilLiteral.Type { - completion(.success(Response(response: httpResponse, body: Optional.none as! T))) + if let E = T.self as? ExpressibleByNilLiteral.Type { + completion(.success(Response(response: httpResponse, body: E.init(nilLiteral: ()) as! T))) } else { completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, response, DecodableRequestBuilderError.emptyDataResponse))) } diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index a12e0bb4025..3c6578585ac 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -353,8 +353,8 @@ open class URLSessionDecodableRequestBuilder: URLSessionRequestBui default: guard let data = data, !data.isEmpty else { - if T.self is ExpressibleByNilLiteral.Type { - completion(.success(Response(response: httpResponse, body: Optional.none as! T))) + if let E = T.self as? ExpressibleByNilLiteral.Type { + completion(.success(Response(response: httpResponse, body: E.init(nilLiteral: ()) as! T))) } else { completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, response, DecodableRequestBuilderError.emptyDataResponse))) } diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/URLSessionImplementations.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/URLSessionImplementations.swift index a12e0bb4025..3c6578585ac 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/URLSessionImplementations.swift @@ -353,8 +353,8 @@ open class URLSessionDecodableRequestBuilder: URLSessionRequestBui default: guard let data = data, !data.isEmpty else { - if T.self is ExpressibleByNilLiteral.Type { - completion(.success(Response(response: httpResponse, body: Optional.none as! T))) + if let E = T.self as? ExpressibleByNilLiteral.Type { + completion(.success(Response(response: httpResponse, body: E.init(nilLiteral: ()) as! T))) } else { completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, response, DecodableRequestBuilderError.emptyDataResponse))) } diff --git a/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index a12e0bb4025..3c6578585ac 100644 --- a/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -353,8 +353,8 @@ open class URLSessionDecodableRequestBuilder: URLSessionRequestBui default: guard let data = data, !data.isEmpty else { - if T.self is ExpressibleByNilLiteral.Type { - completion(.success(Response(response: httpResponse, body: Optional.none as! T))) + if let E = T.self as? ExpressibleByNilLiteral.Type { + completion(.success(Response(response: httpResponse, body: E.init(nilLiteral: ()) as! T))) } else { completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, response, DecodableRequestBuilderError.emptyDataResponse))) }