Releases: smithy-lang/smithy-rs
August 1st, 2023
Breaking Changes:
-
⚠️ (client) The entire architecture of generated clients has been overhauled. See the upgrade guide to get your code working again. -
⚠️ (client, smithy-rs#2738)ClientProtocolGenerator
has been renamed toOperationGenerator
better represent what its generating. -
⚠️ 🎉 (server, smithy-rs#2740, smithy-rs#2759, smithy-rs#2779, smithy-rs#2827, @hlbarber) The middleware system has been reworked as we push for a unified, simple, and consistent API. See the server middleware changes discussion for more information. -
⚠️ (all, smithy-rs#2675) Remove native-tls and add a migration guide. -
⚠️ (client, smithy-rs#2671)Breaking change in how event stream signing works (click to expand more details)
This change will only impact you if you are wiring up their own event stream signing/authentication scheme. If you're using
aws-sig-auth
to use AWS SigV4 event stream signing, then this change will not impact you.Previously, event stream signing was configured at codegen time by placing a
new_event_stream_signer
method on theConfig
. This function was called at serialization time to connect the signer to the streaming body. Now, instead, a specialDeferredSigner
is wired up at serialization time that relies on a signing implementation to be sent on a channel by the HTTP request signer. To do this, aDeferredSignerSender
must be pulled out of the property bag, and itssend()
method called with the desired event stream signing implementation.See the changes in #2671 for an example of how this was done for SigV4.
-
⚠️ (all, smithy-rs#2673) For event stream operations, theEventStreamSender
in inputs/outputs now requires the passed inStream
impl to implementSync
. -
⚠️ (server, smithy-rs#2539) Code generation will abort if theignoreUnsupportedConstraints
codegen flag has no effect, that is, if all constraint traits used in your model are well-supported. Please remove the flag in such case. -
⚠️ (client, smithy-rs#2728, smithy-rs#2262, aws-sdk-rust#2087) The property bag type for Time is nowSharedTimeSource
, notSystemTime
. If your code relies on setting request time, useaws_smithy_async::time::SharedTimeSource
. -
⚠️ (server, smithy-rs#2676, smithy-rs#2685) Bump dependency onlambda_http
byaws-smithy-http-server
to 0.8.0. This version ofaws-smithy-http-server
is only guaranteed to be compatible with 0.8.0, or semver-compatible versions of 0.8.0 of thelambda_http
crate. It will not work with versions prior to 0.8.0 at runtime, making requests to your smithy-rs service unroutable, so please make sure you're running your service in a compatible configuration -
⚠️ (server, smithy-rs#2457, @hlbarber) RemovePollError
from an operationsService::Error
.Any
tower::Service
provided to
Operation::from_service
no longer requiresService::Error = OperationError<Op::Error, PollError>
, instead requiring justService::Error = Op::Error
. -
⚠️ (client, smithy-rs#2742) A newtype wrapperSharedAsyncSleep
has been introduced and occurrences ofArc<dyn AsyncSleep>
that appear in public APIs have been replaced with it. -
⚠️ (all, smithy-rs#2893) Update MSRV to Rust 1.69.0 -
⚠️ (server, smithy-rs#2678)ShapeId
is the new structure used to represent a shape, with its absolute name, namespace and name.
OperationExtension
's members are replaced by theShapeId
and operations' names are now replced by aShapeId
.Before you had an operation and an absolute name as its
NAME
member. You could apply a plugin only to some selected operation:filter_by_operation_name(plugin, |name| name != Op::ID);
Your new filter selects on an operation's absolute name, namespace or name.
filter_by_operation_id(plugin, |id| id.name() != Op::ID.name());
The above filter is applied to an operation's name, the one you use to specify the operation in the Smithy model.
You can filter all operations in a namespace or absolute name:
filter_by_operation_id(plugin, |id| id.namespace() != "namespace"); filter_by_operation_id(plugin, |id| id.absolute() != "namespace#name");
-
⚠️ (client, smithy-rs#2758) The occurrences ofArc<dyn ResolveEndpoint>
have now been replaced withSharedEndpointResolver
in public APIs. -
⚠️ (server, smithy-rs#2740, smithy-rs#2759, smithy-rs#2779, @hlbarber) Removefilter_by_operation_id
andplugin_from_operation_id_fn
in favour offilter_by_operation
andplugin_from_operation_fn
.Previously, we provided
filter_by_operation_id
which filteredPlugin
application via a predicate over the Shape ID.use aws_smithy_http_server::plugin::filter_by_operation_id; use pokemon_service_server_sdk::operation_shape::CheckHealth; let filtered = filter_by_operation_id(plugin, |name| name != CheckHealth::NAME);
This had the problem that the user is unable to exhaustively match over a
&'static str
. To remedy this we have switched tofilter_by_operation
which is a predicate over an enum containing all operations contained in the service.use aws_smithy_http_server::plugin::filter_by_operation_id; use pokemon_service_server_sdk::service::Operation; let filtered = filter_by_operation(plugin, |op: Operation| op != Operation::CheckHealth);
Similarly,
plugin_from_operation_fn
now allows foruse aws_smithy_http_server::plugin::plugin_from_operation_fn; use pokemon_service_server_sdk::service::Operation; fn map<S>(op: Operation, inner: S) -> PrintService<S> { match op { Operation::CheckHealth => PrintService { name: op.shape_id().name(), inner }, Operation::GetPokemonSpecies => PrintService { name: "hello world", inner }, _ => todo!() } } let plugin = plugin_from_operation_fn(map);
-
⚠️ (client, smithy-rs#2783) The namingmake_token
for fields and the API ofIdempotencyTokenProvider
in service configs and their builders has now been updated toidempotency_token_provider
. -
⚠️ (all, smithy-rs#2808)CoreCodegenDecorator.transformModel
now takes an additional parametersettings: CodegenSettings
. -
⚠️ (client, smithy-rs#2845)aws_smithy_async::future::rendezvous::Sender::send
no longer exposestokio::sync::mpsc::error::SendError
for the error of its return type and instead exposes a new-type wrapper calledaws_smithy_async::future::rendezvous::error::SendError
. In addition, theaws_smithy_xml
crate no longer exposes types fromxmlparser
. -
⚠️ (client, smithy-rs#2847) By defaultendpoint_url
/set_endpoint_url
methods will be added to the service config. If this causes duplicate definitions, disable creation of those methods by settingincludeEndpointUrlConfig
undercodegen
to false (example). -
⚠️ (client, smithy-rs#2848) The implementationFrom<bytes_utils::segmented::SegmentedBuf>
foraws_smithy_http::event_stream::RawMessage
has been removed. -
⚠️ (server, smithy-rs#2865) Thealb_health_check
module has been moved out of theplugin
module into a newlayer
module. ALB health checks should be enacted before routing, and plugins run after routing, so the module location was misleading. Examples have been corrected to reflect the intended application of the layer. -
⚠️ (client, smithy-rs#2873) Thetest-util
feature in aws-smithy-client has been split to include a separatewiremock
feature. This allows test-util to be used without a Hyper server dependency making it usable in webassembly targets.
New this release:
- 🎉 (all, smithy-rs#2647, [smithy-rs#2645](https:/...
May 23rd, 2023
New this release:
- (all, smithy-rs#2612) The
Debug
implementation forPropertyBag
now prints a list of the types it contains. This significantly improves debuggability. - (all, smithy-rs#2653, smithy-rs#2656, @henriiik) Implement
Ord
andPartialOrd
forDateTime
. - 🐛 (client, smithy-rs#2696) Fix compiler errors in generated code when naming shapes after types in the Rust standard library prelude.
Contributors
Thank you for your contributions! ❤
April 26th, 2023
Breaking Changes:
- ⚠ (all, smithy-rs#2611) Update MSRV to Rust 1.67.1
New this release:
- 🎉 (server, smithy-rs#2540) Implement layer for servers to handle ALB health checks.
Take a look ataws_smithy_http_server::plugin::alb_health_check
to learn about it. - 🎉 (client, smithy-rs#2254, @eduardomourar) Clients now compile for the
wasm32-unknown-unknown
andwasm32-wasi
targets when no default features are enabled. WebAssembly is not officially supported yet, but this is a great first step towards it! - (server, smithy-rs#2540) Implement
PluginPipeline::http_layer
which allows you to apply atower::Layer
to all operations. - (client, aws-sdk-rust#784, @abusch) Implement std::error::Error#source() properly for the service meta Error enum.
- 🐛 (all, smithy-rs#2496) The outputs for event stream operations now implement the
Sync
auto-trait. - 🐛 (all, smithy-rs#2495) Streaming operations now emit the request ID at the
debug
log level like their non-streaming counterparts. - 🐛 (client, smithy-rs#2495) Streaming operations now emit the request ID at the
debug
log level like their non-streaming counterparts. - (client, smithy-rs#2507) The
enableNewCrateOrganizationScheme
codegen flag has been removed. If you opted out of the new crate organization scheme, it must be adopted now in order to upgrade (see the upgrade guidance from March 23rd's release). - (client, smithy-rs#2534)
aws_smithy_types::date_time::Format
has been re-exported in service client crates. - 🐛 (server, smithy-rs#2582, smithy-rs#2585) Fix generation of constrained shapes reaching
@sensitive
shapes - 🐛 (server, smithy-rs#2583, smithy-rs#2584) Fix server code generation bug affecting constrained shapes bound with
@httpPayload
- (client, smithy-rs#2603) Add a sensitive method to
ParseHttpResponse
. When this returns true, logging of the HTTP response body will be suppressed.
Contributors
Thank you for your contributions! ❤
April 11th, 2023
release-2023-04-11 Update changelog
March 23rd, 2023
Breaking Changes:
-
⚠🎉 (all, smithy-rs#2467) Update MSRV to 1.66.1
-
⚠ (client, smithy-rs#76, smithy-rs#2129) Generic clients no longer expose a
request_id()
function on errors. To get request ID functionality, use the SDK code generator. -
⚠ (client, smithy-rs#76, smithy-rs#2129) The
message()
andcode()
methods on errors have been moved intoProvideErrorMetadata
trait. This trait will need to be imported to continue calling these. -
⚠ (client, smithy-rs#76, smithy-rs#2129, smithy-rs#2075) The
*Error
and*ErrorKind
types have been combined to make error matching simpler.Example with S3
Before:
let result = client .get_object() .bucket(BUCKET_NAME) .key("some-key") .send() .await; match result { Ok(_output) => { /* Do something with the output */ } Err(err) => match err.into_service_error() { GetObjectError { kind, .. } => match kind { GetObjectErrorKind::InvalidObjectState(value) => println!("invalid object state: {:?}", value), GetObjectErrorKind::NoSuchKey(_) => println!("object didn't exist"), } err @ GetObjectError { .. } if err.code() == Some("SomeUnmodeledError") => {} err @ _ => return Err(err.into()), }, }
After:
// Needed to access the `.code()` function on the error type: use aws_sdk_s3::types::ProvideErrorMetadata; let result = client .get_object() .bucket(BUCKET_NAME) .key("some-key") .send() .await; match result { Ok(_output) => { /* Do something with the output */ } Err(err) => match err.into_service_error() { GetObjectError::InvalidObjectState(value) => { println!("invalid object state: {:?}", value); } GetObjectError::NoSuchKey(_) => { println!("object didn't exist"); } err if err.code() == Some("SomeUnmodeledError") => {} err @ _ => return Err(err.into()), }, }
-
⚠ (client, smithy-rs#76, smithy-rs#2129)
aws_smithy_types::Error
has been renamed toaws_smithy_types::error::ErrorMetadata
. -
⚠ (server, smithy-rs#2436) Remove unnecessary type parameter
B
fromUpgrade
service. -
🐛⚠ (server, smithy-rs#2382) Smithy members named
send
were previously renamed tosend_value
at codegen time. These will now be calledsend
in the generated code. -
⚠ (client, smithy-rs#2448) The modules in generated client crates have been reorganized. See the Client Crate Reorganization Upgrade Guidance to see how to fix your code after this change.
-
⚠ (server, smithy-rs#2438) Servers can send the
ServerRequestId
in the response headers.
Servers need to create their service using the new layer builderServerRequestIdProviderLayer::new_with_response_header
:let app = app .layer(&ServerRequestIdProviderLayer::new_with_response_header(HeaderName::from_static("x-request-id")));
New this release:
-
🐛🎉 (client, aws-sdk-rust#740) Fluent builder methods on the client are now marked as deprecated when the related operation is deprecated.
-
🎉 (all, smithy-rs#2398) Add support for the
awsQueryCompatible
trait. This allows services to continue supporting a custom error code (via theawsQueryError
trait) when the services migrate their protocol fromawsQuery
toawsJson1_0
annotated withawsQueryCompatible
.Click to expand for more details...
After the migration, services will include an additional header
x-amzn-query-error
in their responses whose value is in the form of<error code>;<error type>
. An example response looks something likeHTTP/1.1 400 x-amzn-query-error: AWS.SimpleQueueService.NonExistentQueue;Sender Date: Wed, 08 Sep 2021 23:46:52 GMT Content-Type: application/x-amz-json-1.0 Content-Length: 163 { "__type": "com.amazonaws.sqs#QueueDoesNotExist", "message": "some user-visible message" }
<error code>
isAWS.SimpleQueueService.NonExistentQueue
and<error type>
isSender
.If an operation results in an error that causes a service to send back the response above, you can access
<error code>
and<error type>
as follows:match client.some_operation().send().await { Ok(_) => { /* success */ } Err(sdk_err) => { let err = sdk_err.into_service_error(); assert_eq!( error.meta().code(), Some("AWS.SimpleQueueService.NonExistentQueue"), ); assert_eq!(error.meta().extra("type"), Some("Sender")); } } </details>
-
🎉 (client, smithy-rs#2428, smithy-rs#2208)
SdkError
variants can now be constructed for easier unit testing. -
🐛 (server, smithy-rs#2441) Fix
FilterByOperationName
plugin. This previous caused services with this applied to fail to compile due to mismatched bounds. -
(client, smithy-rs#2437, aws-sdk-rust#600) Add more client re-exports. Specifically, it re-exports
aws_smithy_http::body::SdkBody
,aws_smithy_http::byte_stream::error::Error
, andaws_smithy_http::operation::{Request, Response}
. -
🐛 (all, smithy-rs#2226) Fix bug in timestamp format resolution. Prior to this fix, the timestamp format may have been incorrect if set on the target instead of on the member.
-
(all, smithy-rs#2226) Add support for offsets when parsing datetimes. RFC3339 date times now support offsets like
-0200
-
(client, aws-sdk-rust#160, smithy-rs#2445) Reconnect on transient errors.
Note: this behavior is disabled by default for generic clients. It can be enabled with
aws_smithy_client::Builder::reconnect_on_transient_errors
If a transient error (timeout, 500, 503, 503) is encountered, the connection will be evicted from the pool and will not
be reused. -
(all, smithy-rs#2474) Increase Tokio version to 1.23.1 for all crates. This is to address RUSTSEC-2023-0001
February 24th, 2023
New this release:
- 🎉 (server, smithy-rs#1969) Support for constraint traits on member shapes (constraint trait precedence) has been added.
- 🐛 (server, smithy-rs#2352, smithy-rs#2343) Fix bug whereby nested server structure member shapes targeting simple shapes with
@default
produced Rust code that did not compile
February 14th, 2023
Breaking Changes:
- ⚠🎉 (all, smithy-rs#2222, @Nugine) Upgrade Rust MSRV to 1.63.0
New this release:
- 🐛 (server, smithy-rs#2349) Fix inconsistent casing in services re-export.
- 🐛 (client, aws-sdk-rust#736) Fix issue where clients using native-tls connector were prevented from making HTTPS requests.
Contributors
Thank you for your contributions! ❤
February 6th, 2023
This release broke native-tls
, so it was yanked from crates.io. The next release includes all of these changes and a fix to native-tls
.
Breaking Changes:
-
🐛
⚠️ (server, smithy-rs#2276) Fixname
andabsolute
methods onOperationExtension
.The older, now removed, service builder would insert
OperationExtension
into thehttp::Response
containing the absolute shape ID with the#
symbol replaced with a.
. When reintroduced into the new service builder machinery the behavior was changed - we now do not perform the replace. This change fixes the documentation andname
/absolute
methods of theOperationExtension
API to match this new behavior.In the old service builder,
OperationExtension
was initialized, by the framework, and then used as follows:let ext = OperationExtension::new(“com.amazonaws.CompleteSnapshot”); // This is expected let name = ext.name(); // “CompleteSnapshot” let namespace = ext.namespace(); // = “com.amazonaws”;
When reintroduced,
OperationExtension
was initialized by thePlugin
and then used as follows:let ext = OperationExtension::new(“com.amazonaws#CompleteSnapshot”); // This is the bug let name = ext.name(); // “amazonaws#CompleteSnapshot” let namespace = ext.namespace(); // = “com”;
The intended behavior is now restored:
let ext = OperationExtension::new(“com.amazonaws#CompleteSnapshot”); // This is expected let name = ext.name(); // “CompleteSnapshot” let namespace = ext.namespace(); // = “com.amazonaws”;
The rationale behind this change is that the previous design was tailored towards a specific internal use case and shouldn’t be enforced on all customers.
New this release:
- 🎉 (server, smithy-rs#2232, smithy-rs#1670) The
@uniqueItems
trait onlist
shapes is now supported in server SDKs. - (client, smithy-rs#2312) Raise the minimum TLS version from 1.0 to 1.2 when using the
native-tls
feature inaws-smithy-client
. - 🐛 (client, smithy-rs#2271) Fix broken doc link for
tokio_stream::Stream
that is a re-export offutures_core::Stream
.
January 25th, 2023
New this release:
- 🐛 (server, smithy-rs#2247) Fix bug in
OperationExtensionFuture
sFuture::poll
implementation
January 24th, 2023
Breaking Changes:
-
⚠ (server, smithy-rs#2161) Remove deprecated service builder, this includes:
- Remove
aws_smithy_http_server::routing::Router
andaws_smithy_http_server::request::RequestParts
. - Move the
aws_smithy_http_server::routers::Router
trait andaws_smithy_http_server::routing::RoutingService
intoaws_smithy_http_server::routing
. - Remove the following from the generated SDK:
operation_registry.rs
operation_handler.rs
server_operation_handler_trait.rs
If migration to the new service builder API has not already been completed a brief summary of required changes can be seen in previous release notes and in API documentation of the root crate.
- Remove
New this release:
- 🐛 (server, smithy-rs#2213)
@sparse
list shapes and map shapes with constraint traits and with constrained members are now supported - (all, smithy-rs#2223)
aws_smithy_types::date_time::DateTime
,aws_smithy_types::Blob
now implement theEq
andHash
traits - (server, smithy-rs#2223) Code-generated types for server SDKs now implement the
Eq
andHash
traits when possible