Skip to content

Commit

Permalink
[smithy-rs] Support @sparse constrained map shapes and list shapes …
Browse files Browse the repository at this point in the history
…(#2213)

Turns out we've never supported them, neither directly constrained nor
with constrained members, because of a lack of tests. Yet another data
point to prioritize working on code-generating `constraints.smithy` (see
smithy-lang/smithy-rs#2101).

The implementation is simple: we just need to call the symbol provider
on the member symbols instead of on the target symbols so we get
`Option<T>` list members / map values if applicable, and handle the
wrapper when converting between unconstrained and constrained types with
help from `match` and `Option<T>::map`.
  • Loading branch information
david-perez authored and aws-sdk-rust-ci committed Jan 26, 2023
1 parent a8a9f58 commit d195b45
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions sdk/kinesis/src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -853,8 +853,8 @@ impl DeregisterStreamConsumerInput {
.set_use_fips(_config.use_fips)
.set_use_dual_stack(_config.use_dual_stack)
.set_operation_type(Some("control".to_string()))
.set_consumer_arn(self.consumer_arn.clone())
.set_stream_arn(self.stream_arn.clone())
.set_consumer_arn(self.consumer_arn.clone())
.build()
.map_err(|err| {
aws_smithy_http::endpoint::ResolveEndpointError::from_source(
Expand Down Expand Up @@ -1397,8 +1397,8 @@ impl DescribeStreamConsumerInput {
.set_use_fips(_config.use_fips)
.set_use_dual_stack(_config.use_dual_stack)
.set_operation_type(Some("control".to_string()))
.set_consumer_arn(self.consumer_arn.clone())
.set_stream_arn(self.stream_arn.clone())
.set_consumer_arn(self.consumer_arn.clone())
.build()
.map_err(|err| {
aws_smithy_http::endpoint::ResolveEndpointError::from_source(
Expand Down
24 changes: 12 additions & 12 deletions sdk/s3control/src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ impl CreateAccessPointInput {
.set_use_fips(_config.use_fips)
.set_use_dual_stack(_config.use_dual_stack)
.set_requires_account_id(Some(true))
.set_bucket(self.bucket.clone())
.set_account_id(self.account_id.clone())
.set_bucket(self.bucket.clone())
.build()
.map_err(|err| {
aws_smithy_http::endpoint::ResolveEndpointError::from_source(
Expand Down Expand Up @@ -1475,8 +1475,8 @@ impl DeleteAccessPointInput {
.set_use_fips(_config.use_fips)
.set_use_dual_stack(_config.use_dual_stack)
.set_requires_account_id(Some(true))
.set_account_id(self.account_id.clone())
.set_access_point_name(self.name.clone())
.set_account_id(self.account_id.clone())
.build()
.map_err(|err| {
aws_smithy_http::endpoint::ResolveEndpointError::from_source(
Expand Down Expand Up @@ -2472,8 +2472,8 @@ impl DeleteBucketLifecycleConfigurationInput {
.set_use_fips(_config.use_fips)
.set_use_dual_stack(_config.use_dual_stack)
.set_requires_account_id(Some(true))
.set_account_id(self.account_id.clone())
.set_bucket(self.bucket.clone())
.set_account_id(self.account_id.clone())
.build()
.map_err(|err| {
aws_smithy_http::endpoint::ResolveEndpointError::from_source(
Expand Down Expand Up @@ -2685,8 +2685,8 @@ impl DeleteBucketPolicyInput {
.set_use_fips(_config.use_fips)
.set_use_dual_stack(_config.use_dual_stack)
.set_requires_account_id(Some(true))
.set_account_id(self.account_id.clone())
.set_bucket(self.bucket.clone())
.set_account_id(self.account_id.clone())
.build()
.map_err(|err| {
aws_smithy_http::endpoint::ResolveEndpointError::from_source(
Expand Down Expand Up @@ -2892,8 +2892,8 @@ impl DeleteBucketTaggingInput {
.set_use_fips(_config.use_fips)
.set_use_dual_stack(_config.use_dual_stack)
.set_requires_account_id(Some(true))
.set_bucket(self.bucket.clone())
.set_account_id(self.account_id.clone())
.set_bucket(self.bucket.clone())
.build()
.map_err(|err| {
aws_smithy_http::endpoint::ResolveEndpointError::from_source(
Expand Down Expand Up @@ -4409,8 +4409,8 @@ impl GetAccessPointInput {
.set_use_fips(_config.use_fips)
.set_use_dual_stack(_config.use_dual_stack)
.set_requires_account_id(Some(true))
.set_access_point_name(self.name.clone())
.set_account_id(self.account_id.clone())
.set_access_point_name(self.name.clone())
.build()
.map_err(|err| {
aws_smithy_http::endpoint::ResolveEndpointError::from_source(
Expand Down Expand Up @@ -5765,8 +5765,8 @@ impl GetBucketInput {
.set_use_fips(_config.use_fips)
.set_use_dual_stack(_config.use_dual_stack)
.set_requires_account_id(Some(true))
.set_account_id(self.account_id.clone())
.set_bucket(self.bucket.clone())
.set_account_id(self.account_id.clone())
.build()
.map_err(|err| {
aws_smithy_http::endpoint::ResolveEndpointError::from_source(
Expand Down Expand Up @@ -5970,8 +5970,8 @@ impl GetBucketLifecycleConfigurationInput {
.set_use_fips(_config.use_fips)
.set_use_dual_stack(_config.use_dual_stack)
.set_requires_account_id(Some(true))
.set_account_id(self.account_id.clone())
.set_bucket(self.bucket.clone())
.set_account_id(self.account_id.clone())
.build()
.map_err(|err| {
aws_smithy_http::endpoint::ResolveEndpointError::from_source(
Expand Down Expand Up @@ -8319,8 +8319,8 @@ impl ListAccessPointsInput {
.set_use_fips(_config.use_fips)
.set_use_dual_stack(_config.use_dual_stack)
.set_requires_account_id(Some(true))
.set_bucket(self.bucket.clone())
.set_account_id(self.account_id.clone())
.set_bucket(self.bucket.clone())
.build()
.map_err(|err| {
aws_smithy_http::endpoint::ResolveEndpointError::from_source(
Expand Down Expand Up @@ -10207,8 +10207,8 @@ impl PutBucketLifecycleConfigurationInput {
.set_use_fips(_config.use_fips)
.set_use_dual_stack(_config.use_dual_stack)
.set_requires_account_id(Some(true))
.set_bucket(self.bucket.clone())
.set_account_id(self.account_id.clone())
.set_bucket(self.bucket.clone())
.build()
.map_err(|err| {
aws_smithy_http::endpoint::ResolveEndpointError::from_source(
Expand Down Expand Up @@ -10481,8 +10481,8 @@ impl PutBucketPolicyInput {
.set_use_fips(_config.use_fips)
.set_use_dual_stack(_config.use_dual_stack)
.set_requires_account_id(Some(true))
.set_bucket(self.bucket.clone())
.set_account_id(self.account_id.clone())
.set_bucket(self.bucket.clone())
.build()
.map_err(|err| {
aws_smithy_http::endpoint::ResolveEndpointError::from_source(
Expand Down Expand Up @@ -10728,8 +10728,8 @@ impl PutBucketTaggingInput {
.set_use_fips(_config.use_fips)
.set_use_dual_stack(_config.use_dual_stack)
.set_requires_account_id(Some(true))
.set_bucket(self.bucket.clone())
.set_account_id(self.account_id.clone())
.set_bucket(self.bucket.clone())
.build()
.map_err(|err| {
aws_smithy_http::endpoint::ResolveEndpointError::from_source(
Expand Down
6 changes: 3 additions & 3 deletions versions.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
smithy_rs_revision = '93f4c4f0548aa6d5f6e70dab3631be5f153df86c'
smithy_rs_revision = '9f905179cd3bc7751f9accbcbf60d9ea663e2022'
aws_doc_sdk_examples_revision = 'bbc8e30d40970b3c901eead096ff6a640c1806c9'

[manual_interventions]
Expand Down Expand Up @@ -1057,7 +1057,7 @@ model_hash = '9ec8a92782fbef7e2cf07fc9b5e656aa37b59668baff33acae10f270cfff4193'
[crates.aws-sdk-kinesis]
category = 'AwsSdk'
version = '0.24.0'
source_hash = '1eef43107b38c693af80f11298aefdc06fddce0511c83e9ccf91d5ba30b6640e'
source_hash = '2d69cfee3bfb348956109c0273cdebe1eb13e60f15f65aa2bd97e98fde95923f'
model_hash = '5eaef8321cea414140d87258e714988d88f3e41d9cdf4b83a1417027cb702cb9'

[crates.aws-sdk-kinesisanalytics]
Expand Down Expand Up @@ -1669,7 +1669,7 @@ model_hash = 'fb47cfd49cf2d9250063914599f703ed365b51be373988dc3f2cd64321c9583b'
[crates.aws-sdk-s3control]
category = 'AwsSdk'
version = '0.24.0'
source_hash = '0e375d9540f4eb3b68cd4b43cc44ab482732d181a16a04ddd26f43c6d03c43e8'
source_hash = 'f774e537f892d6048ea8306ba2f6406b3bcaa68639f41345ce0a91b67d255c85'
model_hash = '930bd33c05c393293591ae01cbdb6637fb5062ed3a3ad5e2dadddd8108cc8478'

[crates.aws-sdk-s3outposts]
Expand Down

0 comments on commit d195b45

Please sign in to comment.