Skip to content

Releases: smithy-lang/smithy-rs

August 31st, 2022

31 Aug 09:51
Compare
Choose a tag to compare
August 31st, 2022 Pre-release
Pre-release

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 now RetryConfigProviderCustomization
    • PubUseRetryConfig is now PubUseRetryConfigGenerator
    • SleepImplProviderConfig is now SleepImplProviderCustomization
    • TimeoutConfigProviderConfig is now TimeoutConfigProviderCustomization
  • ⚠🎉 (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 field runtimeConfig.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 setting versions 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! ❤

August 4th, 2022

04 Aug 01:40
Compare
Choose a tag to compare
August 4th, 2022 Pre-release
Pre-release

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 union Union are generated as members of the type UnionError.
    Taking Transcribe as an example, the AudioStream streaming union generates, in the client, both the AudioStream type:
    pub enum AudioStream {
        AudioEvent(crate::model::AudioEvent),
        Unknown,
    }
    and its error type,
    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 and aws_smithy_http::event_stream::Receiver are now generic over <T, E>,
    where T is a streaming union and E the union's errors.
    This means that event stream errors are now sent as Err of the union's error type.
    With this example model:
    @streaming union Event {
        throttlingError: ThrottlingError
    }
    @error("client") structure ThrottlingError {}
    Before:
    stream! { yield Ok(Event::ThrottlingError ...) }
    After:
    stream! { yield Err(EventError::ThrottlingError ...) }
    An example from the SDK is in transcribe streaming.

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

20 Jul 17:50
Compare
Choose a tag to compare
July 20th, 2022 Pre-release
Pre-release

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
    (named r 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 two HeaderMaps, is now public.

v0.45.0 (June 28th, 2022)

28 Jun 23:07
Compare
Choose a tag to compare
Pre-release

Breaking Changes:

  • ⚠ (smithy-rs#932) Replaced use of pin-project with equivalent pin-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 of aws_smithy_http_tower::map_request::MapRequestFuture<F, E>. The Inner and Ready variants contained a
    single value. Each have been converted to struct variants and the inner value is now accessible by the inner field
    instead of the 0 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)

22 Jun 23:07
Compare
Choose a tag to compare
Pre-release

New this release:

  • (smithy-rs#1460) Fix a potential bug with ByteStream's implementation of futures_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 and docs utility methods

v0.43.0 (June 9th, 2022)

01 Jun 18:51
Compare
Choose a tag to compare
Pre-release

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 convert ByteStreams into a struct implementing tokio:io::AsyncRead. Available on crate feature rt-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)

13 May 23:20
Compare
Choose a tag to compare
Pre-release

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 into FsBuilder::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 single File into consecutive chunks to create multiple ByteStreams.

    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:

Contributors
Thank you for your contributions! ❤

v0.41.0 (April 28th 2022)

29 Apr 14:40
9b6210c
Compare
Choose a tag to compare
Pre-release

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)

14 Apr 21:09
c5e2ce5
Compare
Choose a tag to compare
Pre-release

Breaking Changes:

New this release:

Contributors
Thank you for your contributions! ❤

0.39.0 (March 17, 2022)

17 Mar 21:20
61b0a8a
Compare
Choose a tag to compare
Pre-release

Breaking Changes:

  • ⚠ (aws-sdk-rust#406) aws_types::config::Config has been renamed to aws_types:sdk_config::SdkConfig. This is to better differentiate it
    from service-specific configs like aws_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 your use statements and struct 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 single TimeoutConfig
    struct. In this new version, timeouts have been broken up into several different config structs that are then collected
    in a timeout::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 now cloneable
  • (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.