From c92de486817a64c50d4165edfeb15c3bcf2f4aff Mon Sep 17 00:00:00 2001 From: ThibaultBee <37510686+ThibaultBee@users.noreply.github.com> Date: Mon, 21 Oct 2024 10:33:06 +0200 Subject: [PATCH 1/2] fix(swift5): fix compile error from Alamofire 5.10 Original commit is: https://github.com/OpenAPITools/openapi-generator/commit/1248d7a103dddf918978c5b688f67f26bd5aaf1c#diff-9867f46419733e8b0ff1e4e515000c7fb28ad36ca6d9634e793835a13661ef2eR411 Issue reported: https://github.com/apivideo/api.video-swift-client/issues/95 --- .../libraries/alamofire/AlamofireImplementations.mustache | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/templates/swift5/libraries/alamofire/AlamofireImplementations.mustache b/templates/swift5/libraries/alamofire/AlamofireImplementations.mustache index 84eedea0..21c24cfe 100644 --- a/templates/swift5/libraries/alamofire/AlamofireImplementations.mustache +++ b/templates/swift5/libraries/alamofire/AlamofireImplementations.mustache @@ -413,6 +413,8 @@ extension JSONDataEncoding: ParameterEncoding { public func encode(_ urlRequest: URLRequestConvertible, with parameters: Parameters?) throws -> URLRequest { let urlRequest = try urlRequest.asURLRequest() - return encode(urlRequest, with: parameters) + // Alamofire 5.10 changed type of Parameters so that it is no longer equivalent to [String: Any] + // cast this type so that the call to encode is not recursive + return encode(urlRequest, with: parameters as [String: Any]?) } } From 99961b4bfaba636ed6cebbc24c4b78d11f791d69 Mon Sep 17 00:00:00 2001 From: ThibaultBee <37510686+ThibaultBee@users.noreply.github.com> Date: Mon, 21 Oct 2024 10:47:04 +0200 Subject: [PATCH 2/2] fix(swift5): ci: simplify xcodebuild workflow --- .../statics/client/.github/workflows/build.yml | 18 ++---------------- .../uploader/.github/workflows/build.yml | 18 ++---------------- 2 files changed, 4 insertions(+), 32 deletions(-) diff --git a/templates/swift5/statics/client/.github/workflows/build.yml b/templates/swift5/statics/client/.github/workflows/build.yml index 65e710fd..e11cb2bb 100644 --- a/templates/swift5/statics/client/.github/workflows/build.yml +++ b/templates/swift5/statics/client/.github/workflows/build.yml @@ -28,24 +28,10 @@ jobs: uses: maxim-lobanov/setup-xcode@v1 with: xcode-version: latest-stable - - name: Set Default Scheme - run: | - scheme_list=$(xcodebuild -list -json | tr -d "\n") - default=$(echo $scheme_list | ruby -e "require 'json'; puts JSON.parse(STDIN.gets)['workspace']['schemes'][0]") - echo $default | cat >default - echo Using default scheme: $default - name: Build Package with xcodebuild - env: - scheme: ${{ 'default' }} - run: | - if [ $scheme = default ]; then scheme=$(cat default); fi - xcodebuild -scheme $scheme -destination 'platform=iOS Simulator,name=iPhone 16' + run: xcodebuild -scheme ApiVideoClient -destination 'platform=iOS Simulator,name=iPhone 16' - name: Build Example - env: - scheme: ${{ 'default' }} - run: | - if [ $scheme = default ]; then scheme=$(cat default); fi - xcodebuild clean build -project Example/Example.xcodeproj -scheme $scheme -sdk iphoneos + run: xcodebuild clean build -project Example/Example.xcodeproj -scheme ApiVideoClient -sdk iphoneos cocoapods: name: Verify cocopods podspec diff --git a/templates/swift5/statics/uploader/.github/workflows/build.yml b/templates/swift5/statics/uploader/.github/workflows/build.yml index 65e710fd..a584c86a 100644 --- a/templates/swift5/statics/uploader/.github/workflows/build.yml +++ b/templates/swift5/statics/uploader/.github/workflows/build.yml @@ -28,24 +28,10 @@ jobs: uses: maxim-lobanov/setup-xcode@v1 with: xcode-version: latest-stable - - name: Set Default Scheme - run: | - scheme_list=$(xcodebuild -list -json | tr -d "\n") - default=$(echo $scheme_list | ruby -e "require 'json'; puts JSON.parse(STDIN.gets)['workspace']['schemes'][0]") - echo $default | cat >default - echo Using default scheme: $default - name: Build Package with xcodebuild - env: - scheme: ${{ 'default' }} - run: | - if [ $scheme = default ]; then scheme=$(cat default); fi - xcodebuild -scheme $scheme -destination 'platform=iOS Simulator,name=iPhone 16' + run: xcodebuild -scheme ApiVideoUploader -destination 'platform=iOS Simulator,name=iPhone 16' - name: Build Example - env: - scheme: ${{ 'default' }} - run: | - if [ $scheme = default ]; then scheme=$(cat default); fi - xcodebuild clean build -project Example/Example.xcodeproj -scheme $scheme -sdk iphoneos + run: xcodebuild clean build -project Example/Example.xcodeproj -scheme ApiVideoUploader -sdk iphoneos cocoapods: name: Verify cocopods podspec