Releases: smithy-lang/smithy-rs
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! ❤
0.39.0 (March 17, 2022)
Breaking Changes:
-
⚠ (aws-sdk-rust#406)
aws_types::config::Config
has been renamed toaws_types:sdk_config::SdkConfig
. This is to better differentiate it
from service-specific configs likeaws_s3_sdk::Config
. If you were creating shared configs with
aws_config::load_from_env()
, then you don't have to do anything. If you were directly referring to a shared config,
update youruse
statements andstruct
names.Before:
use aws_types::config::Config; fn main() { let config = Config::builder() // config builder methods... .build() .await; }
After:
use aws_types::SdkConfig; fn main() { let config = SdkConfig::builder() // config builder methods... .build() .await; }
-
⚠ (smithy-rs#724) Timeout configuration has been refactored a bit. If you were setting timeouts through environment variables or an AWS
profile, then you shouldn't need to change anything. Take note, however, that we don't currently support HTTP connect,
read, write, or TLS negotiation timeouts. If you try to set any of those timeouts in your profile or environment, we'll
log a warning explaining that those timeouts don't currently do anything.If you were using timeouts programmatically,
you'll need to update your code. In previous versions, timeout configuration was stored in a singleTimeoutConfig
struct. In this new version, timeouts have been broken up into several different config structs that are then collected
in atimeout::Config
struct. As an example, to get the API per-attempt timeout in previous versions you would access
it with<your TimeoutConfig>.api_call_attempt_timeout()
and in this new version you would access it with
<your timeout::Config>.api.call_attempt_timeout()
. We also made some unimplemented timeouts inaccessible in order to
avoid giving users the impression that setting them had an effect. We plan to re-introduce them once they're made
functional in a future update.
New this release:
- (smithy-rs#1225)
DynMiddleware
is nowclone
able - (smithy-rs#1257) HTTP request property bag now contains list of desired HTTP versions to use when making requests. This list is not currently used but will be in an upcoming update.