Skip to content

Commit 05c07eb

Browse files
committed
Merge remote-tracking branch 'upstream/main' into davidpz/unique-items-validator
2 parents 03d7e0e + 4aca7b3 commit 05c07eb

File tree

81 files changed

+345
-358
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+345
-358
lines changed

CHANGELOG.next.toml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,3 +431,29 @@ message = "`Endpoint::immutable` now takes `impl AsRef<str>` instead of `Uri`. F
431431
references = ["smithy-rs#1984", "smithy-rs#1496"]
432432
meta = { "breaking" = true, "tada" = false, "bug" = false, "target" = "client" }
433433
author = "jdisanti"
434+
435+
[[smithy-rs]]
436+
message = """
437+
[RestJson1](https://awslabs.github.io/smithy/2.0/aws/protocols/aws-restjson1-protocol.html#operation-error-serialization) server SDKs now serialize the [full shape ID](https://smithy.io/2.0/spec/model.html#shape-id) (including namespace) in operation error responses.
438+
439+
Example server error response before:
440+
441+
```
442+
HTTP/1.1 400 Bad Request
443+
content-type: application/json
444+
x-amzn-errortype: InvalidRequestException
445+
...
446+
```
447+
448+
Example server error response now:
449+
450+
```
451+
HTTP/1.1 400 Bad Request
452+
content-type: application/json
453+
x-amzn-errortype: com.example.service#InvalidRequestException
454+
...
455+
```
456+
"""
457+
references = ["smithy-rs#1982"]
458+
meta = { "breaking" = true, "tada" = false, "bug" = false, "target" = "server" }
459+
author = "david-perez"

aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsEndpointDecorator.kt

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import software.amazon.smithy.rust.codegen.core.rustlang.CargoDependency
2020
import software.amazon.smithy.rust.codegen.core.rustlang.RustModule
2121
import software.amazon.smithy.rust.codegen.core.rustlang.RustWriter
2222
import software.amazon.smithy.rust.codegen.core.rustlang.Writable
23-
import software.amazon.smithy.rust.codegen.core.rustlang.asType
2423
import software.amazon.smithy.rust.codegen.core.rustlang.rust
2524
import software.amazon.smithy.rust.codegen.core.rustlang.rustBlockTemplate
2625
import software.amazon.smithy.rust.codegen.core.rustlang.rustTemplate
@@ -95,18 +94,18 @@ class EndpointConfigCustomization(
9594
) :
9695
ConfigCustomization() {
9796
private val runtimeConfig = codegenContext.runtimeConfig
98-
private val resolveAwsEndpoint = runtimeConfig.awsEndpoint().asType().copy(name = "ResolveAwsEndpoint")
97+
private val resolveAwsEndpoint = runtimeConfig.awsEndpoint().toType().copy(name = "ResolveAwsEndpoint")
9998
private val smithyEndpointResolver =
100-
CargoDependency.SmithyHttp(runtimeConfig).asType().member("endpoint::ResolveEndpoint")
101-
private val placeholderEndpointParams = runtimeConfig.awsEndpoint().asType().member("Params")
102-
private val endpointShim = runtimeConfig.awsEndpoint().asType().member("EndpointShim")
99+
CargoDependency.smithyHttp(runtimeConfig).toType().member("endpoint::ResolveEndpoint")
100+
private val placeholderEndpointParams = runtimeConfig.awsEndpoint().toType().member("Params")
101+
private val endpointShim = runtimeConfig.awsEndpoint().toType().member("EndpointShim")
103102
private val moduleUseName = codegenContext.moduleUseName()
104103
private val codegenScope = arrayOf(
105104
"SmithyResolver" to smithyEndpointResolver,
106105
"PlaceholderParams" to placeholderEndpointParams,
107106
"ResolveAwsEndpoint" to resolveAwsEndpoint,
108107
"EndpointShim" to endpointShim,
109-
"aws_types" to awsTypes(runtimeConfig).asType(),
108+
"aws_types" to awsTypes(runtimeConfig).toType(),
110109
)
111110

112111
override fun section(section: ServiceConfig): Writable = writable {
@@ -184,7 +183,7 @@ class EndpointConfigCustomization(
184183

185184
class EndpointResolverFeature(private val runtimeConfig: RuntimeConfig, private val operationShape: OperationShape) :
186185
OperationCustomization() {
187-
private val placeholderEndpointParams = runtimeConfig.awsEndpoint().asType().member("Params")
186+
private val placeholderEndpointParams = runtimeConfig.awsEndpoint().toType().member("Params")
188187
private val codegenScope = arrayOf(
189188
"PlaceholderParams" to placeholderEndpointParams,
190189
"BuildError" to runtimeConfig.operationBuildError(),
@@ -215,7 +214,7 @@ class PubUseEndpoint(private val runtimeConfig: RuntimeConfig) : LibRsCustomizat
215214
is LibRsSection.Body -> writable {
216215
rust(
217216
"pub use #T::endpoint::Endpoint;",
218-
CargoDependency.SmithyHttp(runtimeConfig).asType(),
217+
CargoDependency.smithyHttp(runtimeConfig).toType(),
219218
)
220219
}
221220
else -> emptySection
@@ -226,8 +225,8 @@ class PubUseEndpoint(private val runtimeConfig: RuntimeConfig) : LibRsCustomizat
226225
class EndpointResolverGenerator(codegenContext: CodegenContext, private val endpointData: ObjectNode) {
227226
private val runtimeConfig = codegenContext.runtimeConfig
228227
private val endpointPrefix = codegenContext.serviceShape.expectTrait<ServiceTrait>().endpointPrefix
229-
private val awsEndpoint = runtimeConfig.awsEndpoint().asType()
230-
private val awsTypes = runtimeConfig.awsTypes().asType()
228+
private val awsEndpoint = runtimeConfig.awsEndpoint().toType()
229+
private val awsTypes = runtimeConfig.awsTypes().toType()
231230
private val codegenScope =
232231
arrayOf(
233232
"Partition" to awsEndpoint.member("Partition"),

aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsFluentClientDecorator.kt

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import software.amazon.smithy.rust.codegen.core.rustlang.GenericTypeArg
2424
import software.amazon.smithy.rust.codegen.core.rustlang.RustGenerics
2525
import software.amazon.smithy.rust.codegen.core.rustlang.RustWriter
2626
import software.amazon.smithy.rust.codegen.core.rustlang.Writable
27-
import software.amazon.smithy.rust.codegen.core.rustlang.asType
2827
import software.amazon.smithy.rust.codegen.core.rustlang.rust
2928
import software.amazon.smithy.rust.codegen.core.rustlang.rustBlockTemplate
3029
import software.amazon.smithy.rust.codegen.core.rustlang.rustTemplate
@@ -39,13 +38,13 @@ import software.amazon.smithy.rust.codegen.core.util.expectTrait
3938
import software.amazon.smithy.rustsdk.AwsRuntimeType.defaultMiddleware
4039

4140
private class Types(runtimeConfig: RuntimeConfig) {
42-
private val smithyTypesDep = CargoDependency.SmithyTypes(runtimeConfig)
43-
private val smithyClientDep = CargoDependency.SmithyClient(runtimeConfig)
44-
private val smithyHttpDep = CargoDependency.SmithyHttp(runtimeConfig)
41+
private val smithyTypesDep = CargoDependency.smithyTypes(runtimeConfig)
42+
private val smithyClientDep = CargoDependency.smithyClient(runtimeConfig)
43+
private val smithyHttpDep = CargoDependency.smithyHttp(runtimeConfig)
4544

46-
val awsTypes = awsTypes(runtimeConfig).asType()
45+
val awsTypes = awsTypes(runtimeConfig).toType()
4746
val smithyClientRetry = RuntimeType("retry", smithyClientDep, "aws_smithy_client")
48-
val awsSmithyClient = smithyClientDep.asType()
47+
val awsSmithyClient = smithyClientDep.toType()
4948

5049
val connectorSettings = RuntimeType("ConnectorSettings", smithyClientDep, "aws_smithy_client::http_connector")
5150
val defaultMiddleware = runtimeConfig.defaultMiddleware()
@@ -106,7 +105,7 @@ class AwsFluentClientDecorator : RustCodegenDecorator<ClientProtocolGenerator, C
106105
AwsPresignedFluentBuilderMethod(runtimeConfig),
107106
AwsFluentClientDocs(codegenContext),
108107
),
109-
retryClassifier = runtimeConfig.awsHttp().asType().member("retry::AwsResponseRetryClassifier"),
108+
retryClassifier = runtimeConfig.awsHttp().toType().member("retry::AwsResponseRetryClassifier"),
110109
).render(rustCrate)
111110
rustCrate.withNonRootModule(CustomizableOperationGenerator.CUSTOMIZE_MODULE) {
112111
renderCustomizableOperationSendMethod(runtimeConfig, generics, this)
@@ -214,7 +213,7 @@ private class AwsFluentClientDocs(private val codegenContext: CodegenContext) :
214213
private val serviceShape = codegenContext.serviceShape
215214
private val crateName = codegenContext.moduleUseName()
216215
private val codegenScope =
217-
arrayOf("aws_config" to codegenContext.runtimeConfig.awsConfig().copy(scope = DependencyScope.Dev).asType())
216+
arrayOf("aws_config" to codegenContext.runtimeConfig.awsConfig().copy(scope = DependencyScope.Dev).toType())
218217

219218
// If no `aws-config` version is provided, assume that docs referencing `aws-config` cannot be given.
220219
// Also, STS and SSO must NOT reference `aws-config` since that would create a circular dependency.
@@ -279,7 +278,7 @@ private fun renderCustomizableOperationSendMethod(
279278
generics: FluentClientGenerics,
280279
writer: RustWriter,
281280
) {
282-
val smithyHttp = CargoDependency.SmithyHttp(runtimeConfig).asType()
281+
val smithyHttp = CargoDependency.smithyHttp(runtimeConfig).toType()
283282

284283
val operationGenerics = RustGenerics(GenericTypeArg("O"), GenericTypeArg("Retry"))
285284
val handleGenerics = generics.toRustGenerics()

aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsPresigningDecorator.kt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import software.amazon.smithy.rust.codegen.client.smithy.generators.protocol.Cli
2424
import software.amazon.smithy.rust.codegen.core.rustlang.CargoDependency
2525
import software.amazon.smithy.rust.codegen.core.rustlang.RustWriter
2626
import software.amazon.smithy.rust.codegen.core.rustlang.Writable
27-
import software.amazon.smithy.rust.codegen.core.rustlang.asType
2827
import software.amazon.smithy.rust.codegen.core.rustlang.docs
2928
import software.amazon.smithy.rust.codegen.core.rustlang.rust
3029
import software.amazon.smithy.rust.codegen.core.rustlang.rustBlock
@@ -145,10 +144,10 @@ class AwsInputPresignedMethod(
145144
"PresignedRequest" to AwsRuntimeType.Presigning.member("request::PresignedRequest"),
146145
"PresignedRequestService" to AwsRuntimeType.Presigning.member("service::PresignedRequestService"),
147146
"PresigningConfig" to AwsRuntimeType.Presigning.member("config::PresigningConfig"),
148-
"SdkError" to CargoDependency.SmithyHttp(runtimeConfig).asType().member("result::SdkError"),
149-
"aws_sigv4" to runtimeConfig.awsRuntimeDependency("aws-sigv4").asType(),
150-
"sig_auth" to runtimeConfig.sigAuth().asType(),
151-
"tower" to CargoDependency.Tower.asType(),
147+
"SdkError" to CargoDependency.smithyHttp(runtimeConfig).toType().member("result::SdkError"),
148+
"aws_sigv4" to runtimeConfig.awsRuntimeDependency("aws-sigv4").toType(),
149+
"sig_auth" to runtimeConfig.sigAuth().toType(),
150+
"tower" to CargoDependency.Tower.toType(),
152151
"Middleware" to runtimeConfig.defaultMiddleware(),
153152
)
154153

@@ -253,7 +252,7 @@ class AwsPresignedFluentBuilderMethod(
253252
"Error" to AwsRuntimeType.Presigning.member("config::Error"),
254253
"PresignedRequest" to AwsRuntimeType.Presigning.member("request::PresignedRequest"),
255254
"PresigningConfig" to AwsRuntimeType.Presigning.member("config::PresigningConfig"),
256-
"SdkError" to CargoDependency.SmithyHttp(runtimeConfig).asType().member("result::SdkError"),
255+
"SdkError" to CargoDependency.smithyHttp(runtimeConfig).toType().member("result::SdkError"),
257256
)
258257

259258
override fun section(section: FluentClientSection): Writable =

aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsRuntimeDependency.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ object AwsRuntimeType {
5050
fun RuntimeConfig.defaultMiddleware() = RuntimeType.forInlineDependency(
5151
InlineAwsDependency.forRustFile(
5252
"middleware", visibility = Visibility.PUBLIC,
53-
CargoDependency.SmithyHttp(this),
54-
CargoDependency.SmithyHttpTower(this),
55-
CargoDependency.SmithyClient(this),
53+
CargoDependency.smithyHttp(this),
54+
CargoDependency.smithyHttpTower(this),
55+
CargoDependency.smithyClient(this),
5656
CargoDependency.Tower,
5757
sigAuth(),
5858
awsHttp(),

aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/CredentialProviders.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import software.amazon.smithy.rust.codegen.client.smithy.generators.config.Confi
1212
import software.amazon.smithy.rust.codegen.client.smithy.generators.config.ServiceConfig
1313
import software.amazon.smithy.rust.codegen.client.smithy.generators.protocol.ClientProtocolGenerator
1414
import software.amazon.smithy.rust.codegen.core.rustlang.Writable
15-
import software.amazon.smithy.rust.codegen.core.rustlang.asType
1615
import software.amazon.smithy.rust.codegen.core.rustlang.rust
1716
import software.amazon.smithy.rust.codegen.core.rustlang.rustTemplate
1817
import software.amazon.smithy.rust.codegen.core.rustlang.writable
@@ -60,7 +59,7 @@ class CredentialsProviderDecorator : RustCodegenDecorator<ClientProtocolGenerato
6059
class CredentialProviderConfig(runtimeConfig: RuntimeConfig) : ConfigCustomization() {
6160
private val defaultProvider = defaultProvider()
6261
private val codegenScope = arrayOf(
63-
"credentials" to awsTypes(runtimeConfig).asType().member("credentials"),
62+
"credentials" to awsTypes(runtimeConfig).toType().member("credentials"),
6463
"DefaultProvider" to defaultProvider,
6564
)
6665

@@ -131,7 +130,7 @@ class PubUseCredentials(private val runtimeConfig: RuntimeConfig) : LibRsCustomi
131130
is LibRsSection.Body -> writable {
132131
rust(
133132
"pub use #T::Credentials;",
134-
awsTypes(runtimeConfig).asType(),
133+
awsTypes(runtimeConfig).toType(),
135134
)
136135
}
137136

aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/HttpConnectorConfigCustomization.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ import software.amazon.smithy.rust.codegen.client.smithy.customize.RustCodegenDe
1010
import software.amazon.smithy.rust.codegen.client.smithy.generators.config.ConfigCustomization
1111
import software.amazon.smithy.rust.codegen.client.smithy.generators.config.ServiceConfig
1212
import software.amazon.smithy.rust.codegen.client.smithy.generators.protocol.ClientProtocolGenerator
13-
import software.amazon.smithy.rust.codegen.core.rustlang.CargoDependency.Companion.SmithyClient
13+
import software.amazon.smithy.rust.codegen.core.rustlang.CargoDependency.Companion.smithyClient
1414
import software.amazon.smithy.rust.codegen.core.rustlang.Writable
15-
import software.amazon.smithy.rust.codegen.core.rustlang.asType
1615
import software.amazon.smithy.rust.codegen.core.rustlang.rust
1716
import software.amazon.smithy.rust.codegen.core.rustlang.rustTemplate
1817
import software.amazon.smithy.rust.codegen.core.rustlang.writable
@@ -39,7 +38,7 @@ class HttpConnectorConfigCustomization(
3938
private val runtimeConfig = codegenContext.runtimeConfig
4039
private val moduleUseName = codegenContext.moduleUseName()
4140
private val codegenScope = arrayOf(
42-
"HttpConnector" to SmithyClient(runtimeConfig).asType().member("http_connector::HttpConnector"),
41+
"HttpConnector" to smithyClient(runtimeConfig).toType().member("http_connector::HttpConnector"),
4342
)
4443

4544
override fun section(section: ServiceConfig): Writable {

aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/HttpRequestChecksumDecorator.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import software.amazon.smithy.rust.codegen.client.smithy.generators.protocol.Cli
1313
import software.amazon.smithy.rust.codegen.core.rustlang.CargoDependency
1414
import software.amazon.smithy.rust.codegen.core.rustlang.Visibility
1515
import software.amazon.smithy.rust.codegen.core.rustlang.Writable
16-
import software.amazon.smithy.rust.codegen.core.rustlang.asType
1716
import software.amazon.smithy.rust.codegen.core.rustlang.rust
1817
import software.amazon.smithy.rust.codegen.core.rustlang.rustTemplate
1918
import software.amazon.smithy.rust.codegen.core.smithy.CodegenContext
@@ -32,9 +31,9 @@ fun RuntimeConfig.awsInlineableBodyWithChecksum() = RuntimeType.forInlineDepende
3231
"http_body_checksum", visibility = Visibility.PUBLIC,
3332
CargoDependency.Http,
3433
CargoDependency.HttpBody,
35-
CargoDependency.SmithyHttp(this),
36-
CargoDependency.SmithyChecksums(this),
37-
CargoDependency.SmithyTypes(this),
34+
CargoDependency.smithyHttp(this),
35+
CargoDependency.smithyChecksums(this),
36+
CargoDependency.smithyTypes(this),
3837
CargoDependency.Bytes,
3938
CargoDependency.Tracing,
4039
this.sigAuth(),
@@ -105,7 +104,7 @@ private fun HttpChecksumTrait.checksumAlgorithmToStr(
105104
};
106105
""",
107106
"BuildError" to runtimeConfig.operationBuildError(),
108-
"ChecksumAlgorithm" to CargoDependency.SmithyChecksums(runtimeConfig).asType().member("ChecksumAlgorithm"),
107+
"ChecksumAlgorithm" to CargoDependency.smithyChecksums(runtimeConfig).toType().member("ChecksumAlgorithm"),
109108
)
110109

111110
// If a request checksum is not required and there's no way to set one, do nothing

0 commit comments

Comments
 (0)