Releases: smithy-lang/smithy-rs
September 20th, 2022
Breaking Changes:
- ⚠ (client, smithy-rs#1603, aws-sdk-rust#586)
aws_smithy_types::RetryConfig
no longer implementsDefault
, and itsnew
function has been replaced withstandard
. - ⚠ (client, smithy-rs#1603, aws-sdk-rust#586) Client creation now panics if retries or timeouts are enabled without an async sleep implementation.
If you're using the Tokio runtime and have thert-tokio
feature enabled (which is enabled by default),
then you shouldn't notice this change at all.
Otherwise, if using something other than Tokio as the async runtime, theAsyncSleep
trait must be implemented,
and that implementation given to the config builder via thesleep_impl
method. Alternatively, retry can be
explicitly turned off by settingmax_attempts
to 1, which will result in successful client creation without an
async sleep implementation. - ⚠ (client, smithy-rs#1603, aws-sdk-rust#586) The
default_async_sleep
method on theClient
builder has been removed. The default async sleep is
wired up by default if none is provided. - ⚠ (client, smithy-rs#976, smithy-rs#1710) Removed the need to generate operation output and retry aliases in codegen.
- ⚠ (client, smithy-rs#1715, smithy-rs#1717)
ClassifyResponse
was renamed toClassifyRetry
and is no longer implemented for the unit type. - ⚠ (client, smithy-rs#1715, smithy-rs#1717) The
with_retry_policy
andretry_policy
functions onaws_smithy_http::operation::Operation
have been
renamed towith_retry_classifier
andretry_classifier
respectively. Public memberretry_policy
on
aws_smithy_http::operation::Parts
has been renamed toretry_classifier
.
New this release:
-
🎉 (client, smithy-rs#1647, smithy-rs#1112) Implemented customizable operations per RFC-0017.
Before this change, modifying operations before sending them required using lower-level APIs:
let input = SomeOperationInput::builder().some_value(5).build()?; let operation = { let op = input.make_operation(&service_config).await?; let (request, response) = op.into_request_response(); let request = request.augment(|req, _props| { req.headers_mut().insert( HeaderName::from_static("x-some-header"), HeaderValue::from_static("some-value") ); Result::<_, Infallible>::Ok(req) })?; Operation::from_parts(request, response) }; let response = smithy_client.call(operation).await?;
Now, users may easily modify operations before sending with the
customize
method:let response = client.some_operation() .some_value(5) .customize() .await? .mutate_request(|mut req| { req.headers_mut().insert( HeaderName::from_static("x-some-header"), HeaderValue::from_static("some-value") ); }) .send() .await?;
-
(client, smithy-rs#1735, @vojtechkral) Lower log level of two info-level log messages.
-
(all, smithy-rs#1710) Added
writable
property toRustType
andRuntimeType
that returns them inWritable
form -
(all, smithy-rs#1680, @ogudavid) Smithy IDL v2 mixins are now supported
-
🐛 (client, smithy-rs#1715, smithy-rs#1717) Generated clients now retry transient errors without replacing the retry policy.
-
🐛 (all, smithy-rs#1725, @sugmanue) Correctly determine nullability of members in IDLv2 models
Contributors
Thank you for your contributions! ❤
- @ogudavid (smithy-rs#1680)
- @sugmanue (smithy-rs#1725)
- @vojtechkral (smithy-rs#1735)
August 31st, 2022
Breaking Changes:
-
⚠🎉 (client, smithy-rs#1598) Previously, the config customizations that added functionality related to retry configs, timeout configs, and the
async sleep impl were defined in the smithy codegen module but were being loaded in the AWS codegen module. They
have now been updated to be loaded during smithy codegen. The affected classes are all defined in the
software.amazon.smithy.rust.codegen.smithy.customizations
module of smithy codegen.` This change does not affect
the generated code.These classes have been removed:
RetryConfigDecorator
SleepImplDecorator
TimeoutConfigDecorator
These classes have been renamed:
RetryConfigProviderConfig
is nowRetryConfigProviderCustomization
PubUseRetryConfig
is nowPubUseRetryConfigGenerator
SleepImplProviderConfig
is nowSleepImplProviderCustomization
TimeoutConfigProviderConfig
is nowTimeoutConfigProviderCustomization
-
⚠🎉 (all, smithy-rs#1635, smithy-rs#1416, @weihanglo) Support granular control of specifying runtime crate versions.
For code generation, the field
runtimeConfig.version
in smithy-build.json has been removed.
The new fieldruntimeConfig.versions
is an object whose keys are runtime crate names (e.g.aws-smithy-http
),
and values are user-specified versions.If you previously set
version = "DEFAULT"
, the migration path is simple.
By settingversions
with an empty object or just not setting it at all,
the version number of the code generator will be used as the version for all runtime crates.If you specified a certain version such as
version = "0.47.0", you can migrate to a special reserved key
DEFAULT`.
The equivalent JSON config would look like:{ "runtimeConfig": { "versions": { "DEFAULT": "0.47.0" } } }
Then all runtime crates are set with version 0.47.0 by default unless overridden by specific crates. For example,
{ "runtimeConfig": { "versions": { "DEFAULT": "0.47.0", "aws-smithy-http": "0.47.1" } } }
implies that we're using
aws-smithy-http
0.47.1 specifically. For the rest of the crates, it will default to 0.47.0. -
⚠ (all, smithy-rs#1623, @ogudavid) Remove @sensitive trait tests which applied trait to member. The ability to mark members with @sensitive was removed in Smithy 1.22.
-
⚠ (server, smithy-rs#1544) Servers now allow requests' ACCEPT header values to be:
*/*
type/*
type/subtype
-
🐛⚠ (all, smithy-rs#1274) Lossy converters into integer types for
aws_smithy_types::Number
have been
removed. Lossy converters into floating point types for
aws_smithy_types::Number
have been suffixed with_lossy
. If you were
directly using the integer lossy converters, we recommend you use the safe
converters.
Before:fn f1(n: aws_smithy_types::Number) { let foo: f32 = n.to_f32(); // Lossy conversion! let bar: u32 = n.to_u32(); // Lossy conversion! }
After:
fn f1(n: aws_smithy_types::Number) { use std::convert::TryInto; // Unnecessary import if you're using Rust 2021 edition. let foo: f32 = n.try_into().expect("lossy conversion detected"); // Or handle the error instead of panicking. // You can still do lossy conversions, but only into floating point types. let foo: f32 = n.to_f32_lossy(); // To lossily convert into integer types, use an `as` cast directly. let bar: u32 = n as u32; // Lossy conversion! }
-
⚠ (all, smithy-rs#1699) Bump MSRV from 1.58.1 to 1.61.0 per our policy.
New this release:
-
🎉 (all, smithy-rs#1623, @ogudavid) Update Smithy dependency to 1.23.1. Models using version 2.0 of the IDL are now supported.
-
🎉 (server, smithy-rs#1551, @hugobast) There is a canonical and easier way to run smithy-rs on Lambda see example.
-
🐛 (all, smithy-rs#1623, @ogudavid) Fix detecting sensitive members through their target shape having the @sensitive trait applied.
-
(all, smithy-rs#1623, @ogudavid) Fix SetShape matching needing to occur before ListShape since it is now a subclass. Sets were deprecated in Smithy 1.22.
-
(all, smithy-rs#1623, @ogudavid) Fix Union shape test data having an invalid empty union. Break fixed from Smithy 1.21 to Smithy 1.22.
-
(all, smithy-rs#1612, @unexge) Add codegen version to generated package metadata
-
(client, aws-sdk-rust#609) It is now possible to exempt specific operations from XML body root checking. To do this, add the
AllowInvalidXmlRoot
trait to the output struct of the operation you want to exempt.
Contributors
Thank you for your contributions! ❤
- @hugobast (smithy-rs#1551)
- @ogudavid (smithy-rs#1623)
- @unexge (smithy-rs#1612)
- @weihanglo (smithy-rs#1416, smithy-rs#1635)
August 4th, 2022
Breaking Changes:
- ⚠🎉 (all, smithy-rs#1570, @weihanglo) Support @deprecated trait for aggregate shapes
- ⚠ (all, smithy-rs#1157) Rename EventStreamInput to EventStreamSender
- ⚠ (all, smithy-rs#1157) The type of streaming unions that contain errors is generated without those errors.
Errors in a streaming unionUnion
are generated as members of the typeUnionError
.
Taking Transcribe as an example, theAudioStream
streaming union generates, in the client, both theAudioStream
type:and its error type,pub enum AudioStream { AudioEvent(crate::model::AudioEvent), Unknown, }
pub struct AudioStreamError { /// Kind of error that occurred. pub kind: AudioStreamErrorKind, /// Additional metadata about the error, including error code, message, and request ID. pub(crate) meta: aws_smithy_types::Error, }
AudioStreamErrorKind
contains all error variants for the union.
Before, the generated code looked as:pub enum AudioStream { AudioEvent(crate::model::AudioEvent), ... all error variants, Unknown, }
- ⚠ (all, smithy-rs#1157)
aws_smithy_http::event_stream::EventStreamSender
andaws_smithy_http::event_stream::Receiver
are now generic over<T, E>
,
whereT
is a streaming union andE
the union's errors.
This means that event stream errors are now sent asErr
of the union's error type.
With this example model:Before:@streaming union Event { throttlingError: ThrottlingError } @error("client") structure ThrottlingError {}
After:stream! { yield Ok(Event::ThrottlingError ...) }
An example from the SDK is in transcribe streaming.stream! { yield Err(EventError::ThrottlingError ...) }
New this release:
- 🎉 (all, smithy-rs#1482) Update codegen to generate support for flexible checksums.
- (all, smithy-rs#1520) Add explicit cast during JSON deserialization in case of custom Symbol providers.
- (all, smithy-rs#1578, @lkts) Change detailed logs in CredentialsProviderChain from info to debug
- (all, smithy-rs#1573, smithy-rs#1569) Non-streaming struct members are now marked
#[doc(hidden)]
since they will be removed in the future
Contributors
Thank you for your contributions! ❤
July 20th, 2022
New this release:
- 🎉 (all, aws-sdk-rust#567) Updated the smithy client's retry behavior to allow for a configurable initial backoff. Previously, the initial backoff
(namedr
in the code) was set to 2 seconds. This is not an ideal default for services that expect clients to quickly
retry failed request attempts. Now, users can set quicker (or slower) backoffs according to their needs. - (all, smithy-rs#1263) Add checksum calculation and validation wrappers for HTTP bodies.
- (all, smithy-rs#1263)
aws_smithy_http::header::append_merge_header_maps
, a function for merging twoHeaderMap
s, is now public.
v0.45.0 (June 28th, 2022)
Breaking Changes:
- ⚠ (smithy-rs#932) Replaced use of
pin-project
with equivalentpin-project-lite
. For pinned enum tuple variants and tuple structs, this
change requires that we switch to using enum struct variants and regular structs. Most of the structs and enums that
were updated had only private fields/variants and so have the same public API. However, this change does affect the
public API ofaws_smithy_http_tower::map_request::MapRequestFuture<F, E>
. TheInner
andReady
variants contained a
single value. Each have been converted to struct variants and the inner value is now accessible by theinner
field
instead of the0
field.
New this release:
- 🎉 (smithy-rs#1411, smithy-rs#1167) Upgrade to Gradle 7. This change is not a breaking change, however, users of smithy-rs will need to switch to JDK 17
- 🐛 (smithy-rs#1505, @kiiadi) Fix issue with codegen on Windows where module names were incorrectly determined from filenames
Contributors
Thank you for your contributions! ❤
v0.44.0 (June 22nd, 2022)
New this release:
- (smithy-rs#1460) Fix a potential bug with
ByteStream
's implementation offutures_core::stream::Stream
and add helpful error messages
for users on 32-bit systems that try to stream HTTP bodies larger than 4.29Gb. - 🐛 (smithy-rs#1427, smithy-rs#1465, smithy-rs#1459) Fix RustWriter bugs for
rustTemplate
anddocs
utility methods
v0.43.0 (June 9th, 2022)
New this release:
- 🎉 (smithy-rs#1381, @alonlud) Add ability to sign a request with all headers, or to change which headers are excluded from signing
- 🎉 (smithy-rs#1390) Add method
ByteStream::into_async_read
. This makes it easy to convertByteStream
s into a struct implementingtokio:io::AsyncRead
. Available on crate featurert-tokio
only. - (smithy-rs#1404, @petrosagg) Add ability to specify a different rust crate name than the one derived from the package name
- (smithy-rs#1404, @petrosagg) Switch to RustCrypto's implementation of MD5.
Contributors
Thank you for your contributions! ❤
v0.42.0 (May 13th, 2022)
Breaking Changes:
-
⚠🎉 (aws-sdk-rust#494, aws-sdk-rust#519) The
aws_smithy_http::byte_stream::bytestream_util::FsBuilder
has been updated to allow for easier creation of
multi-part requests.FsBuilder::offset
is a new method allowing users to specify an offset to start reading a file from.FsBuilder::file_size
has been reworked intoFsBuilder::length
and is now used to specify the amount of data to read.
With these two methods, it's now simple to create a
ByteStream
that will read a single "chunk" of a file. The example
below demonstrates how you could divide a singleFile
into consecutive chunks to create multipleByteStream
s.let example_file_path = Path::new("/example.txt"); let example_file_size = tokio::fs::metadata(&example_file_path).await.unwrap().len(); let chunks = 6; let chunk_size = file_size / chunks; let mut byte_streams = Vec::new(); for i in 0..chunks { let length = if i == chunks - 1 { // If we're on the last chunk, the length to read might be less than a whole chunk. // We substract the size of all previous chunks from the total file size to get the // size of the final chunk. file_size - (i * chunk_size) } else { chunk_size }; let byte_stream = ByteStream::read_from() .path(&file_path) .offset(i * chunk_size) .length(length) .build() .await?; byte_streams.push(byte_stream); } for chunk in byte_streams { // Make requests to a service }
New this release:
- (smithy-rs#1352) Log a debug event when a retry is going to be peformed
- (smithy-rs#1332, @82marbag) Update generated crates to Rust 2021
Contributors
Thank you for your contributions! ❤
v0.41.0 (April 28th 2022)
Breaking Changes:
- ⚠ (smithy-rs#1318) Bump MSRV from 1.56.1 to 1.58.1 per our "two versions behind" policy.
New this release:
- (smithy-rs#1307) Add new trait for HTTP body callbacks. This is the first step to enabling us to implement optional checksum verification of requests and responses.
- (smithy-rs#1330) Upgrade to Smithy 1.21.0
0.40.2 (April 14th, 2022)
Breaking Changes:
- ⚠ (aws-sdk-rust#490) Update all runtime crates to edition 2021
New this release:
- (smithy-rs#1262, @liubin) Fix link to Developer Guide in crate's README.md
- (smithy-rs#1301, @benesch) Update urlencoding crate to v2.1.0
Contributors
Thank you for your contributions! ❤