From 64d9719d391d4d6df21d6a620efc2089aaba4b55 Mon Sep 17 00:00:00 2001 From: Bruno Coelho <4brunu@users.noreply.github.com> Date: Tue, 22 Apr 2025 11:58:53 +0100 Subject: [PATCH] [swift6][client] All models conform to Codable so this method should not be needed anymore (#21117) * [swift6][client] All models conform to Codable so this method should not be needed anymore * [swift6][client] All models conform to Codable so this method should not be needed anymore --- .../resources/swift6/JSONEncodingHelper.mustache | 16 ---------------- .../Infrastructure/JSONEncodingHelper.swift | 16 ---------------- .../Infrastructure/JSONEncodingHelper.swift | 16 ---------------- .../Infrastructure/JSONEncodingHelper.swift | 16 ---------------- .../Infrastructure/JSONEncodingHelper.swift | 16 ---------------- .../Infrastructure/JSONEncodingHelper.swift | 16 ---------------- .../Infrastructure/JSONEncodingHelper.swift | 16 ---------------- .../Infrastructure/JSONEncodingHelper.swift | 16 ---------------- .../Infrastructure/JSONEncodingHelper.swift | 16 ---------------- .../Infrastructure/JSONEncodingHelper.swift | 16 ---------------- .../Infrastructure/JSONEncodingHelper.swift | 16 ---------------- .../Infrastructure/JSONEncodingHelper.swift | 16 ---------------- .../Infrastructure/JSONEncodingHelper.swift | 16 ---------------- .../Infrastructure/JSONEncodingHelper.swift | 16 ---------------- 14 files changed, 224 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/swift6/JSONEncodingHelper.mustache b/modules/openapi-generator/src/main/resources/swift6/JSONEncodingHelper.mustache index d3045ec1edc..d6e7308600f 100644 --- a/modules/openapi-generator/src/main/resources/swift6/JSONEncodingHelper.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/JSONEncodingHelper.mustache @@ -26,20 +26,4 @@ import Foundation return params } - {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func encodingParameters(forEncodableObject encodableObj: Any?, codableHelper: CodableHelper) -> [String: any Sendable]? { - var params: [String: any Sendable]? - - if let encodableObj = encodableObj { - do { - let data = try JSONSerialization.data(withJSONObject: encodableObj, options: .prettyPrinted) - params = JSONDataEncoding.encodingParameters(jsonData: data) - } catch { - print(error.localizedDescription) - return nil - } - } - - return params - } - } diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift index d28af2eba97..71c8b4e84fa 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift @@ -26,20 +26,4 @@ open class JSONEncodingHelper { return params } - open class func encodingParameters(forEncodableObject encodableObj: Any?, codableHelper: CodableHelper) -> [String: any Sendable]? { - var params: [String: any Sendable]? - - if let encodableObj = encodableObj { - do { - let data = try JSONSerialization.data(withJSONObject: encodableObj, options: .prettyPrinted) - params = JSONDataEncoding.encodingParameters(jsonData: data) - } catch { - print(error.localizedDescription) - return nil - } - } - - return params - } - } diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift index d28af2eba97..71c8b4e84fa 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift @@ -26,20 +26,4 @@ open class JSONEncodingHelper { return params } - open class func encodingParameters(forEncodableObject encodableObj: Any?, codableHelper: CodableHelper) -> [String: any Sendable]? { - var params: [String: any Sendable]? - - if let encodableObj = encodableObj { - do { - let data = try JSONSerialization.data(withJSONObject: encodableObj, options: .prettyPrinted) - params = JSONDataEncoding.encodingParameters(jsonData: data) - } catch { - print(error.localizedDescription) - return nil - } - } - - return params - } - } diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift index d28af2eba97..71c8b4e84fa 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift @@ -26,20 +26,4 @@ open class JSONEncodingHelper { return params } - open class func encodingParameters(forEncodableObject encodableObj: Any?, codableHelper: CodableHelper) -> [String: any Sendable]? { - var params: [String: any Sendable]? - - if let encodableObj = encodableObj { - do { - let data = try JSONSerialization.data(withJSONObject: encodableObj, options: .prettyPrinted) - params = JSONDataEncoding.encodingParameters(jsonData: data) - } catch { - print(error.localizedDescription) - return nil - } - } - - return params - } - } diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift index d28af2eba97..71c8b4e84fa 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift @@ -26,20 +26,4 @@ open class JSONEncodingHelper { return params } - open class func encodingParameters(forEncodableObject encodableObj: Any?, codableHelper: CodableHelper) -> [String: any Sendable]? { - var params: [String: any Sendable]? - - if let encodableObj = encodableObj { - do { - let data = try JSONSerialization.data(withJSONObject: encodableObj, options: .prettyPrinted) - params = JSONDataEncoding.encodingParameters(jsonData: data) - } catch { - print(error.localizedDescription) - return nil - } - } - - return params - } - } diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/JSONEncodingHelper.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/JSONEncodingHelper.swift index d28af2eba97..71c8b4e84fa 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/JSONEncodingHelper.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/JSONEncodingHelper.swift @@ -26,20 +26,4 @@ open class JSONEncodingHelper { return params } - open class func encodingParameters(forEncodableObject encodableObj: Any?, codableHelper: CodableHelper) -> [String: any Sendable]? { - var params: [String: any Sendable]? - - if let encodableObj = encodableObj { - do { - let data = try JSONSerialization.data(withJSONObject: encodableObj, options: .prettyPrinted) - params = JSONDataEncoding.encodingParameters(jsonData: data) - } catch { - print(error.localizedDescription) - return nil - } - } - - return params - } - } diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift index d28af2eba97..71c8b4e84fa 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift @@ -26,20 +26,4 @@ open class JSONEncodingHelper { return params } - open class func encodingParameters(forEncodableObject encodableObj: Any?, codableHelper: CodableHelper) -> [String: any Sendable]? { - var params: [String: any Sendable]? - - if let encodableObj = encodableObj { - do { - let data = try JSONSerialization.data(withJSONObject: encodableObj, options: .prettyPrinted) - params = JSONDataEncoding.encodingParameters(jsonData: data) - } catch { - print(error.localizedDescription) - return nil - } - } - - return params - } - } diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift index d28af2eba97..71c8b4e84fa 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift @@ -26,20 +26,4 @@ open class JSONEncodingHelper { return params } - open class func encodingParameters(forEncodableObject encodableObj: Any?, codableHelper: CodableHelper) -> [String: any Sendable]? { - var params: [String: any Sendable]? - - if let encodableObj = encodableObj { - do { - let data = try JSONSerialization.data(withJSONObject: encodableObj, options: .prettyPrinted) - params = JSONDataEncoding.encodingParameters(jsonData: data) - } catch { - print(error.localizedDescription) - return nil - } - } - - return params - } - } diff --git a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift index d28af2eba97..71c8b4e84fa 100644 --- a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift +++ b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift @@ -26,20 +26,4 @@ open class JSONEncodingHelper { return params } - open class func encodingParameters(forEncodableObject encodableObj: Any?, codableHelper: CodableHelper) -> [String: any Sendable]? { - var params: [String: any Sendable]? - - if let encodableObj = encodableObj { - do { - let data = try JSONSerialization.data(withJSONObject: encodableObj, options: .prettyPrinted) - params = JSONDataEncoding.encodingParameters(jsonData: data) - } catch { - print(error.localizedDescription) - return nil - } - } - - return params - } - } diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift index d28af2eba97..71c8b4e84fa 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift @@ -26,20 +26,4 @@ open class JSONEncodingHelper { return params } - open class func encodingParameters(forEncodableObject encodableObj: Any?, codableHelper: CodableHelper) -> [String: any Sendable]? { - var params: [String: any Sendable]? - - if let encodableObj = encodableObj { - do { - let data = try JSONSerialization.data(withJSONObject: encodableObj, options: .prettyPrinted) - params = JSONDataEncoding.encodingParameters(jsonData: data) - } catch { - print(error.localizedDescription) - return nil - } - } - - return params - } - } diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift index 208ee2c917e..7d61b0e7756 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift @@ -26,20 +26,4 @@ internal class JSONEncodingHelper { return params } - internal class func encodingParameters(forEncodableObject encodableObj: Any?, codableHelper: CodableHelper) -> [String: any Sendable]? { - var params: [String: any Sendable]? - - if let encodableObj = encodableObj { - do { - let data = try JSONSerialization.data(withJSONObject: encodableObj, options: .prettyPrinted) - params = JSONDataEncoding.encodingParameters(jsonData: data) - } catch { - print(error.localizedDescription) - return nil - } - } - - return params - } - } diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift index d28af2eba97..71c8b4e84fa 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift @@ -26,20 +26,4 @@ open class JSONEncodingHelper { return params } - open class func encodingParameters(forEncodableObject encodableObj: Any?, codableHelper: CodableHelper) -> [String: any Sendable]? { - var params: [String: any Sendable]? - - if let encodableObj = encodableObj { - do { - let data = try JSONSerialization.data(withJSONObject: encodableObj, options: .prettyPrinted) - params = JSONDataEncoding.encodingParameters(jsonData: data) - } catch { - print(error.localizedDescription) - return nil - } - } - - return params - } - } diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift index d28af2eba97..71c8b4e84fa 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift @@ -26,20 +26,4 @@ open class JSONEncodingHelper { return params } - open class func encodingParameters(forEncodableObject encodableObj: Any?, codableHelper: CodableHelper) -> [String: any Sendable]? { - var params: [String: any Sendable]? - - if let encodableObj = encodableObj { - do { - let data = try JSONSerialization.data(withJSONObject: encodableObj, options: .prettyPrinted) - params = JSONDataEncoding.encodingParameters(jsonData: data) - } catch { - print(error.localizedDescription) - return nil - } - } - - return params - } - } diff --git a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift index d28af2eba97..71c8b4e84fa 100644 --- a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift +++ b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift @@ -26,20 +26,4 @@ open class JSONEncodingHelper { return params } - open class func encodingParameters(forEncodableObject encodableObj: Any?, codableHelper: CodableHelper) -> [String: any Sendable]? { - var params: [String: any Sendable]? - - if let encodableObj = encodableObj { - do { - let data = try JSONSerialization.data(withJSONObject: encodableObj, options: .prettyPrinted) - params = JSONDataEncoding.encodingParameters(jsonData: data) - } catch { - print(error.localizedDescription) - return nil - } - } - - return params - } - }