Skip to content

Commit

Permalink
[swift6] general improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
4brunu committed Oct 2, 2024
1 parent 46ce226 commit eeb9149
Show file tree
Hide file tree
Showing 82 changed files with 225 additions and 225 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import Foundation
return params
}

{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func encodingParameters(forEncodableObject encodableObj: Any?) -> [String: Any]? {
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func encodingParameters(forEncodableObject encodableObj: Any?, codableHelper: CodableHelper) -> [String: Any]? {
var params: [String: Any]?
if let encodableObj = encodableObj {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ extension {{projectName}}API {
{{#objcCompatible}}@objcMembers {{/objcCompatible}}{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class {{classname}}{{#objcCompatible}} : NSObject{{/objcCompatible}} {
{{^apiStaticMethod}}
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let openAPIClient: OpenAPIClient
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init(openAPIClient: OpenAPIClient) {
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init(openAPIClient: OpenAPIClient = OpenAPIClient.shared) {
self.openAPIClient = openAPIClient
}
{{/apiStaticMethod}}
Expand Down Expand Up @@ -425,7 +425,7 @@ extension {{projectName}}API {
let localVariableParameters = ["body": {{paramName}}]
{{/isBinary}}
{{^isBinary}}
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: {{paramName}})
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: {{paramName}}, codableHelper: openAPIClient.codableHelper)
{{/isBinary}}
{{/bodyParam}}
{{^bodyParam}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ open class AnotherFakeAPI {
open class func call123testSpecialTagsWithRequestBuilder(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder<Client> {
let localVariablePath = "/another-fake/dummy"
let localVariableURLString = openAPIClient.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper)

let localVariableUrlComponents = URLComponents(string: localVariableURLString)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ open class FakeAPI {
open class func fakeOuterBooleanSerializeWithRequestBuilder(body: Bool? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder<Bool> {
let localVariablePath = "/fake/outer/boolean"
let localVariableURLString = openAPIClient.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper)

let localVariableUrlComponents = URLComponents(string: localVariableURLString)

Expand Down Expand Up @@ -85,7 +85,7 @@ open class FakeAPI {
open class func fakeOuterCompositeSerializeWithRequestBuilder(body: OuterComposite? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder<OuterComposite> {
let localVariablePath = "/fake/outer/composite"
let localVariableURLString = openAPIClient.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper)

let localVariableUrlComponents = URLComponents(string: localVariableURLString)

Expand Down Expand Up @@ -129,7 +129,7 @@ open class FakeAPI {
open class func fakeOuterNumberSerializeWithRequestBuilder(body: Double? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder<Double> {
let localVariablePath = "/fake/outer/number"
let localVariableURLString = openAPIClient.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper)

let localVariableUrlComponents = URLComponents(string: localVariableURLString)

Expand Down Expand Up @@ -173,7 +173,7 @@ open class FakeAPI {
open class func fakeOuterStringSerializeWithRequestBuilder(body: String? = nil, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder<String> {
let localVariablePath = "/fake/outer/string"
let localVariableURLString = openAPIClient.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper)

let localVariableUrlComponents = URLComponents(string: localVariableURLString)

Expand Down Expand Up @@ -217,7 +217,7 @@ open class FakeAPI {
open class func testBodyWithFileSchemaWithRequestBuilder(body: FileSchemaTestClass, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder<Void> {
let localVariablePath = "/fake/body-with-file-schema"
let localVariableURLString = openAPIClient.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper)

let localVariableUrlComponents = URLComponents(string: localVariableURLString)

Expand Down Expand Up @@ -262,7 +262,7 @@ open class FakeAPI {
open class func testBodyWithQueryParamsWithRequestBuilder(query: String, body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder<Void> {
let localVariablePath = "/fake/body-with-query-params"
let localVariableURLString = openAPIClient.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper)

var localVariableUrlComponents = URLComponents(string: localVariableURLString)
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
Expand Down Expand Up @@ -311,7 +311,7 @@ open class FakeAPI {
open class func testClientModelWithRequestBuilder(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder<Client> {
let localVariablePath = "/fake"
let localVariableURLString = openAPIClient.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper)

let localVariableUrlComponents = URLComponents(string: localVariableURLString)

Expand Down Expand Up @@ -653,7 +653,7 @@ open class FakeAPI {
open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String: String], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder<Void> {
let localVariablePath = "/fake/inline-additionalProperties"
let localVariableURLString = openAPIClient.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param)
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param, codableHelper: openAPIClient.codableHelper)

let localVariableUrlComponents = URLComponents(string: localVariableURLString)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ open class FakeClassnameTags123API {
open class func testClassnameWithRequestBuilder(body: Client, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder<Client> {
let localVariablePath = "/fake_classname_test"
let localVariableURLString = openAPIClient.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper)

let localVariableUrlComponents = URLComponents(string: localVariableURLString)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ open class PetAPI {
open class func addPetWithRequestBuilder(body: Pet, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder<Void> {
let localVariablePath = "/pet"
let localVariableURLString = openAPIClient.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper)

let localVariableUrlComponents = URLComponents(string: localVariableURLString)

Expand Down Expand Up @@ -316,7 +316,7 @@ open class PetAPI {
open class func updatePetWithRequestBuilder(body: Pet, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder<Void> {
let localVariablePath = "/pet"
let localVariableURLString = openAPIClient.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper)

let localVariableUrlComponents = URLComponents(string: localVariableURLString)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ open class StoreAPI {
open class func placeOrderWithRequestBuilder(body: Order, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder<Order> {
let localVariablePath = "/store/order"
let localVariableURLString = openAPIClient.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper)

let localVariableUrlComponents = URLComponents(string: localVariableURLString)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ open class UserAPI {
open class func createUserWithRequestBuilder(body: User, openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder<Void> {
let localVariablePath = "/user"
let localVariableURLString = openAPIClient.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper)

let localVariableUrlComponents = URLComponents(string: localVariableURLString)

Expand Down Expand Up @@ -88,7 +88,7 @@ open class UserAPI {
open class func createUsersWithArrayInputWithRequestBuilder(body: [User], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder<Void> {
let localVariablePath = "/user/createWithArray"
let localVariableURLString = openAPIClient.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper)

let localVariableUrlComponents = URLComponents(string: localVariableURLString)

Expand Down Expand Up @@ -133,7 +133,7 @@ open class UserAPI {
open class func createUsersWithListInputWithRequestBuilder(body: [User], openAPIClient: OpenAPIClient = OpenAPIClient.shared) -> RequestBuilder<Void> {
let localVariablePath = "/user/createWithList"
let localVariableURLString = openAPIClient.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper)

let localVariableUrlComponents = URLComponents(string: localVariableURLString)

Expand Down Expand Up @@ -376,7 +376,7 @@ open class UserAPI {
let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil)
let localVariableURLString = openAPIClient.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper)

let localVariableUrlComponents = URLComponents(string: localVariableURLString)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ open class JSONEncodingHelper {
return params
}

open class func encodingParameters(forEncodableObject encodableObj: Any?) -> [String: Any]? {
open class func encodingParameters(forEncodableObject encodableObj: Any?, codableHelper: CodableHelper) -> [String: Any]? {
var params: [String: Any]?

if let encodableObj = encodableObj {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import AnyCodable

open class AnotherFakeAPI {
public let openAPIClient: OpenAPIClient
public init(openAPIClient: OpenAPIClient) {
public init(openAPIClient: OpenAPIClient = OpenAPIClient.shared) {
self.openAPIClient = openAPIClient
}

Expand Down Expand Up @@ -135,7 +135,7 @@ open class AnotherFakeAPI {
open func call123testSpecialTagsWithRequestBuilder(body: Client) -> RequestBuilder<Client> {
let localVariablePath = "/another-fake/dummy"
let localVariableURLString = openAPIClient.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper)

let localVariableUrlComponents = URLComponents(string: localVariableURLString)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import AnyCodable

open class FakeAPI {
public let openAPIClient: OpenAPIClient
public init(openAPIClient: OpenAPIClient) {
public init(openAPIClient: OpenAPIClient = OpenAPIClient.shared) {
self.openAPIClient = openAPIClient
}

Expand Down Expand Up @@ -129,7 +129,7 @@ open class FakeAPI {
open func fakeOuterBooleanSerializeWithRequestBuilder(body: Bool? = nil) -> RequestBuilder<Bool> {
let localVariablePath = "/fake/outer/boolean"
let localVariableURLString = openAPIClient.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper)

let localVariableUrlComponents = URLComponents(string: localVariableURLString)

Expand Down Expand Up @@ -252,7 +252,7 @@ open class FakeAPI {
open func fakeOuterCompositeSerializeWithRequestBuilder(body: OuterComposite? = nil) -> RequestBuilder<OuterComposite> {
let localVariablePath = "/fake/outer/composite"
let localVariableURLString = openAPIClient.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper)

let localVariableUrlComponents = URLComponents(string: localVariableURLString)

Expand Down Expand Up @@ -375,7 +375,7 @@ open class FakeAPI {
open func fakeOuterNumberSerializeWithRequestBuilder(body: Double? = nil) -> RequestBuilder<Double> {
let localVariablePath = "/fake/outer/number"
let localVariableURLString = openAPIClient.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper)

let localVariableUrlComponents = URLComponents(string: localVariableURLString)

Expand Down Expand Up @@ -498,7 +498,7 @@ open class FakeAPI {
open func fakeOuterStringSerializeWithRequestBuilder(body: String? = nil) -> RequestBuilder<String> {
let localVariablePath = "/fake/outer/string"
let localVariableURLString = openAPIClient.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper)

let localVariableUrlComponents = URLComponents(string: localVariableURLString)

Expand Down Expand Up @@ -621,7 +621,7 @@ open class FakeAPI {
open func testBodyWithFileSchemaWithRequestBuilder(body: FileSchemaTestClass) -> RequestBuilder<Void> {
let localVariablePath = "/fake/body-with-file-schema"
let localVariableURLString = openAPIClient.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper)

let localVariableUrlComponents = URLComponents(string: localVariableURLString)

Expand Down Expand Up @@ -749,7 +749,7 @@ open class FakeAPI {
open func testBodyWithQueryParamsWithRequestBuilder(query: String, body: User) -> RequestBuilder<Void> {
let localVariablePath = "/fake/body-with-query-params"
let localVariableURLString = openAPIClient.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper)

var localVariableUrlComponents = URLComponents(string: localVariableURLString)
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
Expand Down Expand Up @@ -881,7 +881,7 @@ open class FakeAPI {
open func testClientModelWithRequestBuilder(body: Client) -> RequestBuilder<Client> {
let localVariablePath = "/fake"
let localVariableURLString = openAPIClient.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body, codableHelper: openAPIClient.codableHelper)

let localVariableUrlComponents = URLComponents(string: localVariableURLString)

Expand Down Expand Up @@ -1655,7 +1655,7 @@ open class FakeAPI {
open func testInlineAdditionalPropertiesWithRequestBuilder(param: [String: String]) -> RequestBuilder<Void> {
let localVariablePath = "/fake/inline-additionalProperties"
let localVariableURLString = openAPIClient.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param)
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param, codableHelper: openAPIClient.codableHelper)

let localVariableUrlComponents = URLComponents(string: localVariableURLString)

Expand Down
Loading

0 comments on commit eeb9149

Please sign in to comment.