-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Add service client version to user-agent #851
Conversation
dependenciesByTarget.forEach { writeTargetDependency(writer, it) } | ||
} | ||
writer.openBlock("resources: [", "]") { | ||
writer.write(".process(\"Resources\")") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the resources
declaration from the service client, since it doesn't have resources anymore.
val SMITHY_XML = smithySwiftDependency("SmithyXML") | ||
val SMITHY_JSON = smithySwiftDependency("SmithyJSON") | ||
val SMITHY_FORM_URL = smithySwiftDependency("SmithyFormURL") | ||
val SMITHY_WAITERS_API = smithySwiftDependency("SmithyWaitersAPI") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of the smithy-swift libraries have been DRYed up with the helper method below.
@@ -30,6 +30,7 @@ open class HttpProtocolServiceClient( | |||
ClientRuntimeTypes.Core.Client, | |||
) { | |||
writer.write("public static let clientName = \$S", serviceSymbol.name) | |||
writer.write("public static let version = \$S", ctx.settings.moduleVersion) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the static property on service client that contains the version.
val TestInitializer = runtimeSymbol("TestInitializer") | ||
val TestBaseError = runtimeSymbol("TestBaseError") | ||
val TestInitializer = runtimeSymbol("TestInitializer", SwiftDeclaration.ENUM) | ||
val TestBaseError = runtimeSymbol("TestBaseError", SwiftDeclaration.STRUCT) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added type info to these symbols.
@@ -17,9 +18,15 @@ class PackageManifestGeneratorTests { | |||
private val testContext = setupTests("simple-service-with-operation-and-dependency.smithy", "smithy.example#Example") | |||
|
|||
@Test | |||
fun `it renders package manifest file with macOS and iOS platforms block`() { | |||
fun `it starts with a swift-tools-version statement`() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added this test because a Swift package manifest is invalid without it.
Description of changes
version
property into each service clientSwiftDependencies
and DRY them up with a helper functionScope
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.