diff --git a/bin/configs/swift6-vapor.yaml b/bin/configs/swift6-vapor.yaml index 948e4c7429fd..ffba9e9cf466 100644 --- a/bin/configs/swift6-vapor.yaml +++ b/bin/configs/swift6-vapor.yaml @@ -7,6 +7,6 @@ generateAliasAsModel: true additionalProperties: projectName: PetstoreClient useSPMFileStructure: true - useClasses: true + useClasses: false useBacktickEscapes: true mapFileBinaryToData: true diff --git a/bitrise.yml b/bitrise.yml index 54ce23c6c534..b1ac197b4c76 100644 --- a/bitrise.yml +++ b/bitrise.yml @@ -27,15 +27,6 @@ workflows: set -e ./samples/client/petstore/swift6/swift6_test_all.sh - - script@1.2.0: - title: Run Swift5 tests - inputs: - - content: | - #!/usr/bin/env bash - - set -e - - ./samples/client/petstore/swift5/swift5_test_all.sh - script@1.2.0: title: Run swift-combine tests inputs: diff --git a/modules/openapi-generator/src/main/resources/swift6/APIs.mustache b/modules/openapi-generator/src/main/resources/swift6/APIs.mustache index e4ad3216b9ee..78b13a080998 100644 --- a/modules/openapi-generator/src/main/resources/swift6/APIs.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/APIs.mustache @@ -19,8 +19,8 @@ import Alamofire{{/useAlamofire}} {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var basePath: String{{#useVapor}} {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var customHeaders: HTTPHeaders {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var apiClient: Vapor.Client? - {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var apiWrapper: (inout Vapor.ClientRequest) throws -> () - {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var contentConfiguration{{/useVapor}}{{^useVapor}} + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var apiWrapper: @Sendable (inout Vapor.ClientRequest) throws -> () + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var contentConfiguration: ContentConfiguration{{/useVapor}}{{^useVapor}} {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var customHeaders: [String: String] {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var credential: URLCredential? {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var requestBuilderFactory: RequestBuilderFactory @@ -49,8 +49,8 @@ import Alamofire{{/useAlamofire}} basePath: String = "{{{basePath}}}",{{#useVapor}} customHeaders: HTTPHeaders = [:], apiClient: Vapor.Client? = nil, - apiWrapper: (inout Vapor.ClientRequest) throws -> () = { _ in }, - contentConfiguration = ContentConfiguration.default(){{/useVapor}}{{^useVapor}} + apiWrapper: @escaping @Sendable (inout Vapor.ClientRequest) throws -> () = { _ in }, + contentConfiguration: ContentConfiguration = ContentConfiguration.default(){{/useVapor}}{{^useVapor}} customHeaders: [String: String] = [:], credential: URLCredential? = nil, requestBuilderFactory: RequestBuilderFactory = {{#useAlamofire}}AlamofireRequestBuilderFactory(){{/useAlamofire}}{{#useURLSession}}URLSessionRequestBuilderFactory(){{/useURLSession}}, @@ -63,10 +63,10 @@ import Alamofire{{/useAlamofire}} stringResponseSerializer: AnyResponseSerializer = AnyResponseSerializer(StringResponseSerializer()){{/useAlamofire}}{{/useVapor}} ) { self.basePath = basePath{{#useVapor}} - customHeaders = customHeaders - apiClient = apiClient - apiWrapper = apiWrapper - contentConfiguration = contentConfiguration{{/useVapor}}{{^useVapor}} + self.customHeaders = customHeaders + self.apiClient = apiClient + self.apiWrapper = apiWrapper + self.contentConfiguration = contentConfiguration{{/useVapor}}{{^useVapor}} self.customHeaders = customHeaders self.credential = credential self.requestBuilderFactory = requestBuilderFactory diff --git a/modules/openapi-generator/src/main/resources/swift6/Extensions.mustache b/modules/openapi-generator/src/main/resources/swift6/Extensions.mustache index b009950d7123..0a3670cca2c2 100644 --- a/modules/openapi-generator/src/main/resources/swift6/Extensions.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/Extensions.mustache @@ -236,13 +236,11 @@ extension RequestBuilder { } }{{/usePromiseKit}}{{#useVapor}} -extension UUID: Content { } +extension UUID: @retroactive Content { } -extension URL: Content { } +extension URL: @retroactive Content { } -extension Bool: Content { } - -extension Set: ResponseEncodable where Element: Content { +extension Set: @retroactive ResponseEncodable where Element: Content { public func encodeResponse(for request: Vapor.Request) -> EventLoopFuture { let response = Vapor.Response() do { @@ -254,7 +252,15 @@ extension Set: ResponseEncodable where Element: Content { } } -extension Set: RequestDecodable where Element: Content { +extension Set: @retroactive AsyncResponseEncodable where Element: Content { + public func encodeResponse(for request: Vapor.Request) async throws -> Vapor.Response { + let response = Vapor.Response() + try response.content.encode(Array(self)) + return response + } +} + +extension Set: @retroactive RequestDecodable where Element: Content { public static func decodeRequest(_ request: Vapor.Request) -> EventLoopFuture { do { let content = try request.content.decode([Element].self) @@ -265,6 +271,13 @@ extension Set: RequestDecodable where Element: Content { } } -extension Set: Content where Element: Content { } +extension Set: @retroactive AsyncRequestDecodable where Element: Content { + public static func decodeRequest(_ request: Vapor.Request) async throws -> Self { + let content = try request.content.decode([Element].self) + return Set(content) + } +} + +extension Set: @retroactive Content where Element: Content { } extension JSONValue: Content {}{{/useVapor}} diff --git a/modules/openapi-generator/src/main/resources/swift6/Package.swift.mustache b/modules/openapi-generator/src/main/resources/swift6/Package.swift.mustache index f91c9dfaa274..ff8219f3a85e 100644 --- a/modules/openapi-generator/src/main/resources/swift6/Package.swift.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/Package.swift.mustache @@ -34,7 +34,7 @@ let package = Package( .package(url: "https://github.com/ReactiveX/RxSwift", .upToNextMajor(from: "6.8.0")), {{/useRxSwift}} {{#useVapor}} - .package(url: "https://github.com/vapor/vapor", from: "4.0.0") + .package(url: "https://github.com/vapor/vapor", from: "4.99.0"), {{/useVapor}} ], targets: [ @@ -42,7 +42,7 @@ let package = Package( // Targets can depend on other targets in this package, and on products in packages which this package depends on. .target( name: "{{projectName}}", - dependencies: [{{#useVapor}}"Vapor", {{/useVapor}}{{#useAlamofire}}"Alamofire", {{/useAlamofire}}{{#usePromiseKit}}"PromiseKit", {{/usePromiseKit}}{{#useRxSwift}}"RxSwift"{{/useRxSwift}}], + dependencies: [{{#useVapor}}.product(name: "Vapor", package: "vapor"){{/useVapor}}{{#useAlamofire}}"Alamofire", {{/useAlamofire}}{{#usePromiseKit}}"PromiseKit", {{/usePromiseKit}}{{#useRxSwift}}"RxSwift"{{/useRxSwift}}], path: "{{swiftPackagePath}}{{^swiftPackagePath}}{{#useSPMFileStructure}}Sources/{{projectName}}{{/useSPMFileStructure}}{{^useSPMFileStructure}}{{projectName}}/Classes{{/useSPMFileStructure}}{{/swiftPackagePath}}" ), ], diff --git a/modules/openapi-generator/src/main/resources/swift6/api.mustache b/modules/openapi-generator/src/main/resources/swift6/api.mustache index 3e1dd78c65c1..23da716370bd 100644 --- a/modules/openapi-generator/src/main/resources/swift6/api.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/api.mustache @@ -355,19 +355,19 @@ extension {{projectName}}API { {{#isDeprecated}} @available(*, deprecated, message: "This operation is deprecated.") {{/isDeprecated}} - {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} {{#apiStaticMethod}}class {{/apiStaticMethod}}func {{operationId}}Raw({{#allParams}}{{paramName}}: {{#isEnum}}{{#isArray}}[{{enumName}}_{{operationId}}]{{/isArray}}{{^isArray}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isArray}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}headers: HTTPHeaders = {{projectName}}APIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} {{#apiStaticMethod}}class {{/apiStaticMethod}}func {{operationId}}Raw({{#allParams}}{{paramName}}: {{#isEnum}}{{#isArray}}[{{enumName}}_{{operationId}}]{{/isArray}}{{^isArray}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isArray}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}headers: HTTPHeaders? = nil, apiConfiguration: {{projectName}}APIConfiguration = {{projectName}}APIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { {{^pathParams}}let{{/pathParams}}{{#pathParams}}{{#-first}}var{{/-first}}{{/pathParams}} localVariablePath = "{{{path}}}"{{#pathParams}} let {{paramName}}PreEscape = String(describing: {{#isEnum}}{{paramName}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}.rawValue{{/isContainer}}{{/isEnum}}{{^isEnum}}{{paramName}}{{/isEnum}}) let {{paramName}}PostEscape = {{paramName}}PreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" localVariablePath = localVariablePath.replacingOccurrences(of: "{{=<% %>=}}{<%baseName%>}<%={{ }}=%>", with: {{paramName}}PostEscape, options: .literal, range: nil){{/pathParams}} let localVariableURLString = apiConfiguration.basePath + localVariablePath - guard let localVariableApiClient = {{#swiftUseApiNamespace}}{{projectName}}API.{{/swiftUseApiNamespace}}apiConfiguration.apiClient else { + guard let localVariableApiClient = apiConfiguration.apiClient else { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.{{httpMethod}}, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try {{#swiftUseApiNamespace}}{{projectName}}API.{{/swiftUseApiNamespace}}Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.{{httpMethod}}, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) {{#hasHeaderParams}}{{#headerParams}} localVariableRequest.headers.add(name: "{{baseName}}", value: {{#isArray}}{{paramName}}{{^required}}?{{/required}}.map { $0{{#isEnum}}.rawValue{{/isEnum}}.description }.description{{/isArray}}{{^isArray}}{{#isEnum}}{{paramName}}{{^required}}?{{/required}}.rawValue.description{{/isEnum}}{{^isEnum}}{{paramName}}{{^required}}?{{/required}}.description{{/isEnum}}{{/isArray}}{{^required}} ?? ""{{/required}}) {{/headerParams}}{{/hasHeaderParams}} @@ -435,8 +435,8 @@ extension {{projectName}}API { {{#isDeprecated}} @available(*, deprecated, message: "This operation is deprecated.") {{/isDeprecated}} - {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} {{#apiStaticMethod}}class {{/apiStaticMethod}}func {{operationId}}({{#allParams}}{{paramName}}: {{#isEnum}}{{#isArray}}[{{enumName}}_{{operationId}}]{{/isArray}}{{^isArray}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isArray}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}headers: HTTPHeaders = {{projectName}}APIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture<{{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}> { - return {{operationId}}Raw({{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> {{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}} in + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} {{#apiStaticMethod}}class {{/apiStaticMethod}}func {{operationId}}({{#allParams}}{{paramName}}: {{#isEnum}}{{#isArray}}[{{enumName}}_{{operationId}}]{{/isArray}}{{^isArray}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isArray}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}headers: HTTPHeaders? = nil, apiConfiguration: {{projectName}}APIConfiguration = {{projectName}}APIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture<{{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}> { + return {{operationId}}Raw({{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> {{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}} in switch response.status.code { {{#responses}} {{#isDefault}}default{{/isDefault}}{{^isDefault}}case {{code}}{{/isDefault}}: diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/SwaggerClientTests/SwaggerClient.xcworkspace/xcshareddata/swiftpm/Package.resolved b/samples/client/petstore/swift6/apiNonStaticMethod/SwaggerClientTests/SwaggerClient.xcworkspace/xcshareddata/swiftpm/Package.resolved index 0bbc2634349d..6fc5b36f26de 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/SwaggerClientTests/SwaggerClient.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/samples/client/petstore/swift6/apiNonStaticMethod/SwaggerClientTests/SwaggerClient.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,13 +1,13 @@ { - "originHash" : "472bd6166910f63c0cf0e9ff6ab969628489a7027357cae71bd565f99926ca6b", + "originHash" : "6e8e02fd42383a709bd1233e242575a29d1c56271477e2781924330451956ee8", "pins" : [ { "identity" : "alamofire", "kind" : "remoteSourceControl", "location" : "https://github.com/Alamofire/Alamofire", "state" : { - "revision" : "f455c2975872ccd2d9c81594c658af65716e9b9a", - "version" : "5.9.1" + "revision" : "7be73f6c2b5cd90e40798b06ebd5da8f9f79cf88", + "version" : "5.11.0" } }, { diff --git a/samples/client/petstore/swift6/swift6_test_all.sh b/samples/client/petstore/swift6/swift6_test_all.sh index 55bde1c8754d..960e0e0e25d9 100755 --- a/samples/client/petstore/swift6/swift6_test_all.sh +++ b/samples/client/petstore/swift6/swift6_test_all.sh @@ -12,20 +12,20 @@ DIRECTORY=`dirname $0` (cd $DIRECTORY/default/ && ./run_spmbuild.sh) (cd $DIRECTORY/objcCompatible/ && ./run_spmbuild.sh) (cd $DIRECTORY/oneOf/ && ./run_spmbuild.sh) -# (cd $DIRECTORY/promisekitLibrary/ && ./run_spmbuild.sh) # Commented to save time in CI, building Swift5 and Swift6 is taking too much time, and making CI fail +(cd $DIRECTORY/promisekitLibrary/ && ./run_spmbuild.sh) (cd $DIRECTORY/resultLibrary/ && ./run_spmbuild.sh) (cd $DIRECTORY/rxswiftLibrary/ && ./run_spmbuild.sh) (cd $DIRECTORY/urlsessionLibrary/ && ./run_spmbuild.sh) (cd $DIRECTORY/validation/ && ./run_spmbuild.sh) -# (cd $DIRECTORY/vaporLibrary/ && ./run_spmbuild.sh) # Commented because it's not working +(cd $DIRECTORY/vaporLibrary/ && ./run_spmbuild.sh) # example project with unit tests (cd $DIRECTORY/alamofireLibrary/SwaggerClientTests/ && ./run_xcodebuild.sh) (cd $DIRECTORY/apiNonStaticMethod/SwaggerClientTests/ && ./run_xcodebuild.sh) (cd $DIRECTORY/asyncAwaitLibrary/SwaggerClientTests/ && ./run_xcodebuild.sh) -# (cd $DIRECTORY/combineLibrary/SwaggerClientTests/ && ./run_xcodebuild.sh) # Commented to save time in CI, building Swift5 and Swift6 is taking too much time, and making CI fail +(cd $DIRECTORY/combineLibrary/SwaggerClientTests/ && ./run_xcodebuild.sh) (cd $DIRECTORY/combineDeferredLibrary/SwaggerClientTests/ && ./run_xcodebuild.sh) (cd $DIRECTORY/default/SwaggerClientTests/ && ./run_xcodebuild.sh) -# (cd $DIRECTORY/promisekitLibrary/SwaggerClientTests/ && ./run_xcodebuild.sh) # Commented to save time in CI, building Swift5 and Swift6 is taking too much time, and making CI fail +(cd $DIRECTORY/promisekitLibrary/SwaggerClientTests/ && ./run_xcodebuild.sh) (cd $DIRECTORY/rxswiftLibrary/SwaggerClientTests/ && ./run_xcodebuild.sh) (cd $DIRECTORY/urlsessionLibrary/SwaggerClientTests/ && ./run_xcodebuild.sh) diff --git a/samples/client/petstore/swift6/vaporLibrary/Package.resolved b/samples/client/petstore/swift6/vaporLibrary/Package.resolved index a0a19fb2fda0..98da6fb9097e 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Package.resolved +++ b/samples/client/petstore/swift6/vaporLibrary/Package.resolved @@ -1,13 +1,13 @@ { - "originHash" : "c3a84c8391f7f0ac2581ab8e0bfc8d7acee7130c448e7780d24366895df25866", + "originHash" : "c50d0dfe7c1a62afbc27f4524644bf3c0d5fabf878c0b98e4d5036ac1163b38d", "pins" : [ { "identity" : "async-http-client", "kind" : "remoteSourceControl", "location" : "https://github.com/swift-server/async-http-client.git", "state" : { - "revision" : "8e4d51908dd49272667126403bf977c5c503f78f", - "version" : "1.5.0" + "revision" : "4b99975677236d13f0754339864e5360142ff5a1", + "version" : "1.30.3" } }, { @@ -15,8 +15,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/vapor/async-kit.git", "state" : { - "revision" : "c1de408100a2f2e4ab2ea06512e8635bc1a59144", - "version" : "1.3.1" + "revision" : "6f3615ccf2ac3c2ae0c8087d527546e9544a43dd", + "version" : "1.21.0" } }, { @@ -24,8 +24,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/vapor/console-kit.git", "state" : { - "revision" : "cfe8bcd58f74ffecb4f536d8237de146b634ecd3", - "version" : "4.2.6" + "revision" : "742f624a998cba2a9e653d9b1e91ad3f3a5dff6b", + "version" : "4.15.2" } }, { @@ -33,8 +33,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/vapor/multipart-kit.git", "state" : { - "revision" : "c9ea04017b7fb3b1f034ad7a77f8e53d3e080be5", - "version" : "4.2.1" + "revision" : "3498e60218e6003894ff95192d756e238c01f44e", + "version" : "4.7.1" } }, { @@ -42,17 +42,62 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/vapor/routing-kit.git", "state" : { - "revision" : "a0801a36a6ad501d5ad6285cbcd4774de6b0a734", - "version" : "4.3.0" + "revision" : "1a10ccea61e4248effd23b6e814999ce7bdf0ee0", + "version" : "4.9.3" + } + }, + { + "identity" : "swift-algorithms", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-algorithms.git", + "state" : { + "revision" : "87e50f483c54e6efd60e885f7f5aa946cee68023", + "version" : "1.2.1" + } + }, + { + "identity" : "swift-asn1", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-asn1.git", + "state" : { + "revision" : "810496cf121e525d660cd0ea89a758740476b85f", + "version" : "1.5.1" + } + }, + { + "identity" : "swift-async-algorithms", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-async-algorithms.git", + "state" : { + "revision" : "6c050d5ef8e1aa6342528460db614e9770d7f804", + "version" : "1.1.1" } }, { - "identity" : "swift-backtrace", + "identity" : "swift-atomics", "kind" : "remoteSourceControl", - "location" : "https://github.com/swift-server/swift-backtrace.git", + "location" : "https://github.com/apple/swift-atomics.git", "state" : { - "revision" : "54a65d6391a1467a896d0d351ff2de6f469ee53c", - "version" : "1.2.3" + "revision" : "b601256eab081c0f92f059e12818ac1d4f178ff7", + "version" : "1.3.0" + } + }, + { + "identity" : "swift-certificates", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-certificates.git", + "state" : { + "revision" : "7d5f6124c91a2d06fb63a811695a3400d15a100e", + "version" : "1.17.1" + } + }, + { + "identity" : "swift-collections", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-collections.git", + "state" : { + "revision" : "7b847a3b7008b2dc2f47ca3110d8c782fb2e5c7e", + "version" : "1.3.0" } }, { @@ -60,8 +105,35 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-crypto.git", "state" : { - "revision" : "3bea268b223651c4ab7b7b9ad62ef9b2d4143eb6", - "version" : "1.1.6" + "revision" : "6f70fa9eab24c1fd982af18c281c4525d05e3095", + "version" : "4.2.0" + } + }, + { + "identity" : "swift-distributed-tracing", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-distributed-tracing.git", + "state" : { + "revision" : "baa932c1336f7894145cbaafcd34ce2dd0b77c97", + "version" : "1.3.1" + } + }, + { + "identity" : "swift-http-structured-headers", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-http-structured-headers.git", + "state" : { + "revision" : "76d7627bd88b47bf5a0f8497dd244885960dde0b", + "version" : "1.6.0" + } + }, + { + "identity" : "swift-http-types", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-http-types.git", + "state" : { + "revision" : "45eb0224913ea070ec4fba17291b9e7ecf4749ca", + "version" : "1.5.1" } }, { @@ -69,8 +141,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-log.git", "state" : { - "revision" : "5d66f7ba25daf4f94100e7022febf3c75e37a6c7", - "version" : "1.4.2" + "revision" : "2778fd4e5a12a8aaa30a3ee8285f4ce54c5f3181", + "version" : "1.9.1" } }, { @@ -78,8 +150,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-metrics.git", "state" : { - "revision" : "e382458581b05839a571c578e90060fff499f101", - "version" : "2.1.1" + "revision" : "0743a9364382629da3bf5677b46a2c4b1ce5d2a6", + "version" : "2.7.1" } }, { @@ -87,8 +159,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-nio.git", "state" : { - "revision" : "d79e33308b0ac83326b0ead0ea6446e604b8162d", - "version" : "2.30.0" + "revision" : "233f61bc2cfbb22d0edeb2594da27a20d2ce514e", + "version" : "2.93.0" } }, { @@ -96,8 +168,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-nio-extras.git", "state" : { - "revision" : "f72c4688f89c28502105509186eadc49a49cb922", - "version" : "1.10.0" + "revision" : "cc599775aa85d04340f09b47e5432564f9889ae7", + "version" : "1.32.0" } }, { @@ -105,8 +177,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-nio-http2.git", "state" : { - "revision" : "13b6a7a83864005334818d7ea2a3053869a96c04", - "version" : "1.18.0" + "revision" : "c2ba4cfbb83f307c66f5a6df6bb43e3c88dfbf80", + "version" : "1.39.0" } }, { @@ -114,8 +186,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-nio-ssl.git", "state" : { - "revision" : "9db7cee4b62c39160a6bd513a47a1ecdcceac18a", - "version" : "2.14.0" + "revision" : "173cc69a058623525a58ae6710e2f5727c663793", + "version" : "2.36.0" } }, { @@ -123,8 +195,44 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-nio-transport-services.git", "state" : { - "revision" : "39587bceccda72780e2a8a8c5e857e42a9df2fa8", - "version" : "1.11.0" + "revision" : "60c3e187154421171721c1a38e800b390680fb5d", + "version" : "1.26.0" + } + }, + { + "identity" : "swift-numerics", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-numerics.git", + "state" : { + "revision" : "0c0290ff6b24942dadb83a929ffaaa1481df04a2", + "version" : "1.1.1" + } + }, + { + "identity" : "swift-service-context", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-service-context.git", + "state" : { + "revision" : "1983448fefc717a2bc2ebde5490fe99873c5b8a6", + "version" : "1.2.1" + } + }, + { + "identity" : "swift-service-lifecycle", + "kind" : "remoteSourceControl", + "location" : "https://github.com/swift-server/swift-service-lifecycle.git", + "state" : { + "revision" : "1de37290c0ab3c5a96028e0f02911b672fd42348", + "version" : "2.9.1" + } + }, + { + "identity" : "swift-system", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-system.git", + "state" : { + "revision" : "7c6ad0fc39d0763e0b699210e4124afd5041c5df", + "version" : "1.6.4" } }, { @@ -132,8 +240,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/vapor/vapor", "state" : { - "revision" : "086d0b80f2c3623ffd6b5e32b964ad00b67c2e90", - "version" : "4.47.1" + "revision" : "6f3db7122ccffb28e11e121c3797a176fcb88796", + "version" : "4.121.1" } }, { @@ -141,8 +249,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/vapor/websocket-kit.git", "state" : { - "revision" : "a2d26b3de8b3be292f3208d1c74024f76ac503da", - "version" : "2.1.3" + "revision" : "8666c92dbbb3c8eefc8008c9c8dcf50bfd302167", + "version" : "2.16.1" } } ], diff --git a/samples/client/petstore/swift6/vaporLibrary/Package.swift b/samples/client/petstore/swift6/vaporLibrary/Package.swift index 5f2d61faba90..830841275040 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Package.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Package.swift @@ -16,14 +16,14 @@ let package = Package( ], dependencies: [ // Dependencies declare other packages that this package depends on. - .package(url: "https://github.com/vapor/vapor", from: "4.0.0") + .package(url: "https://github.com/vapor/vapor", from: "4.99.0"), ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. // Targets can depend on other targets in this package, and on products in packages which this package depends on. .target( name: "PetstoreClient", - dependencies: ["Vapor", ], + dependencies: [.product(name: "Vapor", package: "vapor")], path: "Sources/PetstoreClient" ), ], diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift index 490594e67bbe..1900176b6f1d 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift @@ -18,7 +18,7 @@ open class AnotherFakeAPI { - parameter body: (body) client model - returns: `EventLoopFuture` of `ClientResponse` */ - open class func call123testSpecialTagsRaw(uuidTest: UUID, body: Client, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func call123testSpecialTagsRaw(uuidTest: UUID, body: Client, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/another-fake/dummy" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -26,8 +26,8 @@ open class AnotherFakeAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.PATCH, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.PATCH, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) localVariableRequest.headers.add(name: "uuid_test", value: uuidTest.description) @@ -51,8 +51,8 @@ open class AnotherFakeAPI { - parameter body: (body) client model - returns: `EventLoopFuture` of `Call123testSpecialTags` */ - open class func call123testSpecialTags(uuidTest: UUID, body: Client, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return call123testSpecialTagsRaw(uuidTest: uuidTest, body: body, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> Call123testSpecialTags in + open class func call123testSpecialTags(uuidTest: UUID, body: Client, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return call123testSpecialTagsRaw(uuidTest: uuidTest, body: body, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> Call123testSpecialTags in switch response.status.code { case 200: return .http200(value: try response.content.decode(Client.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: Client.defaultContentType)), raw: response) diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift index 480dc61d468e..649edd9863b4 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift @@ -17,7 +17,7 @@ open class FakeAPI { - parameter xmlItem: (body) XmlItem Body - returns: `EventLoopFuture` of `ClientResponse` */ - open class func createXmlItemRaw(xmlItem: XmlItem, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func createXmlItemRaw(xmlItem: XmlItem, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/fake/create_xml_item" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -25,8 +25,8 @@ open class FakeAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.POST, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.POST, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) try localVariableRequest.content.encode(xmlItem, using: apiConfiguration.contentConfiguration.requireEncoder(for: XmlItem.defaultContentType)) @@ -47,8 +47,8 @@ open class FakeAPI { - parameter xmlItem: (body) XmlItem Body - returns: `EventLoopFuture` of `CreateXmlItem` */ - open class func createXmlItem(xmlItem: XmlItem, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return createXmlItemRaw(xmlItem: xmlItem, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> CreateXmlItem in + open class func createXmlItem(xmlItem: XmlItem, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return createXmlItemRaw(xmlItem: xmlItem, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> CreateXmlItem in switch response.status.code { case 200: return .http200(raw: response) @@ -64,7 +64,7 @@ open class FakeAPI { - parameter body: (body) Input boolean as post body (optional) - returns: `EventLoopFuture` of `ClientResponse` */ - open class func fakeOuterBooleanSerializeRaw(body: Bool? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func fakeOuterBooleanSerializeRaw(body: Bool? = nil, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/fake/outer/boolean" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -72,8 +72,8 @@ open class FakeAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.POST, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.POST, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) if let localVariableBody = body { @@ -95,8 +95,8 @@ open class FakeAPI { - parameter body: (body) Input boolean as post body (optional) - returns: `EventLoopFuture` of `FakeOuterBooleanSerialize` */ - open class func fakeOuterBooleanSerialize(body: Bool? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return fakeOuterBooleanSerializeRaw(body: body, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> FakeOuterBooleanSerialize in + open class func fakeOuterBooleanSerialize(body: Bool? = nil, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return fakeOuterBooleanSerializeRaw(body: body, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> FakeOuterBooleanSerialize in switch response.status.code { case 200: return .http200(value: try response.content.decode(Bool.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: Bool.defaultContentType)), raw: response) @@ -112,7 +112,7 @@ open class FakeAPI { - parameter body: (body) Input composite as post body (optional) - returns: `EventLoopFuture` of `ClientResponse` */ - open class func fakeOuterCompositeSerializeRaw(body: OuterComposite? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func fakeOuterCompositeSerializeRaw(body: OuterComposite? = nil, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/fake/outer/composite" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -120,8 +120,8 @@ open class FakeAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.POST, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.POST, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) if let localVariableBody = body { @@ -143,8 +143,8 @@ open class FakeAPI { - parameter body: (body) Input composite as post body (optional) - returns: `EventLoopFuture` of `FakeOuterCompositeSerialize` */ - open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return fakeOuterCompositeSerializeRaw(body: body, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> FakeOuterCompositeSerialize in + open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return fakeOuterCompositeSerializeRaw(body: body, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> FakeOuterCompositeSerialize in switch response.status.code { case 200: return .http200(value: try response.content.decode(OuterComposite.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: OuterComposite.defaultContentType)), raw: response) @@ -160,7 +160,7 @@ open class FakeAPI { - parameter body: (body) Input number as post body (optional) - returns: `EventLoopFuture` of `ClientResponse` */ - open class func fakeOuterNumberSerializeRaw(body: Double? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func fakeOuterNumberSerializeRaw(body: Double? = nil, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/fake/outer/number" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -168,8 +168,8 @@ open class FakeAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.POST, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.POST, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) if let localVariableBody = body { @@ -191,8 +191,8 @@ open class FakeAPI { - parameter body: (body) Input number as post body (optional) - returns: `EventLoopFuture` of `FakeOuterNumberSerialize` */ - open class func fakeOuterNumberSerialize(body: Double? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return fakeOuterNumberSerializeRaw(body: body, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> FakeOuterNumberSerialize in + open class func fakeOuterNumberSerialize(body: Double? = nil, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return fakeOuterNumberSerializeRaw(body: body, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> FakeOuterNumberSerialize in switch response.status.code { case 200: return .http200(value: try response.content.decode(Double.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: Double.defaultContentType)), raw: response) @@ -208,7 +208,7 @@ open class FakeAPI { - parameter body: (body) Input string as post body (optional) - returns: `EventLoopFuture` of `ClientResponse` */ - open class func fakeOuterStringSerializeRaw(body: String? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func fakeOuterStringSerializeRaw(body: String? = nil, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/fake/outer/string" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -216,8 +216,8 @@ open class FakeAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.POST, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.POST, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) if let localVariableBody = body { @@ -239,8 +239,8 @@ open class FakeAPI { - parameter body: (body) Input string as post body (optional) - returns: `EventLoopFuture` of `FakeOuterStringSerialize` */ - open class func fakeOuterStringSerialize(body: String? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return fakeOuterStringSerializeRaw(body: body, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> FakeOuterStringSerialize in + open class func fakeOuterStringSerialize(body: String? = nil, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return fakeOuterStringSerializeRaw(body: body, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> FakeOuterStringSerialize in switch response.status.code { case 200: return .http200(value: try response.content.decode(String.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: String.defaultContentType)), raw: response) @@ -256,7 +256,7 @@ open class FakeAPI { - parameter body: (body) - returns: `EventLoopFuture` of `ClientResponse` */ - open class func testBodyWithFileSchemaRaw(body: FileSchemaTestClass, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func testBodyWithFileSchemaRaw(body: FileSchemaTestClass, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/fake/body-with-file-schema" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -264,8 +264,8 @@ open class FakeAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.PUT, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.PUT, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) try localVariableRequest.content.encode(body, using: apiConfiguration.contentConfiguration.requireEncoder(for: FileSchemaTestClass.defaultContentType)) @@ -285,8 +285,8 @@ open class FakeAPI { - parameter body: (body) - returns: `EventLoopFuture` of `TestBodyWithFileSchema` */ - open class func testBodyWithFileSchema(body: FileSchemaTestClass, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return testBodyWithFileSchemaRaw(body: body, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> TestBodyWithFileSchema in + open class func testBodyWithFileSchema(body: FileSchemaTestClass, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return testBodyWithFileSchemaRaw(body: body, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> TestBodyWithFileSchema in switch response.status.code { case 200: return .http200(raw: response) @@ -302,7 +302,7 @@ open class FakeAPI { - parameter body: (body) - returns: `EventLoopFuture` of `ClientResponse` */ - open class func testBodyWithQueryParamsRaw(query: String, body: User, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func testBodyWithQueryParamsRaw(query: String, body: User, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/fake/body-with-query-params" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -310,8 +310,8 @@ open class FakeAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.PUT, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.PUT, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) struct QueryParams: Content { var query: String @@ -338,8 +338,8 @@ open class FakeAPI { - parameter body: (body) - returns: `EventLoopFuture` of `TestBodyWithQueryParams` */ - open class func testBodyWithQueryParams(query: String, body: User, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return testBodyWithQueryParamsRaw(query: query, body: body, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> TestBodyWithQueryParams in + open class func testBodyWithQueryParams(query: String, body: User, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return testBodyWithQueryParamsRaw(query: query, body: body, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> TestBodyWithQueryParams in switch response.status.code { case 200: return .http200(raw: response) @@ -356,7 +356,7 @@ open class FakeAPI { - parameter body: (body) client model - returns: `EventLoopFuture` of `ClientResponse` */ - open class func testClientModelRaw(body: Client, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func testClientModelRaw(body: Client, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/fake" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -364,8 +364,8 @@ open class FakeAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.PATCH, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.PATCH, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) try localVariableRequest.content.encode(body, using: apiConfiguration.contentConfiguration.requireEncoder(for: Client.defaultContentType)) @@ -386,8 +386,8 @@ open class FakeAPI { - parameter body: (body) client model - returns: `EventLoopFuture` of `TestClientModel` */ - open class func testClientModel(body: Client, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return testClientModelRaw(body: body, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> TestClientModel in + open class func testClientModel(body: Client, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return testClientModelRaw(body: body, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> TestClientModel in switch response.status.code { case 200: return .http200(value: try response.content.decode(Client.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: Client.defaultContentType)), raw: response) @@ -420,7 +420,7 @@ open class FakeAPI { - parameter callback: (form) None (optional) - returns: `EventLoopFuture` of `ClientResponse` */ - open class func testEndpointParametersRaw(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, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func testEndpointParametersRaw(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, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/fake" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -428,8 +428,8 @@ open class FakeAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.POST, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.POST, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) struct FormParams: Content { @@ -483,8 +483,8 @@ open class FakeAPI { - parameter callback: (form) None (optional) - returns: `EventLoopFuture` of `TestEndpointParameters` */ - 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, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return testEndpointParametersRaw(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, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> TestEndpointParameters in + 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, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return testEndpointParametersRaw(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, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> TestEndpointParameters in switch response.status.code { case 400: return .http400(raw: response) @@ -577,7 +577,7 @@ open class FakeAPI { - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .efg) - returns: `EventLoopFuture` of `ClientResponse` */ - open class func testEnumParametersRaw(enumHeaderStringArray: [EnumHeaderStringArray_testEnumParameters]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [EnumQueryStringArray_testEnumParameters]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, enumFormStringArray: [EnumFormStringArray_testEnumParameters]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func testEnumParametersRaw(enumHeaderStringArray: [EnumHeaderStringArray_testEnumParameters]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [EnumQueryStringArray_testEnumParameters]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, enumFormStringArray: [EnumFormStringArray_testEnumParameters]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/fake" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -585,8 +585,8 @@ open class FakeAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.GET, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.GET, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) localVariableRequest.headers.add(name: "enum_header_string_array", value: enumHeaderStringArray?.map { $0.rawValue.description }.description ?? "") @@ -636,8 +636,8 @@ open class FakeAPI { - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .efg) - returns: `EventLoopFuture` of `TestEnumParameters` */ - open class func testEnumParameters(enumHeaderStringArray: [EnumHeaderStringArray_testEnumParameters]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [EnumQueryStringArray_testEnumParameters]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, enumFormStringArray: [EnumFormStringArray_testEnumParameters]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return testEnumParametersRaw(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> TestEnumParameters in + open class func testEnumParameters(enumHeaderStringArray: [EnumHeaderStringArray_testEnumParameters]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [EnumQueryStringArray_testEnumParameters]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, enumFormStringArray: [EnumFormStringArray_testEnumParameters]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return testEnumParametersRaw(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> TestEnumParameters in switch response.status.code { case 400: return .http400(raw: response) @@ -661,7 +661,7 @@ open class FakeAPI { - parameter int64Group: (query) Integer in group parameters (optional) - returns: `EventLoopFuture` of `ClientResponse` */ - open class func testGroupParametersRaw(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func testGroupParametersRaw(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/fake" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -669,8 +669,8 @@ open class FakeAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.DELETE, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.DELETE, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) localVariableRequest.headers.add(name: "required_boolean_group", value: requiredBooleanGroup.description) @@ -712,8 +712,8 @@ open class FakeAPI { - parameter int64Group: (query) Integer in group parameters (optional) - returns: `EventLoopFuture` of `TestGroupParameters` */ - open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return testGroupParametersRaw(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> TestGroupParameters in + open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return testGroupParametersRaw(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> TestGroupParameters in switch response.status.code { case 400: return .http400(raw: response) @@ -729,7 +729,7 @@ open class FakeAPI { - parameter param: (body) request body - returns: `EventLoopFuture` of `ClientResponse` */ - open class func testInlineAdditionalPropertiesRaw(param: [String: String], headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func testInlineAdditionalPropertiesRaw(param: [String: String], headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/fake/inline-additionalProperties" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -737,8 +737,8 @@ open class FakeAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.POST, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.POST, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) try localVariableRequest.content.encode(param, using: apiConfiguration.contentConfiguration.requireEncoder(for: [String: String].defaultContentType)) @@ -758,8 +758,8 @@ open class FakeAPI { - parameter param: (body) request body - returns: `EventLoopFuture` of `TestInlineAdditionalProperties` */ - open class func testInlineAdditionalProperties(param: [String: String], headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return testInlineAdditionalPropertiesRaw(param: param, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> TestInlineAdditionalProperties in + open class func testInlineAdditionalProperties(param: [String: String], headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return testInlineAdditionalPropertiesRaw(param: param, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> TestInlineAdditionalProperties in switch response.status.code { case 200: return .http200(raw: response) @@ -776,7 +776,7 @@ open class FakeAPI { - parameter param2: (form) field2 - returns: `EventLoopFuture` of `ClientResponse` */ - open class func testJsonFormDataRaw(param: String, param2: String, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func testJsonFormDataRaw(param: String, param2: String, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/fake/jsonFormData" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -784,8 +784,8 @@ open class FakeAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.GET, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.GET, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) struct FormParams: Content { @@ -810,8 +810,8 @@ open class FakeAPI { - parameter param2: (form) field2 - returns: `EventLoopFuture` of `TestJsonFormData` */ - open class func testJsonFormData(param: String, param2: String, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return testJsonFormDataRaw(param: param, param2: param2, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> TestJsonFormData in + open class func testJsonFormData(param: String, param2: String, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return testJsonFormDataRaw(param: param, param2: param2, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> TestJsonFormData in switch response.status.code { case 200: return .http200(raw: response) @@ -831,7 +831,7 @@ open class FakeAPI { - parameter context: (query) - returns: `EventLoopFuture` of `ClientResponse` */ - open class func testQueryParameterCollectionFormatRaw(pipe: [String], ioutil: [String], http: [String], url: [String], context: [String], headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func testQueryParameterCollectionFormatRaw(pipe: [String], ioutil: [String], http: [String], url: [String], context: [String], headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/fake/test-query-parameters" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -839,8 +839,8 @@ open class FakeAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.PUT, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.PUT, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) struct QueryParams: Content { var pipe: [String] @@ -878,8 +878,8 @@ open class FakeAPI { - parameter context: (query) - returns: `EventLoopFuture` of `TestQueryParameterCollectionFormat` */ - open class func testQueryParameterCollectionFormat(pipe: [String], ioutil: [String], http: [String], url: [String], context: [String], headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return testQueryParameterCollectionFormatRaw(pipe: pipe, ioutil: ioutil, http: http, url: url, context: context, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> TestQueryParameterCollectionFormat in + open class func testQueryParameterCollectionFormat(pipe: [String], ioutil: [String], http: [String], url: [String], context: [String], headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return testQueryParameterCollectionFormatRaw(pipe: pipe, ioutil: ioutil, http: http, url: url, context: context, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> TestQueryParameterCollectionFormat in switch response.status.code { case 200: return .http200(raw: response) diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/FakeClassnameTags123API.swift index 793f6a370ed2..352c9326d0ee 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/FakeClassnameTags123API.swift @@ -20,7 +20,7 @@ open class FakeClassnameTags123API { - parameter body: (body) client model - returns: `EventLoopFuture` of `ClientResponse` */ - open class func testClassnameRaw(body: Client, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func testClassnameRaw(body: Client, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/fake_classname_test" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -28,8 +28,8 @@ open class FakeClassnameTags123API { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.PATCH, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.PATCH, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) try localVariableRequest.content.encode(body, using: apiConfiguration.contentConfiguration.requireEncoder(for: Client.defaultContentType)) @@ -53,8 +53,8 @@ open class FakeClassnameTags123API { - parameter body: (body) client model - returns: `EventLoopFuture` of `TestClassname` */ - open class func testClassname(body: Client, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return testClassnameRaw(body: body, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> TestClassname in + open class func testClassname(body: Client, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return testClassnameRaw(body: body, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> TestClassname in switch response.status.code { case 200: return .http200(value: try response.content.decode(Client.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: Client.defaultContentType)), raw: response) diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/PetAPI.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/PetAPI.swift index e3e6be3bf6d9..70e8d3407a36 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/PetAPI.swift @@ -19,7 +19,7 @@ open class PetAPI { - parameter body: (body) Pet object that needs to be added to the store - returns: `EventLoopFuture` of `ClientResponse` */ - open class func addPetRaw(body: Pet, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func addPetRaw(body: Pet, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/pet" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -27,8 +27,8 @@ open class PetAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.POST, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.POST, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) try localVariableRequest.content.encode(body, using: apiConfiguration.contentConfiguration.requireEncoder(for: Pet.defaultContentType)) @@ -52,8 +52,8 @@ open class PetAPI { - parameter body: (body) Pet object that needs to be added to the store - returns: `EventLoopFuture` of `AddPet` */ - open class func addPet(body: Pet, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return addPetRaw(body: body, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> AddPet in + open class func addPet(body: Pet, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return addPetRaw(body: body, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> AddPet in switch response.status.code { case 200: return .http200(raw: response) @@ -75,7 +75,7 @@ open class PetAPI { - parameter apiKey: (header) (optional) - returns: `EventLoopFuture` of `ClientResponse` */ - open class func deletePetRaw(petId: Int64, apiKey: String? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func deletePetRaw(petId: Int64, apiKey: String? = nil, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { var localVariablePath = "/pet/{petId}" let petIdPreEscape = String(describing: petId) let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" @@ -86,8 +86,8 @@ open class PetAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.DELETE, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.DELETE, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) localVariableRequest.headers.add(name: "api_key", value: apiKey?.description ?? "") @@ -113,8 +113,8 @@ open class PetAPI { - parameter apiKey: (header) (optional) - returns: `EventLoopFuture` of `DeletePet` */ - open class func deletePet(petId: Int64, apiKey: String? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return deletePetRaw(petId: petId, apiKey: apiKey, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> DeletePet in + open class func deletePet(petId: Int64, apiKey: String? = nil, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return deletePetRaw(petId: petId, apiKey: apiKey, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> DeletePet in switch response.status.code { case 200: return .http200(raw: response) @@ -145,7 +145,7 @@ open class PetAPI { - parameter status: (query) Status values that need to be considered for filter - returns: `EventLoopFuture` of `ClientResponse` */ - open class func findPetsByStatusRaw(status: [Status_findPetsByStatus], headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func findPetsByStatusRaw(status: [Status_findPetsByStatus], headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/pet/findByStatus" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -153,8 +153,8 @@ open class PetAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.GET, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.GET, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) struct QueryParams: Content { var status: [Status_findPetsByStatus] @@ -185,8 +185,8 @@ open class PetAPI { - parameter status: (query) Status values that need to be considered for filter - returns: `EventLoopFuture` of `FindPetsByStatus` */ - open class func findPetsByStatus(status: [Status_findPetsByStatus], headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return findPetsByStatusRaw(status: status, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> FindPetsByStatus in + open class func findPetsByStatus(status: [Status_findPetsByStatus], headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return findPetsByStatusRaw(status: status, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> FindPetsByStatus in switch response.status.code { case 200: return .http200(value: try response.content.decode([Pet].self, using: apiConfiguration.contentConfiguration.requireDecoder(for: [Pet].defaultContentType)), raw: response) @@ -209,7 +209,7 @@ open class PetAPI { - returns: `EventLoopFuture` of `ClientResponse` */ @available(*, deprecated, message: "This operation is deprecated.") - open class func findPetsByTagsRaw(tags: Set, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func findPetsByTagsRaw(tags: Set, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/pet/findByTags" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -217,8 +217,8 @@ open class PetAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.GET, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.GET, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) struct QueryParams: Content { var tags: Set @@ -250,8 +250,8 @@ open class PetAPI { - returns: `EventLoopFuture` of `FindPetsByTags` */ @available(*, deprecated, message: "This operation is deprecated.") - open class func findPetsByTags(tags: Set, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return findPetsByTagsRaw(tags: tags, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> FindPetsByTags in + open class func findPetsByTags(tags: Set, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return findPetsByTagsRaw(tags: tags, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> FindPetsByTags in switch response.status.code { case 200: return .http200(value: try response.content.decode(Set.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: Set.defaultContentType)), raw: response) @@ -273,7 +273,7 @@ open class PetAPI { - parameter petId: (path) ID of pet to return - returns: `EventLoopFuture` of `ClientResponse` */ - open class func getPetByIdRaw(petId: Int64, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func getPetByIdRaw(petId: Int64, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { var localVariablePath = "/pet/{petId}" let petIdPreEscape = String(describing: petId) let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" @@ -284,8 +284,8 @@ open class PetAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.GET, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.GET, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) @@ -310,8 +310,8 @@ open class PetAPI { - parameter petId: (path) ID of pet to return - returns: `EventLoopFuture` of `GetPetById` */ - open class func getPetById(petId: Int64, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return getPetByIdRaw(petId: petId, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> GetPetById in + open class func getPetById(petId: Int64, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return getPetByIdRaw(petId: petId, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> GetPetById in switch response.status.code { case 200: return .http200(value: try response.content.decode(Pet.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: Pet.defaultContentType)), raw: response) @@ -334,7 +334,7 @@ open class PetAPI { - parameter body: (body) Pet object that needs to be added to the store - returns: `EventLoopFuture` of `ClientResponse` */ - open class func updatePetRaw(body: Pet, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func updatePetRaw(body: Pet, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/pet" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -342,8 +342,8 @@ open class PetAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.PUT, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.PUT, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) try localVariableRequest.content.encode(body, using: apiConfiguration.contentConfiguration.requireEncoder(for: Pet.defaultContentType)) @@ -369,8 +369,8 @@ open class PetAPI { - parameter body: (body) Pet object that needs to be added to the store - returns: `EventLoopFuture` of `UpdatePet` */ - open class func updatePet(body: Pet, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return updatePetRaw(body: body, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> UpdatePet in + open class func updatePet(body: Pet, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return updatePetRaw(body: body, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> UpdatePet in switch response.status.code { case 200: return .http200(raw: response) @@ -397,7 +397,7 @@ open class PetAPI { - parameter status: (form) Updated status of the pet (optional) - returns: `EventLoopFuture` of `ClientResponse` */ - open class func updatePetWithFormRaw(petId: Int64, name: String? = nil, status: String? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func updatePetWithFormRaw(petId: Int64, name: String? = nil, status: String? = nil, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { var localVariablePath = "/pet/{petId}" let petIdPreEscape = String(describing: petId) let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" @@ -408,8 +408,8 @@ open class PetAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.POST, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.POST, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) struct FormParams: Content { @@ -438,8 +438,8 @@ open class PetAPI { - parameter status: (form) Updated status of the pet (optional) - returns: `EventLoopFuture` of `UpdatePetWithForm` */ - open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return updatePetWithFormRaw(petId: petId, name: name, status: status, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> UpdatePetWithForm in + open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return updatePetWithFormRaw(petId: petId, name: name, status: status, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> UpdatePetWithForm in switch response.status.code { case 405: return .http405(raw: response) @@ -460,7 +460,7 @@ open class PetAPI { - parameter file: (form) file to upload (optional) - returns: `EventLoopFuture` of `ClientResponse` */ - open class func uploadFileRaw(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func uploadFileRaw(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { var localVariablePath = "/pet/{petId}/uploadImage" let petIdPreEscape = String(describing: petId) let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" @@ -471,8 +471,8 @@ open class PetAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.POST, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.POST, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) struct FormParams: Content { @@ -501,8 +501,8 @@ open class PetAPI { - parameter file: (form) file to upload (optional) - returns: `EventLoopFuture` of `UploadFile` */ - open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return uploadFileRaw(petId: petId, additionalMetadata: additionalMetadata, file: file, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> UploadFile in + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return uploadFileRaw(petId: petId, additionalMetadata: additionalMetadata, file: file, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> UploadFile in switch response.status.code { case 200: return .http200(value: try response.content.decode(ApiResponse.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: ApiResponse.defaultContentType)), raw: response) @@ -523,7 +523,7 @@ open class PetAPI { - parameter additionalMetadata: (form) Additional data to pass to server (optional) - returns: `EventLoopFuture` of `ClientResponse` */ - open class func uploadFileWithRequiredFileRaw(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func uploadFileWithRequiredFileRaw(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { var localVariablePath = "/fake/{petId}/uploadImageWithRequiredFile" let petIdPreEscape = String(describing: petId) let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" @@ -534,8 +534,8 @@ open class PetAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.POST, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.POST, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) struct FormParams: Content { @@ -564,8 +564,8 @@ open class PetAPI { - parameter additionalMetadata: (form) Additional data to pass to server (optional) - returns: `EventLoopFuture` of `UploadFileWithRequiredFile` */ - open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return uploadFileWithRequiredFileRaw(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> UploadFileWithRequiredFile in + open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return uploadFileWithRequiredFileRaw(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> UploadFileWithRequiredFile in switch response.status.code { case 200: return .http200(value: try response.content.decode(ApiResponse.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: ApiResponse.defaultContentType)), raw: response) diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/StoreAPI.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/StoreAPI.swift index 3b66f4fe05c1..8e6b7a55d3ae 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/StoreAPI.swift @@ -17,7 +17,7 @@ open class StoreAPI { - parameter orderId: (path) ID of the order that needs to be deleted - returns: `EventLoopFuture` of `ClientResponse` */ - open class func deleteOrderRaw(orderId: String, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func deleteOrderRaw(orderId: String, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { var localVariablePath = "/store/order/{order_id}" let orderIdPreEscape = String(describing: orderId) let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" @@ -28,8 +28,8 @@ open class StoreAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.DELETE, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.DELETE, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) @@ -50,8 +50,8 @@ open class StoreAPI { - parameter orderId: (path) ID of the order that needs to be deleted - returns: `EventLoopFuture` of `DeleteOrder` */ - open class func deleteOrder(orderId: String, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return deleteOrderRaw(orderId: orderId, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> DeleteOrder in + open class func deleteOrder(orderId: String, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return deleteOrderRaw(orderId: orderId, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> DeleteOrder in switch response.status.code { case 400: return .http400(raw: response) @@ -72,7 +72,7 @@ open class StoreAPI { - name: api_key - returns: `EventLoopFuture` of `ClientResponse` */ - open class func getInventoryRaw(headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func getInventoryRaw(headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/store/inventory" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -80,8 +80,8 @@ open class StoreAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.GET, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.GET, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) @@ -103,8 +103,8 @@ open class StoreAPI { - name: api_key - returns: `EventLoopFuture` of `GetInventory` */ - open class func getInventory(headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return getInventoryRaw(headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> GetInventory in + open class func getInventory(headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return getInventoryRaw(headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> GetInventory in switch response.status.code { case 200: return .http200(value: try response.content.decode([String: Int].self, using: apiConfiguration.contentConfiguration.requireDecoder(for: [String: Int].defaultContentType)), raw: response) @@ -121,7 +121,7 @@ open class StoreAPI { - parameter orderId: (path) ID of pet that needs to be fetched - returns: `EventLoopFuture` of `ClientResponse` */ - open class func getOrderByIdRaw(orderId: Int64, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func getOrderByIdRaw(orderId: Int64, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { var localVariablePath = "/store/order/{order_id}" let orderIdPreEscape = String(describing: orderId) let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" @@ -132,8 +132,8 @@ open class StoreAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.GET, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.GET, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) @@ -155,8 +155,8 @@ open class StoreAPI { - parameter orderId: (path) ID of pet that needs to be fetched - returns: `EventLoopFuture` of `GetOrderById` */ - open class func getOrderById(orderId: Int64, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return getOrderByIdRaw(orderId: orderId, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> GetOrderById in + open class func getOrderById(orderId: Int64, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return getOrderByIdRaw(orderId: orderId, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> GetOrderById in switch response.status.code { case 200: return .http200(value: try response.content.decode(Order.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: Order.defaultContentType)), raw: response) @@ -176,7 +176,7 @@ open class StoreAPI { - parameter body: (body) order placed for purchasing the pet - returns: `EventLoopFuture` of `ClientResponse` */ - open class func placeOrderRaw(body: Order, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func placeOrderRaw(body: Order, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/store/order" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -184,8 +184,8 @@ open class StoreAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.POST, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.POST, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) try localVariableRequest.content.encode(body, using: apiConfiguration.contentConfiguration.requireEncoder(for: Order.defaultContentType)) @@ -206,8 +206,8 @@ open class StoreAPI { - parameter body: (body) order placed for purchasing the pet - returns: `EventLoopFuture` of `PlaceOrder` */ - open class func placeOrder(body: Order, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return placeOrderRaw(body: body, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> PlaceOrder in + open class func placeOrder(body: Order, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return placeOrderRaw(body: body, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> PlaceOrder in switch response.status.code { case 200: return .http200(value: try response.content.decode(Order.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: Order.defaultContentType)), raw: response) diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/UserAPI.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/UserAPI.swift index 6038bfc99fcd..4f11c38a091e 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/UserAPI.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/APIs/UserAPI.swift @@ -17,7 +17,7 @@ open class UserAPI { - parameter body: (body) Created user object - returns: `EventLoopFuture` of `ClientResponse` */ - open class func createUserRaw(body: User, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func createUserRaw(body: User, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/user" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -25,8 +25,8 @@ open class UserAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.POST, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.POST, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) try localVariableRequest.content.encode(body, using: apiConfiguration.contentConfiguration.requireEncoder(for: User.defaultContentType)) @@ -46,8 +46,8 @@ open class UserAPI { - parameter body: (body) Created user object - returns: `EventLoopFuture` of `CreateUser` */ - open class func createUser(body: User, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return createUserRaw(body: body, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> CreateUser in + open class func createUser(body: User, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return createUserRaw(body: body, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> CreateUser in switch response.status.code { default: return .http0(raw: response) @@ -61,7 +61,7 @@ open class UserAPI { - parameter body: (body) List of user object - returns: `EventLoopFuture` of `ClientResponse` */ - open class func createUsersWithArrayInputRaw(body: [User], headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func createUsersWithArrayInputRaw(body: [User], headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/user/createWithArray" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -69,8 +69,8 @@ open class UserAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.POST, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.POST, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) try localVariableRequest.content.encode(body, using: apiConfiguration.contentConfiguration.requireEncoder(for: [User].defaultContentType)) @@ -89,8 +89,8 @@ open class UserAPI { - parameter body: (body) List of user object - returns: `EventLoopFuture` of `CreateUsersWithArrayInput` */ - open class func createUsersWithArrayInput(body: [User], headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return createUsersWithArrayInputRaw(body: body, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> CreateUsersWithArrayInput in + open class func createUsersWithArrayInput(body: [User], headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return createUsersWithArrayInputRaw(body: body, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> CreateUsersWithArrayInput in switch response.status.code { default: return .http0(raw: response) @@ -104,7 +104,7 @@ open class UserAPI { - parameter body: (body) List of user object - returns: `EventLoopFuture` of `ClientResponse` */ - open class func createUsersWithListInputRaw(body: [User], headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func createUsersWithListInputRaw(body: [User], headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/user/createWithList" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -112,8 +112,8 @@ open class UserAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.POST, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.POST, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) try localVariableRequest.content.encode(body, using: apiConfiguration.contentConfiguration.requireEncoder(for: [User].defaultContentType)) @@ -132,8 +132,8 @@ open class UserAPI { - parameter body: (body) List of user object - returns: `EventLoopFuture` of `CreateUsersWithListInput` */ - open class func createUsersWithListInput(body: [User], headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return createUsersWithListInputRaw(body: body, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> CreateUsersWithListInput in + open class func createUsersWithListInput(body: [User], headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return createUsersWithListInputRaw(body: body, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> CreateUsersWithListInput in switch response.status.code { default: return .http0(raw: response) @@ -148,7 +148,7 @@ open class UserAPI { - parameter username: (path) The name that needs to be deleted - returns: `EventLoopFuture` of `ClientResponse` */ - open class func deleteUserRaw(username: String, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func deleteUserRaw(username: String, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { var localVariablePath = "/user/{username}" let usernamePreEscape = String(describing: username) let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" @@ -159,8 +159,8 @@ open class UserAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.DELETE, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.DELETE, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) @@ -181,8 +181,8 @@ open class UserAPI { - parameter username: (path) The name that needs to be deleted - returns: `EventLoopFuture` of `DeleteUser` */ - open class func deleteUser(username: String, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return deleteUserRaw(username: username, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> DeleteUser in + open class func deleteUser(username: String, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return deleteUserRaw(username: username, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> DeleteUser in switch response.status.code { case 400: return .http400(raw: response) @@ -200,7 +200,7 @@ open class UserAPI { - parameter username: (path) The name that needs to be fetched. Use user1 for testing. - returns: `EventLoopFuture` of `ClientResponse` */ - open class func getUserByNameRaw(username: String, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func getUserByNameRaw(username: String, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { var localVariablePath = "/user/{username}" let usernamePreEscape = String(describing: username) let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" @@ -211,8 +211,8 @@ open class UserAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.GET, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.GET, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) @@ -233,8 +233,8 @@ open class UserAPI { - parameter username: (path) The name that needs to be fetched. Use user1 for testing. - returns: `EventLoopFuture` of `GetUserByName` */ - open class func getUserByName(username: String, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return getUserByNameRaw(username: username, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> GetUserByName in + open class func getUserByName(username: String, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return getUserByNameRaw(username: username, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> GetUserByName in switch response.status.code { case 200: return .http200(value: try response.content.decode(User.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: User.defaultContentType)), raw: response) @@ -256,7 +256,7 @@ open class UserAPI { - parameter password: (query) The password for login in clear text - returns: `EventLoopFuture` of `ClientResponse` */ - open class func loginUserRaw(username: String, password: String, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func loginUserRaw(username: String, password: String, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/user/login" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -264,8 +264,8 @@ open class UserAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.GET, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.GET, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) struct QueryParams: Content { var username: String @@ -296,8 +296,8 @@ open class UserAPI { - parameter password: (query) The password for login in clear text - returns: `EventLoopFuture` of `LoginUser` */ - open class func loginUser(username: String, password: String, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return loginUserRaw(username: username, password: password, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> LoginUser in + open class func loginUser(username: String, password: String, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return loginUserRaw(username: username, password: password, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> LoginUser in switch response.status.code { case 200: return .http200(value: try response.content.decode(String.self, using: apiConfiguration.contentConfiguration.requireDecoder(for: String.defaultContentType)), raw: response) @@ -314,7 +314,7 @@ open class UserAPI { GET /user/logout - returns: `EventLoopFuture` of `ClientResponse` */ - open class func logoutUserRaw(headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func logoutUserRaw(headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { let localVariablePath = "/user/logout" let localVariableURLString = apiConfiguration.basePath + localVariablePath @@ -322,8 +322,8 @@ open class UserAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.GET, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.GET, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) @@ -340,8 +340,8 @@ open class UserAPI { GET /user/logout - returns: `EventLoopFuture` of `LogoutUser` */ - open class func logoutUser(headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return logoutUserRaw(headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> LogoutUser in + open class func logoutUser(headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return logoutUserRaw(headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> LogoutUser in switch response.status.code { default: return .http0(raw: response) @@ -357,7 +357,7 @@ open class UserAPI { - parameter body: (body) Updated user object - returns: `EventLoopFuture` of `ClientResponse` */ - open class func updateUserRaw(username: String, body: User, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + open class func updateUserRaw(username: String, body: User, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { var localVariablePath = "/user/{username}" let usernamePreEscape = String(describing: username) let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" @@ -368,8 +368,8 @@ open class UserAPI { fatalError("apiConfiguration.apiClient is not set.") } - return localVariableApiClient.send(.PUT, headers: headers, to: URI(string: localVariableURLString)) { localVariableRequest in - try Configuration.apiWrapper(&localVariableRequest) + return localVariableApiClient.send(.PUT, headers: headers ?? apiConfiguration.customHeaders, to: URI(string: localVariableURLString)) { localVariableRequest in + try apiConfiguration.apiWrapper(&localVariableRequest) try localVariableRequest.content.encode(body, using: apiConfiguration.contentConfiguration.requireEncoder(for: User.defaultContentType)) @@ -392,8 +392,8 @@ open class UserAPI { - parameter body: (body) Updated user object - returns: `EventLoopFuture` of `UpdateUser` */ - open class func updateUser(username: String, body: User, headers: HTTPHeaders = PetstoreClientAPIConfiguration.shared.customHeaders, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { - return updateUserRaw(username: username, body: body, headers: headers, beforeSend: beforeSend).flatMapThrowing { response -> UpdateUser in + open class func updateUser(username: String, body: User, headers: HTTPHeaders? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture { + return updateUserRaw(username: username, body: body, headers: headers, apiConfiguration: apiConfiguration, beforeSend: beforeSend).flatMapThrowing { response -> UpdateUser in switch response.status.code { case 400: return .http400(raw: response) diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Infrastructure/APIs.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Infrastructure/APIs.swift index b0d47e8d4738..d6f62668b5d4 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Infrastructure/APIs.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Infrastructure/APIs.swift @@ -14,21 +14,21 @@ open class PetstoreClientAPIConfiguration: @unchecked Sendable { public var basePath: String public var customHeaders: HTTPHeaders public var apiClient: Vapor.Client? - public var apiWrapper: (inout Vapor.ClientRequest) throws -> () - public var contentConfiguration + public var apiWrapper: @Sendable (inout Vapor.ClientRequest) throws -> () + public var contentConfiguration: ContentConfiguration public init( basePath: String = "http://petstore.swagger.io:80/v2", customHeaders: HTTPHeaders = [:], apiClient: Vapor.Client? = nil, - apiWrapper: (inout Vapor.ClientRequest) throws -> () = { _ in }, - contentConfiguration = ContentConfiguration.default() + apiWrapper: @escaping @Sendable (inout Vapor.ClientRequest) throws -> () = { _ in }, + contentConfiguration: ContentConfiguration = ContentConfiguration.default() ) { self.basePath = basePath - customHeaders = customHeaders - apiClient = apiClient - apiWrapper = apiWrapper - contentConfiguration = contentConfiguration + self.customHeaders = customHeaders + self.apiClient = apiClient + self.apiWrapper = apiWrapper + self.contentConfiguration = contentConfiguration } public static let shared = PetstoreClientAPIConfiguration() diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Infrastructure/Extensions.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Infrastructure/Extensions.swift index f8b1d7f1a218..fe7303e5afc6 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Infrastructure/Extensions.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Infrastructure/Extensions.swift @@ -132,13 +132,11 @@ extension KeyedDecodingContainerProtocol { } -extension UUID: Content { } +extension UUID: @retroactive Content { } -extension URL: Content { } +extension URL: @retroactive Content { } -extension Bool: Content { } - -extension Set: ResponseEncodable where Element: Content { +extension Set: @retroactive ResponseEncodable where Element: Content { public func encodeResponse(for request: Vapor.Request) -> EventLoopFuture { let response = Vapor.Response() do { @@ -150,7 +148,15 @@ extension Set: ResponseEncodable where Element: Content { } } -extension Set: RequestDecodable where Element: Content { +extension Set: @retroactive AsyncResponseEncodable where Element: Content { + public func encodeResponse(for request: Vapor.Request) async throws -> Vapor.Response { + let response = Vapor.Response() + try response.content.encode(Array(self)) + return response + } +} + +extension Set: @retroactive RequestDecodable where Element: Content { public static func decodeRequest(_ request: Vapor.Request) -> EventLoopFuture { do { let content = try request.content.decode([Element].self) @@ -161,6 +167,13 @@ extension Set: RequestDecodable where Element: Content { } } -extension Set: Content where Element: Content { } +extension Set: @retroactive AsyncRequestDecodable where Element: Content { + public static func decodeRequest(_ request: Vapor.Request) async throws -> Self { + let content = try request.content.decode([Element].self) + return Set(content) + } +} + +extension Set: @retroactive Content where Element: Content { } extension JSONValue: Content {} diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesAnyType.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesAnyType.swift index 8f33cba8744e..d797849f9a6c 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesAnyType.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesAnyType.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class AdditionalPropertiesAnyType: Content, Hashable { +public struct AdditionalPropertiesAnyType: Sendable, Content, Hashable { public var name: String? @@ -55,15 +55,5 @@ public final class AdditionalPropertiesAnyType: Content, Hashable { let additionalPropertiesContainer = try decoder.container(keyedBy: String.self) additionalProperties = try additionalPropertiesContainer.decodeMap(JSONValue.self, excludedKeys: nonAdditionalPropertyKeys) } - - public static func == (lhs: AdditionalPropertiesAnyType, rhs: AdditionalPropertiesAnyType) -> Bool { - lhs.name == rhs.name - && lhs.additionalProperties == rhs.additionalProperties - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(name?.hashValue) - hasher.combine(additionalProperties.hashValue) - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesArray.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesArray.swift index cf3d2db319f7..b23bc0f9b80b 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesArray.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesArray.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class AdditionalPropertiesArray: Content, Hashable { +public struct AdditionalPropertiesArray: Sendable, Content, Hashable { public var name: String? @@ -55,15 +55,5 @@ public final class AdditionalPropertiesArray: Content, Hashable { let additionalPropertiesContainer = try decoder.container(keyedBy: String.self) additionalProperties = try additionalPropertiesContainer.decodeMap([JSONValue].self, excludedKeys: nonAdditionalPropertyKeys) } - - public static func == (lhs: AdditionalPropertiesArray, rhs: AdditionalPropertiesArray) -> Bool { - lhs.name == rhs.name - && lhs.additionalProperties == rhs.additionalProperties - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(name?.hashValue) - hasher.combine(additionalProperties.hashValue) - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesBoolean.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesBoolean.swift index e2908594503a..36e5b308d911 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesBoolean.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesBoolean.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class AdditionalPropertiesBoolean: Content, Hashable { +public struct AdditionalPropertiesBoolean: Sendable, Content, Hashable { public var name: String? @@ -55,15 +55,5 @@ public final class AdditionalPropertiesBoolean: Content, Hashable { let additionalPropertiesContainer = try decoder.container(keyedBy: String.self) additionalProperties = try additionalPropertiesContainer.decodeMap(Bool.self, excludedKeys: nonAdditionalPropertyKeys) } - - public static func == (lhs: AdditionalPropertiesBoolean, rhs: AdditionalPropertiesBoolean) -> Bool { - lhs.name == rhs.name - && lhs.additionalProperties == rhs.additionalProperties - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(name?.hashValue) - hasher.combine(additionalProperties.hashValue) - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesClass.swift index dcbede7bc8fb..152cf59fd397 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesClass.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class AdditionalPropertiesClass: Content, Hashable { +public struct AdditionalPropertiesClass: Sendable, Content, Hashable { public var mapString: [String: String]? public var mapNumber: [String: Double]? @@ -66,35 +66,5 @@ public final class AdditionalPropertiesClass: Content, Hashable { try container.encodeIfPresent(anytype2, forKey: .anytype2) try container.encodeIfPresent(anytype3, forKey: .anytype3) } - - public static func == (lhs: AdditionalPropertiesClass, rhs: AdditionalPropertiesClass) -> Bool { - lhs.mapString == rhs.mapString && - lhs.mapNumber == rhs.mapNumber && - lhs.mapInteger == rhs.mapInteger && - lhs.mapBoolean == rhs.mapBoolean && - lhs.mapArrayInteger == rhs.mapArrayInteger && - lhs.mapArrayAnytype == rhs.mapArrayAnytype && - lhs.mapMapString == rhs.mapMapString && - lhs.mapMapAnytype == rhs.mapMapAnytype && - lhs.anytype1 == rhs.anytype1 && - lhs.anytype2 == rhs.anytype2 && - lhs.anytype3 == rhs.anytype3 - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(mapString?.hashValue) - hasher.combine(mapNumber?.hashValue) - hasher.combine(mapInteger?.hashValue) - hasher.combine(mapBoolean?.hashValue) - hasher.combine(mapArrayInteger?.hashValue) - hasher.combine(mapArrayAnytype?.hashValue) - hasher.combine(mapMapString?.hashValue) - hasher.combine(mapMapAnytype?.hashValue) - hasher.combine(anytype1?.hashValue) - hasher.combine(anytype2?.hashValue) - hasher.combine(anytype3?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesInteger.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesInteger.swift index f90c9ffa7a62..b0a0313d676e 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesInteger.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesInteger.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class AdditionalPropertiesInteger: Content, Hashable { +public struct AdditionalPropertiesInteger: Sendable, Content, Hashable { public var name: String? @@ -55,15 +55,5 @@ public final class AdditionalPropertiesInteger: Content, Hashable { let additionalPropertiesContainer = try decoder.container(keyedBy: String.self) additionalProperties = try additionalPropertiesContainer.decodeMap(Int.self, excludedKeys: nonAdditionalPropertyKeys) } - - public static func == (lhs: AdditionalPropertiesInteger, rhs: AdditionalPropertiesInteger) -> Bool { - lhs.name == rhs.name - && lhs.additionalProperties == rhs.additionalProperties - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(name?.hashValue) - hasher.combine(additionalProperties.hashValue) - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesNumber.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesNumber.swift index 5c6ae2f4740e..d96c6160f5eb 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesNumber.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesNumber.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class AdditionalPropertiesNumber: Content, Hashable { +public struct AdditionalPropertiesNumber: Sendable, Content, Hashable { public var name: String? @@ -55,15 +55,5 @@ public final class AdditionalPropertiesNumber: Content, Hashable { let additionalPropertiesContainer = try decoder.container(keyedBy: String.self) additionalProperties = try additionalPropertiesContainer.decodeMap(Double.self, excludedKeys: nonAdditionalPropertyKeys) } - - public static func == (lhs: AdditionalPropertiesNumber, rhs: AdditionalPropertiesNumber) -> Bool { - lhs.name == rhs.name - && lhs.additionalProperties == rhs.additionalProperties - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(name?.hashValue) - hasher.combine(additionalProperties.hashValue) - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesObject.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesObject.swift index 16dbb6aa01d5..ef397d62ab0f 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesObject.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesObject.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class AdditionalPropertiesObject: Content, Hashable { +public struct AdditionalPropertiesObject: Sendable, Content, Hashable { public var name: String? @@ -55,15 +55,5 @@ public final class AdditionalPropertiesObject: Content, Hashable { let additionalPropertiesContainer = try decoder.container(keyedBy: String.self) additionalProperties = try additionalPropertiesContainer.decodeMap([String: JSONValue].self, excludedKeys: nonAdditionalPropertyKeys) } - - public static func == (lhs: AdditionalPropertiesObject, rhs: AdditionalPropertiesObject) -> Bool { - lhs.name == rhs.name - && lhs.additionalProperties == rhs.additionalProperties - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(name?.hashValue) - hasher.combine(additionalProperties.hashValue) - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesString.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesString.swift index 27b7f315f1f4..ce1d463e89b4 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesString.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesString.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class AdditionalPropertiesString: Content, Hashable { +public struct AdditionalPropertiesString: Sendable, Content, Hashable { public var name: String? @@ -55,15 +55,5 @@ public final class AdditionalPropertiesString: Content, Hashable { let additionalPropertiesContainer = try decoder.container(keyedBy: String.self) additionalProperties = try additionalPropertiesContainer.decodeMap(String.self, excludedKeys: nonAdditionalPropertyKeys) } - - public static func == (lhs: AdditionalPropertiesString, rhs: AdditionalPropertiesString) -> Bool { - lhs.name == rhs.name - && lhs.additionalProperties == rhs.additionalProperties - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(name?.hashValue) - hasher.combine(additionalProperties.hashValue) - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Animal.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Animal.swift index e61742f7690f..408c19651482 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Animal.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Animal.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class Animal: Content, Hashable { +public struct Animal: Sendable, Content, Hashable { public var className: String public var color: String? = "red" @@ -30,17 +30,5 @@ public final class Animal: Content, Hashable { try container.encode(className, forKey: .className) try container.encodeIfPresent(color, forKey: .color) } - - public static func == (lhs: Animal, rhs: Animal) -> Bool { - lhs.className == rhs.className && - lhs.color == rhs.color - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(className.hashValue) - hasher.combine(color?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ApiResponse.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ApiResponse.swift index f9c5939be9b0..de7650f8c07a 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ApiResponse.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ApiResponse.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class ApiResponse: Content, Hashable { +public struct ApiResponse: Sendable, Content, Hashable { public var code: Int? public var type: String? @@ -34,19 +34,5 @@ public final class ApiResponse: Content, Hashable { try container.encodeIfPresent(type, forKey: .type) try container.encodeIfPresent(message, forKey: .message) } - - public static func == (lhs: ApiResponse, rhs: ApiResponse) -> Bool { - lhs.code == rhs.code && - lhs.type == rhs.type && - lhs.message == rhs.message - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(code?.hashValue) - hasher.combine(type?.hashValue) - hasher.combine(message?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ArrayOfArrayOfNumberOnly.swift index 60ae66f64e35..2a833c75ae67 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ArrayOfArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ArrayOfArrayOfNumberOnly.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class ArrayOfArrayOfNumberOnly: Content, Hashable { +public struct ArrayOfArrayOfNumberOnly: Sendable, Content, Hashable { public var arrayArrayNumber: [[Double]]? @@ -26,15 +26,5 @@ public final class ArrayOfArrayOfNumberOnly: Content, Hashable { var container = encoder.container(keyedBy: CodingKeys.self) try container.encodeIfPresent(arrayArrayNumber, forKey: .arrayArrayNumber) } - - public static func == (lhs: ArrayOfArrayOfNumberOnly, rhs: ArrayOfArrayOfNumberOnly) -> Bool { - lhs.arrayArrayNumber == rhs.arrayArrayNumber - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(arrayArrayNumber?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ArrayOfNumberOnly.swift index f93ca8bdeaf2..d626bac392d9 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ArrayOfNumberOnly.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class ArrayOfNumberOnly: Content, Hashable { +public struct ArrayOfNumberOnly: Sendable, Content, Hashable { public var arrayNumber: [Double]? @@ -26,15 +26,5 @@ public final class ArrayOfNumberOnly: Content, Hashable { var container = encoder.container(keyedBy: CodingKeys.self) try container.encodeIfPresent(arrayNumber, forKey: .arrayNumber) } - - public static func == (lhs: ArrayOfNumberOnly, rhs: ArrayOfNumberOnly) -> Bool { - lhs.arrayNumber == rhs.arrayNumber - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(arrayNumber?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ArrayTest.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ArrayTest.swift index e0a779991ca7..ddd10ecc24fb 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ArrayTest.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ArrayTest.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class ArrayTest: Content, Hashable { +public struct ArrayTest: Sendable, Content, Hashable { public var arrayOfString: [String]? public var arrayArrayOfInteger: [[Int64]]? @@ -34,19 +34,5 @@ public final class ArrayTest: Content, Hashable { try container.encodeIfPresent(arrayArrayOfInteger, forKey: .arrayArrayOfInteger) try container.encodeIfPresent(arrayArrayOfModel, forKey: .arrayArrayOfModel) } - - public static func == (lhs: ArrayTest, rhs: ArrayTest) -> Bool { - lhs.arrayOfString == rhs.arrayOfString && - lhs.arrayArrayOfInteger == rhs.arrayArrayOfInteger && - lhs.arrayArrayOfModel == rhs.arrayArrayOfModel - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(arrayOfString?.hashValue) - hasher.combine(arrayArrayOfInteger?.hashValue) - hasher.combine(arrayArrayOfModel?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/BigCat.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/BigCat.swift index 38b07f79246b..fb372fb4f98e 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/BigCat.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/BigCat.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class BigCat: Content, Hashable { +public struct BigCat: Sendable, Content, Hashable { public enum Kind: String, Sendable, Content, Hashable, CaseIterable { case lions = "lions" @@ -32,15 +32,5 @@ public final class BigCat: Content, Hashable { var container = encoder.container(keyedBy: CodingKeys.self) try container.encodeIfPresent(kind, forKey: .kind) } - - public static func == (lhs: BigCat, rhs: BigCat) -> Bool { - lhs.kind == rhs.kind - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(kind?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Capitalization.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Capitalization.swift index f0cc18c0f8c5..bd132c1edbce 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Capitalization.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Capitalization.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class Capitalization: Content, Hashable { +public struct Capitalization: Sendable, Content, Hashable { public var smallCamel: String? public var capitalCamel: String? @@ -47,25 +47,5 @@ public final class Capitalization: Content, Hashable { try container.encodeIfPresent(sCAETHFlowPoints, forKey: .sCAETHFlowPoints) try container.encodeIfPresent(ATT_NAME, forKey: .ATT_NAME) } - - public static func == (lhs: Capitalization, rhs: Capitalization) -> Bool { - lhs.smallCamel == rhs.smallCamel && - lhs.capitalCamel == rhs.capitalCamel && - lhs.smallSnake == rhs.smallSnake && - lhs.capitalSnake == rhs.capitalSnake && - lhs.sCAETHFlowPoints == rhs.sCAETHFlowPoints && - lhs.ATT_NAME == rhs.ATT_NAME - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(smallCamel?.hashValue) - hasher.combine(capitalCamel?.hashValue) - hasher.combine(smallSnake?.hashValue) - hasher.combine(capitalSnake?.hashValue) - hasher.combine(sCAETHFlowPoints?.hashValue) - hasher.combine(ATT_NAME?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Cat.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Cat.swift index 37e70c0036ff..71adb11f6ef0 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Cat.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Cat.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class Cat: Content, Hashable { +public struct Cat: Sendable, Content, Hashable { public var className: String public var color: String? = "red" @@ -34,19 +34,5 @@ public final class Cat: Content, Hashable { try container.encodeIfPresent(color, forKey: .color) try container.encodeIfPresent(declawed, forKey: .declawed) } - - public static func == (lhs: Cat, rhs: Cat) -> Bool { - lhs.className == rhs.className && - lhs.color == rhs.color && - lhs.declawed == rhs.declawed - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(className.hashValue) - hasher.combine(color?.hashValue) - hasher.combine(declawed?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Category.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Category.swift index f99360669afc..11497e0f7c5d 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Category.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Category.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class Category: Content, Hashable { +public struct Category: Sendable, Content, Hashable { public var id: Int64? public var name: String = "default-name" @@ -30,18 +30,6 @@ public final class Category: Content, Hashable { try container.encodeIfPresent(id, forKey: .id) try container.encode(name, forKey: .name) } - - public static func == (lhs: Category, rhs: Category) -> Bool { - lhs.id == rhs.id && - lhs.name == rhs.name - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(id?.hashValue) - hasher.combine(name.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ClassModel.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ClassModel.swift index 000d3658d224..b10c055f0300 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ClassModel.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ClassModel.swift @@ -9,7 +9,7 @@ import Foundation import Vapor /** Model for testing model with \"_class\" property */ -public final class ClassModel: Content, Hashable { +public struct ClassModel: Sendable, Content, Hashable { public var `class`: String? @@ -27,15 +27,5 @@ public final class ClassModel: Content, Hashable { var container = encoder.container(keyedBy: CodingKeys.self) try container.encodeIfPresent(`class`, forKey: .`class`) } - - public static func == (lhs: ClassModel, rhs: ClassModel) -> Bool { - lhs.`class` == rhs.`class` - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(`class`?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Client.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Client.swift index 4ba5219ddf21..bb40cd87b8a5 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Client.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Client.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class Client: Content, Hashable { +public struct Client: Sendable, Content, Hashable { public var client: String? @@ -26,15 +26,5 @@ public final class Client: Content, Hashable { var container = encoder.container(keyedBy: CodingKeys.self) try container.encodeIfPresent(client, forKey: .client) } - - public static func == (lhs: Client, rhs: Client) -> Bool { - lhs.client == rhs.client - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(client?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Dog.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Dog.swift index a20eb84fffb7..25bd0592e206 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Dog.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Dog.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class Dog: Content, Hashable { +public struct Dog: Sendable, Content, Hashable { public var className: String public var color: String? = "red" @@ -34,19 +34,5 @@ public final class Dog: Content, Hashable { try container.encodeIfPresent(color, forKey: .color) try container.encodeIfPresent(breed, forKey: .breed) } - - public static func == (lhs: Dog, rhs: Dog) -> Bool { - lhs.className == rhs.className && - lhs.color == rhs.color && - lhs.breed == rhs.breed - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(className.hashValue) - hasher.combine(color?.hashValue) - hasher.combine(breed?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/EnumArrays.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/EnumArrays.swift index a563c354db7d..62d725acbbbd 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/EnumArrays.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/EnumArrays.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class EnumArrays: Content, Hashable { +public struct EnumArrays: Sendable, Content, Hashable { public enum JustSymbol: String, Sendable, Content, Hashable, CaseIterable { case greaterThanOrEqualTo = ">=" @@ -38,17 +38,5 @@ public final class EnumArrays: Content, Hashable { try container.encodeIfPresent(justSymbol, forKey: .justSymbol) try container.encodeIfPresent(arrayEnum, forKey: .arrayEnum) } - - public static func == (lhs: EnumArrays, rhs: EnumArrays) -> Bool { - lhs.justSymbol == rhs.justSymbol && - lhs.arrayEnum == rhs.arrayEnum - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(justSymbol?.hashValue) - hasher.combine(arrayEnum?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/EnumTest.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/EnumTest.swift index 15779b57b9f9..3cf7147fe285 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/EnumTest.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/EnumTest.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class EnumTest: Content, Hashable { +public struct EnumTest: Sendable, Content, Hashable { public enum EnumString: String, Sendable, Content, Hashable, CaseIterable { case upper = "UPPER" @@ -60,23 +60,5 @@ public final class EnumTest: Content, Hashable { try container.encodeIfPresent(enumNumber, forKey: .enumNumber) try container.encodeIfPresent(outerEnum, forKey: .outerEnum) } - - public static func == (lhs: EnumTest, rhs: EnumTest) -> Bool { - lhs.enumString == rhs.enumString && - lhs.enumStringRequired == rhs.enumStringRequired && - lhs.enumInteger == rhs.enumInteger && - lhs.enumNumber == rhs.enumNumber && - lhs.outerEnum == rhs.outerEnum - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(enumString?.hashValue) - hasher.combine(enumStringRequired.hashValue) - hasher.combine(enumInteger?.hashValue) - hasher.combine(enumNumber?.hashValue) - hasher.combine(outerEnum?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/File.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/File.swift index 3b70313f505a..53b218ea6aae 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/File.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/File.swift @@ -9,7 +9,7 @@ import Foundation import Vapor /** Must be named `File` for test. */ -public final class File: Content, Hashable { +public struct File: Sendable, Content, Hashable { /** Test capitalization */ public var sourceURI: String? @@ -28,15 +28,5 @@ public final class File: Content, Hashable { var container = encoder.container(keyedBy: CodingKeys.self) try container.encodeIfPresent(sourceURI, forKey: .sourceURI) } - - public static func == (lhs: File, rhs: File) -> Bool { - lhs.sourceURI == rhs.sourceURI - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(sourceURI?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/FileSchemaTestClass.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/FileSchemaTestClass.swift index bc57101c274b..326b9f0d0d15 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/FileSchemaTestClass.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/FileSchemaTestClass.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class FileSchemaTestClass: Content, Hashable { +public struct FileSchemaTestClass: Sendable, Content, Hashable { public var file: File? public var files: [File]? @@ -30,17 +30,5 @@ public final class FileSchemaTestClass: Content, Hashable { try container.encodeIfPresent(file, forKey: .file) try container.encodeIfPresent(files, forKey: .files) } - - public static func == (lhs: FileSchemaTestClass, rhs: FileSchemaTestClass) -> Bool { - lhs.file == rhs.file && - lhs.files == rhs.files - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(file?.hashValue) - hasher.combine(files?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/FormatTest.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/FormatTest.swift index 570ef7166630..c91f6b451207 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/FormatTest.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/FormatTest.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class FormatTest: Content, Hashable { +public struct FormatTest: Sendable, Content, Hashable { public static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) public static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) @@ -85,41 +85,5 @@ public final class FormatTest: Content, Hashable { try container.encode(password, forKey: .password) try container.encodeIfPresent(bigDecimal, forKey: .bigDecimal) } - - public static func == (lhs: FormatTest, rhs: FormatTest) -> Bool { - lhs.integer == rhs.integer && - lhs.int32 == rhs.int32 && - lhs.int64 == rhs.int64 && - lhs.number == rhs.number && - lhs.float == rhs.float && - lhs.double == rhs.double && - lhs.string == rhs.string && - lhs.byte == rhs.byte && - lhs.binary == rhs.binary && - lhs.date == rhs.date && - lhs.dateTime == rhs.dateTime && - lhs.uuid == rhs.uuid && - lhs.password == rhs.password && - lhs.bigDecimal == rhs.bigDecimal - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(integer?.hashValue) - hasher.combine(int32?.hashValue) - hasher.combine(int64?.hashValue) - hasher.combine(number.hashValue) - hasher.combine(float?.hashValue) - hasher.combine(double?.hashValue) - hasher.combine(string?.hashValue) - hasher.combine(byte.hashValue) - hasher.combine(binary?.hashValue) - hasher.combine(date.hashValue) - hasher.combine(dateTime?.hashValue) - hasher.combine(uuid?.hashValue) - hasher.combine(password.hashValue) - hasher.combine(bigDecimal?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/HasOnlyReadOnly.swift index dfdb09175e4b..068ce1d7f1fe 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/HasOnlyReadOnly.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/HasOnlyReadOnly.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class HasOnlyReadOnly: Content, Hashable { +public struct HasOnlyReadOnly: Sendable, Content, Hashable { public var bar: String? public var foo: String? @@ -30,17 +30,5 @@ public final class HasOnlyReadOnly: Content, Hashable { try container.encodeIfPresent(bar, forKey: .bar) try container.encodeIfPresent(foo, forKey: .foo) } - - public static func == (lhs: HasOnlyReadOnly, rhs: HasOnlyReadOnly) -> Bool { - lhs.bar == rhs.bar && - lhs.foo == rhs.foo - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(bar?.hashValue) - hasher.combine(foo?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/List.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/List.swift index a96ff0eef787..0bf0e02a912f 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/List.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/List.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class List: Content, Hashable { +public struct List: Sendable, Content, Hashable { public var _123list: String? @@ -26,15 +26,5 @@ public final class List: Content, Hashable { var container = encoder.container(keyedBy: CodingKeys.self) try container.encodeIfPresent(_123list, forKey: ._123list) } - - public static func == (lhs: List, rhs: List) -> Bool { - lhs._123list == rhs._123list - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(_123list?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/MapTest.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/MapTest.swift index d74262b414d8..e2cfc8125daa 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/MapTest.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/MapTest.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class MapTest: Content, Hashable { +public struct MapTest: Sendable, Content, Hashable { public enum MapOfEnumString: String, Sendable, Content, Hashable, CaseIterable { case upper = "UPPER" @@ -42,21 +42,5 @@ public final class MapTest: Content, Hashable { try container.encodeIfPresent(directMap, forKey: .directMap) try container.encodeIfPresent(indirectMap, forKey: .indirectMap) } - - public static func == (lhs: MapTest, rhs: MapTest) -> Bool { - lhs.mapMapOfString == rhs.mapMapOfString && - lhs.mapOfEnumString == rhs.mapOfEnumString && - lhs.directMap == rhs.directMap && - lhs.indirectMap == rhs.indirectMap - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(mapMapOfString?.hashValue) - hasher.combine(mapOfEnumString?.hashValue) - hasher.combine(directMap?.hashValue) - hasher.combine(indirectMap?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/MixedPropertiesAndAdditionalPropertiesClass.swift index 61d7e38e0405..4cb274b14d33 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/MixedPropertiesAndAdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/MixedPropertiesAndAdditionalPropertiesClass.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class MixedPropertiesAndAdditionalPropertiesClass: Content, Hashable { +public struct MixedPropertiesAndAdditionalPropertiesClass: Sendable, Content, Hashable { public var uuid: UUID? public var dateTime: Date? @@ -34,19 +34,5 @@ public final class MixedPropertiesAndAdditionalPropertiesClass: Content, Hashabl try container.encodeIfPresent(dateTime, forKey: .dateTime) try container.encodeIfPresent(map, forKey: .map) } - - public static func == (lhs: MixedPropertiesAndAdditionalPropertiesClass, rhs: MixedPropertiesAndAdditionalPropertiesClass) -> Bool { - lhs.uuid == rhs.uuid && - lhs.dateTime == rhs.dateTime && - lhs.map == rhs.map - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(uuid?.hashValue) - hasher.combine(dateTime?.hashValue) - hasher.combine(map?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Model200Response.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Model200Response.swift index 40e36b4ca39c..6a6c76eb5e9e 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Model200Response.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Model200Response.swift @@ -9,7 +9,7 @@ import Foundation import Vapor /** Model for testing model name starting with number */ -public final class Model200Response: Content, Hashable { +public struct Model200Response: Sendable, Content, Hashable { public var name: Int? public var `class`: String? @@ -31,17 +31,5 @@ public final class Model200Response: Content, Hashable { try container.encodeIfPresent(name, forKey: .name) try container.encodeIfPresent(`class`, forKey: .`class`) } - - public static func == (lhs: Model200Response, rhs: Model200Response) -> Bool { - lhs.name == rhs.name && - lhs.`class` == rhs.`class` - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(name?.hashValue) - hasher.combine(`class`?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Name.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Name.swift index ef9692a6603f..62db357d768c 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Name.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Name.swift @@ -9,7 +9,7 @@ import Foundation import Vapor /** Model for testing model name same as property name */ -public final class Name: Content, Hashable { +public struct Name: Sendable, Content, Hashable { public var name: Int public var snakeCase: Int? @@ -39,21 +39,5 @@ public final class Name: Content, Hashable { try container.encodeIfPresent(property, forKey: .property) try container.encodeIfPresent(_123number, forKey: ._123number) } - - public static func == (lhs: Name, rhs: Name) -> Bool { - lhs.name == rhs.name && - lhs.snakeCase == rhs.snakeCase && - lhs.property == rhs.property && - lhs._123number == rhs._123number - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(name.hashValue) - hasher.combine(snakeCase?.hashValue) - hasher.combine(property?.hashValue) - hasher.combine(_123number?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/NumberOnly.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/NumberOnly.swift index 9c451e9f0182..2b3671db5bd4 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/NumberOnly.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/NumberOnly.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class NumberOnly: Content, Hashable { +public struct NumberOnly: Sendable, Content, Hashable { public var justNumber: Double? @@ -26,15 +26,5 @@ public final class NumberOnly: Content, Hashable { var container = encoder.container(keyedBy: CodingKeys.self) try container.encodeIfPresent(justNumber, forKey: .justNumber) } - - public static func == (lhs: NumberOnly, rhs: NumberOnly) -> Bool { - lhs.justNumber == rhs.justNumber - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(justNumber?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Order.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Order.swift index 8b4e86fb6d5a..366bcfad21ab 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Order.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Order.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class Order: Content, Hashable { +public struct Order: Sendable, Content, Hashable { public enum Status: String, Sendable, Content, Hashable, CaseIterable { case placed = "placed" @@ -52,26 +52,6 @@ public final class Order: Content, Hashable { try container.encodeIfPresent(status, forKey: .status) try container.encodeIfPresent(complete, forKey: .complete) } - - public static func == (lhs: Order, rhs: Order) -> Bool { - lhs.id == rhs.id && - lhs.petId == rhs.petId && - lhs.quantity == rhs.quantity && - lhs.shipDate == rhs.shipDate && - lhs.status == rhs.status && - lhs.complete == rhs.complete - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(id?.hashValue) - hasher.combine(petId?.hashValue) - hasher.combine(quantity?.hashValue) - hasher.combine(shipDate?.hashValue) - hasher.combine(status?.hashValue) - hasher.combine(complete?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/OuterComposite.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/OuterComposite.swift index d7696fe5c9f9..a6e486079b40 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/OuterComposite.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/OuterComposite.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class OuterComposite: Content, Hashable { +public struct OuterComposite: Sendable, Content, Hashable { public var myNumber: Double? public var myString: String? @@ -34,19 +34,5 @@ public final class OuterComposite: Content, Hashable { try container.encodeIfPresent(myString, forKey: .myString) try container.encodeIfPresent(myBoolean, forKey: .myBoolean) } - - public static func == (lhs: OuterComposite, rhs: OuterComposite) -> Bool { - lhs.myNumber == rhs.myNumber && - lhs.myString == rhs.myString && - lhs.myBoolean == rhs.myBoolean - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(myNumber?.hashValue) - hasher.combine(myString?.hashValue) - hasher.combine(myBoolean?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Pet.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Pet.swift index b5284e824e11..5a84b2a05897 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Pet.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Pet.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class Pet: Content, Hashable { +public struct Pet: Sendable, Content, Hashable { public enum Status: String, Sendable, Content, Hashable, CaseIterable { case available = "available" @@ -53,26 +53,6 @@ public final class Pet: Content, Hashable { try container.encodeIfPresent(tags, forKey: .tags) try container.encodeIfPresent(status, forKey: .status) } - - public static func == (lhs: Pet, rhs: Pet) -> Bool { - lhs.id == rhs.id && - lhs.category == rhs.category && - lhs.name == rhs.name && - lhs.photoUrls == rhs.photoUrls && - lhs.tags == rhs.tags && - lhs.status == rhs.status - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(id?.hashValue) - hasher.combine(category?.hashValue) - hasher.combine(name.hashValue) - hasher.combine(photoUrls.hashValue) - hasher.combine(tags?.hashValue) - hasher.combine(status?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ReadOnlyFirst.swift index c48fc99cdc81..76d6474b03c5 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ReadOnlyFirst.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/ReadOnlyFirst.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class ReadOnlyFirst: Content, Hashable { +public struct ReadOnlyFirst: Sendable, Content, Hashable { public var bar: String? public var baz: String? @@ -30,17 +30,5 @@ public final class ReadOnlyFirst: Content, Hashable { try container.encodeIfPresent(bar, forKey: .bar) try container.encodeIfPresent(baz, forKey: .baz) } - - public static func == (lhs: ReadOnlyFirst, rhs: ReadOnlyFirst) -> Bool { - lhs.bar == rhs.bar && - lhs.baz == rhs.baz - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(bar?.hashValue) - hasher.combine(baz?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Return.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Return.swift index 45415afbd2bf..564dac3a7786 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Return.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Return.swift @@ -9,7 +9,7 @@ import Foundation import Vapor /** Model for testing reserved words */ -public final class Return: Content, Hashable { +public struct Return: Sendable, Content, Hashable { public var `return`: Int? @@ -27,15 +27,5 @@ public final class Return: Content, Hashable { var container = encoder.container(keyedBy: CodingKeys.self) try container.encodeIfPresent(`return`, forKey: .`return`) } - - public static func == (lhs: Return, rhs: Return) -> Bool { - lhs.`return` == rhs.`return` - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(`return`?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/SpecialModelName.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/SpecialModelName.swift index 9319338bde68..3d6a0df0a3a3 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/SpecialModelName.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/SpecialModelName.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class SpecialModelName: Content, Hashable { +public struct SpecialModelName: Sendable, Content, Hashable { public var specialPropertyName: Int64? @@ -26,15 +26,5 @@ public final class SpecialModelName: Content, Hashable { var container = encoder.container(keyedBy: CodingKeys.self) try container.encodeIfPresent(specialPropertyName, forKey: .specialPropertyName) } - - public static func == (lhs: SpecialModelName, rhs: SpecialModelName) -> Bool { - lhs.specialPropertyName == rhs.specialPropertyName - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(specialPropertyName?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/StringBooleanMap.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/StringBooleanMap.swift index e558e254f531..2e29564a9433 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/StringBooleanMap.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/StringBooleanMap.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class StringBooleanMap: Content, Hashable { +public struct StringBooleanMap: Sendable, Content, Hashable { public enum CodingKeys: CodingKey, CaseIterable { @@ -46,13 +46,5 @@ public final class StringBooleanMap: Content, Hashable { let additionalPropertiesContainer = try decoder.container(keyedBy: String.self) additionalProperties = try additionalPropertiesContainer.decodeMap(Bool.self, excludedKeys: nonAdditionalPropertyKeys) } - - public static func == (lhs: StringBooleanMap, rhs: StringBooleanMap) -> Bool { - lhs.additionalProperties == rhs.additionalProperties - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(additionalProperties.hashValue) - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Tag.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Tag.swift index 632f09d0ca95..d7665cf1771e 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Tag.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Tag.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class Tag: Content, Hashable { +public struct Tag: Sendable, Content, Hashable { public var id: Int64? public var name: String? @@ -30,18 +30,6 @@ public final class Tag: Content, Hashable { try container.encodeIfPresent(id, forKey: .id) try container.encodeIfPresent(name, forKey: .name) } - - public static func == (lhs: Tag, rhs: Tag) -> Bool { - lhs.id == rhs.id && - lhs.name == rhs.name - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(id?.hashValue) - hasher.combine(name?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/TypeHolderDefault.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/TypeHolderDefault.swift index 766b73224e99..dbea8378ba21 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/TypeHolderDefault.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/TypeHolderDefault.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class TypeHolderDefault: Content, Hashable { +public struct TypeHolderDefault: Sendable, Content, Hashable { public var stringItem: String = "what" public var numberItem: Double @@ -42,23 +42,5 @@ public final class TypeHolderDefault: Content, Hashable { try container.encode(boolItem, forKey: .boolItem) try container.encode(arrayItem, forKey: .arrayItem) } - - public static func == (lhs: TypeHolderDefault, rhs: TypeHolderDefault) -> Bool { - lhs.stringItem == rhs.stringItem && - lhs.numberItem == rhs.numberItem && - lhs.integerItem == rhs.integerItem && - lhs.boolItem == rhs.boolItem && - lhs.arrayItem == rhs.arrayItem - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(stringItem.hashValue) - hasher.combine(numberItem.hashValue) - hasher.combine(integerItem.hashValue) - hasher.combine(boolItem.hashValue) - hasher.combine(arrayItem.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/TypeHolderExample.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/TypeHolderExample.swift index 8115aacedbac..78e61dd7714f 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/TypeHolderExample.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/TypeHolderExample.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class TypeHolderExample: Content, Hashable { +public struct TypeHolderExample: Sendable, Content, Hashable { public var stringItem: String public var numberItem: Double @@ -46,25 +46,5 @@ public final class TypeHolderExample: Content, Hashable { try container.encode(boolItem, forKey: .boolItem) try container.encode(arrayItem, forKey: .arrayItem) } - - public static func == (lhs: TypeHolderExample, rhs: TypeHolderExample) -> Bool { - lhs.stringItem == rhs.stringItem && - lhs.numberItem == rhs.numberItem && - lhs.floatItem == rhs.floatItem && - lhs.integerItem == rhs.integerItem && - lhs.boolItem == rhs.boolItem && - lhs.arrayItem == rhs.arrayItem - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(stringItem.hashValue) - hasher.combine(numberItem.hashValue) - hasher.combine(floatItem.hashValue) - hasher.combine(integerItem.hashValue) - hasher.combine(boolItem.hashValue) - hasher.combine(arrayItem.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/User.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/User.swift index 682a621514a8..3cb01c898704 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/User.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/User.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class User: Content, Hashable { +public struct User: Sendable, Content, Hashable { public var id: Int64? public var username: String? @@ -55,30 +55,6 @@ public final class User: Content, Hashable { try container.encodeIfPresent(phone, forKey: .phone) try container.encodeIfPresent(userStatus, forKey: .userStatus) } - - public static func == (lhs: User, rhs: User) -> Bool { - lhs.id == rhs.id && - lhs.username == rhs.username && - lhs.firstName == rhs.firstName && - lhs.lastName == rhs.lastName && - lhs.email == rhs.email && - lhs.password == rhs.password && - lhs.phone == rhs.phone && - lhs.userStatus == rhs.userStatus - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(id?.hashValue) - hasher.combine(username?.hashValue) - hasher.combine(firstName?.hashValue) - hasher.combine(lastName?.hashValue) - hasher.combine(email?.hashValue) - hasher.combine(password?.hashValue) - hasher.combine(phone?.hashValue) - hasher.combine(userStatus?.hashValue) - - } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/XmlItem.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/XmlItem.swift index 6a66d8e7e829..91fc7cd5a225 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/XmlItem.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/XmlItem.swift @@ -8,7 +8,7 @@ import Foundation import Vapor -public final class XmlItem: Content, Hashable { +public struct XmlItem: Sendable, Content, Hashable { public var attributeString: String? public var attributeNumber: Double? @@ -138,71 +138,5 @@ public final class XmlItem: Content, Hashable { try container.encodeIfPresent(prefixNsArray, forKey: .prefixNsArray) try container.encodeIfPresent(prefixNsWrappedArray, forKey: .prefixNsWrappedArray) } - - public static func == (lhs: XmlItem, rhs: XmlItem) -> Bool { - lhs.attributeString == rhs.attributeString && - lhs.attributeNumber == rhs.attributeNumber && - lhs.attributeInteger == rhs.attributeInteger && - lhs.attributeBoolean == rhs.attributeBoolean && - lhs.wrappedArray == rhs.wrappedArray && - lhs.nameString == rhs.nameString && - lhs.nameNumber == rhs.nameNumber && - lhs.nameInteger == rhs.nameInteger && - lhs.nameBoolean == rhs.nameBoolean && - lhs.nameArray == rhs.nameArray && - lhs.nameWrappedArray == rhs.nameWrappedArray && - lhs.prefixString == rhs.prefixString && - lhs.prefixNumber == rhs.prefixNumber && - lhs.prefixInteger == rhs.prefixInteger && - lhs.prefixBoolean == rhs.prefixBoolean && - lhs.prefixArray == rhs.prefixArray && - lhs.prefixWrappedArray == rhs.prefixWrappedArray && - lhs.namespaceString == rhs.namespaceString && - lhs.namespaceNumber == rhs.namespaceNumber && - lhs.namespaceInteger == rhs.namespaceInteger && - lhs.namespaceBoolean == rhs.namespaceBoolean && - lhs.namespaceArray == rhs.namespaceArray && - lhs.namespaceWrappedArray == rhs.namespaceWrappedArray && - lhs.prefixNsString == rhs.prefixNsString && - lhs.prefixNsNumber == rhs.prefixNsNumber && - lhs.prefixNsInteger == rhs.prefixNsInteger && - lhs.prefixNsBoolean == rhs.prefixNsBoolean && - lhs.prefixNsArray == rhs.prefixNsArray && - lhs.prefixNsWrappedArray == rhs.prefixNsWrappedArray - - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(attributeString?.hashValue) - hasher.combine(attributeNumber?.hashValue) - hasher.combine(attributeInteger?.hashValue) - hasher.combine(attributeBoolean?.hashValue) - hasher.combine(wrappedArray?.hashValue) - hasher.combine(nameString?.hashValue) - hasher.combine(nameNumber?.hashValue) - hasher.combine(nameInteger?.hashValue) - hasher.combine(nameBoolean?.hashValue) - hasher.combine(nameArray?.hashValue) - hasher.combine(nameWrappedArray?.hashValue) - hasher.combine(prefixString?.hashValue) - hasher.combine(prefixNumber?.hashValue) - hasher.combine(prefixInteger?.hashValue) - hasher.combine(prefixBoolean?.hashValue) - hasher.combine(prefixArray?.hashValue) - hasher.combine(prefixWrappedArray?.hashValue) - hasher.combine(namespaceString?.hashValue) - hasher.combine(namespaceNumber?.hashValue) - hasher.combine(namespaceInteger?.hashValue) - hasher.combine(namespaceBoolean?.hashValue) - hasher.combine(namespaceArray?.hashValue) - hasher.combine(namespaceWrappedArray?.hashValue) - hasher.combine(prefixNsString?.hashValue) - hasher.combine(prefixNsNumber?.hashValue) - hasher.combine(prefixNsInteger?.hashValue) - hasher.combine(prefixNsBoolean?.hashValue) - hasher.combine(prefixNsArray?.hashValue) - hasher.combine(prefixNsWrappedArray?.hashValue) - - } }