Skip to content

May 9th, 2025

Choose a tag to compare

Breaking Changes:

New this release:

  • 🐛🎉 (client, smithy-rs#4074, smithy-rs#3926) Promote aws-smithy-mocks-experimental to aws-smithy-mocks. This crate is now a recommended tool for testing
    generated SDK clients. This release includes several fixes as well as a new sequence builder API that can be
    used to test more complex scenarios such as retries.

    use aws_sdk_s3::operation::get_object::GetObjectOutput;
    use aws_sdk_s3::config::retry::RetryConfig;
    use aws_smithy_types::byte_stream::ByteStream;
    use aws_smithy_mocks::{mock, mock_client, RuleMode};
    
    #[tokio::test]
    async fn test_retry_behavior() {
        // Create a rule that returns 503 twice, then succeeds
        let retry_rule = mock!(aws_sdk_s3::Client::get_object)
            .sequence()
            .http_status(503, None)
            .times(2)                                            // Return 503 HTTP status twice
            .output(|| GetObjectOutput::builder()                // Finally return a successful output
                .body(ByteStream::from_static(b"success"))
                .build())
            .build();
    
        // Create a mocked client with the rule
        let s3 = mock_client!(
            aws_sdk_s3,
            RuleMode::Sequential,
            [&retry_rule],
            |client_builder| {
                client_builder.retry_config(RetryConfig::standard().with_max_attempts(3))
            }
        );
    
        // This should succeed after two retries
        let result = s3
            .get_object()
            .bucket("test-bucket")
            .key("test-key")
            .send()
            .await
            .expect("success after retries");
    
        // Verify the response
        let data = result.body.collect().await.expect("successful read").to_vec();
        assert_eq!(data, b"success");
    
        // Verify all responses were used
        assert_eq!(retry_rule.num_calls(), 3);
    }
  • 🐛 (all, smithy-rs#4117) Fix a bug where fields that were initially annotated with the required trait and later updated to use the addedDefault trait were not serialized when their values matched the default, even when the values were explicitly set. With this fix, fields with addedDefault are now always serialized.