appstoreconnect-swift-sdk icon indicating copy to clipboard operation
appstoreconnect-swift-sdk copied to clipboard

Use Swift Package Plugin for generating OpenAPI code

Open liamnichols opened this issue 1 year ago • 1 comments

👋 I'm currently working on CreateAPI/CreateAPI#48 and have been playing around with different ways to use Swift Package Plugin's to streamline workflows. Given that this project has been on my radar recently, I wanted to explore how we'd go about using plugins to replace your current workflows. The main motivation for all of this was purely for research, but I wanted to raise a PR anyway to see if it would interest you or not.

This approach uses the new artifactbundle format to defined CreateAPI as a binaryTarget dependency which may or may not streamline installing the appropriate version of CreateAPI on your machine. I then define a new CommandPlugin that wraps the invocation to the create-api cli allowing you to instead trigger generating with the following command:

$ swift package --allow-writing-to-package-directory generate-open-api

Things are relatively straightforward overall but the only downside that I came across while testing this is when it comes to supporting Swift 5.5. Since you can't define the plugin in Package.swift when supporting 5.5, I had to bump swift-tools-version to 5.6 and then add [email protected] instead. This means that you'll have to keep both files around until you were to drop Swift 5.5/Xcode 13.3 support.

Anyway, let me know what you think. I'm happy to to make any adjustments you might like, but I'm also happy to close this if you don't see it being worthwhile at the moment. Thanks!

liamnichols avatar Aug 01 '22 17:08 liamnichols

Warnings
:warning: 'AppStoreVersionSubmission' is deprecated: Deprecated
:warning: 'AppStoreVersionSubmission' is deprecated: Deprecated
:warning: 'AppStoreVersionSubmission' is deprecated: Deprecated
:warning: 'AppStoreVersionSubmission' is deprecated: Deprecated
:warning: 'AgeRatingDeclaration' is deprecated: Deprecated
:warning: 'AgeRatingDeclaration' is deprecated: Deprecated
:warning: 'AgeRatingDeclaration' is deprecated: Deprecated
:warning: 'AppPricePoint' is deprecated: Deprecated
:warning: 'AppPricePoint' is deprecated: Deprecated
:warning: 'AppPricePoint' is deprecated: Deprecated
:warning: 'AppPricePoint' is deprecated: Deprecated
:warning: 'AppPricePoint' is deprecated: Deprecated
:warning: 'AppPricePoint' is deprecated: Deprecated
:warning: 'PricePoints' is deprecated: Deprecated
:warning: 'PricePoints' is deprecated: Deprecated
:warning: 'PricePoints' is deprecated: Deprecated
:warning: 'InAppPurchases' is deprecated: Deprecated
:warning: 'InAppPurchases' is deprecated: Deprecated
:warning: 'InAppPurchases' is deprecated: Deprecated
Messages
:book:

View more details on Bitrise

:book: AppStoreConnect-Swift-SDK-Tests: Executed 9 tests (0 failed, 0 retried, 0 skipped) in 0.155 seconds

SwiftLint found issues

Severity File Reason
Warning Package.swift:27 Line should be 140 characters or less: currently 154 characters (line_length)

Code Coverage Report

Name Coverage

Generated by :no_entry_sign: Danger Swift against 61c9ecef122f070b19a3cbb6f91c2e7df66fecb8

SwiftLeeBot avatar Aug 02 '22 08:08 SwiftLeeBot

Do you need anything from me on this? I didn't notice that it was still open 😄

liamnichols avatar Aug 09 '22 08:08 liamnichols

Do you need anything from me on this? I didn't notice that it was still open 😄

Nope, once CI finishes I'll merge it in!

AvdLee avatar Aug 10 '22 15:08 AvdLee

Congratulations! :tada: This was released as part of Release 2.3.0 :rocket:

Generated by GitBuddy

SwiftLeeBot avatar Oct 31 '22 08:10 SwiftLeeBot