Merge remote-tracking branch 'origin/smithy-rs-release-1.x.y' into merge-smithy-rs-release-1.x.y-to-main

This commit is contained in:
ysaito1001 2023-12-15 14:10:23 -06:00
commit fe9f492c44
8 changed files with 184 additions and 133 deletions

View File

@ -1,4 +1,28 @@
<!-- Do not manually edit this file. Use the `changelogger` tool. -->
December 13th, 2023
===================
December 11th, 2023
===================
**New this release:**
- :bug: (client, [smithy-rs#3305](https://github.com/smithy-lang/smithy-rs/issues/3305)) `crate::event_receiver::EventReceiver` is now re-exported as `crate::primitives::event_stream::EventReceiver` when a service supports event stream operations.
December 8th, 2023
==================
**New this release:**
- :tada: (all, [smithy-rs#3121](https://github.com/smithy-lang/smithy-rs/issues/3121), [smithy-rs#3295](https://github.com/smithy-lang/smithy-rs/issues/3295)) All generated docs now include docsrs labels when features are required
- :bug: (client, [smithy-rs#3262](https://github.com/smithy-lang/smithy-rs/issues/3262)) Loading native TLS trusted certs for the default HTTP client now only occurs if the default HTTP client is not overridden in config.
- (client, [smithy-rs#3277](https://github.com/smithy-lang/smithy-rs/issues/3277)) Improve the error messages for when auth fails to select an auth scheme for a request.
- (client, [smithy-rs#3282](https://github.com/smithy-lang/smithy-rs/issues/3282)) Fix documentation and examples on HyperConnector and HyperClientBuilder.
- (client, [aws-sdk-rust#990](https://github.com/awslabs/aws-sdk-rust/issues/990), @declanvk) Expose local socket address from ConnectionMetadata.
- (all, [smithy-rs#3294](https://github.com/smithy-lang/smithy-rs/issues/3294)) [`Number`](https://docs.rs/aws-smithy-types/latest/aws_smithy_types/enum.Number.html) `TryInto` implementations now succesfully convert from `f64` to numeric types when no precision is lost. This fixes some deserialization issues where numbers like `25.0` were sent when `Byte` fields were expected.
**Contributors**
Thank you for your contributions! ❤
- @declanvk ([aws-sdk-rust#990](https://github.com/awslabs/aws-sdk-rust/issues/990))
December 1st, 2023
==================
**New this release:**

View File

@ -11,93 +11,6 @@
# meta = { "breaking" = false, "tada" = false, "bug" = false, "target" = "client | server | all"}
# author = "rcoh"
[[aws-sdk-rust]]
message = "Loading native TLS trusted certs for the default HTTP client now only occurs if the default HTTP client is not overridden in config."
references = ["smithy-rs#3262"]
meta = { "breaking" = false, "tada" = false, "bug" = true }
author = "jdisanti"
[[smithy-rs]]
message = "Loading native TLS trusted certs for the default HTTP client now only occurs if the default HTTP client is not overridden in config."
references = ["smithy-rs#3262"]
meta = { "breaking" = false, "tada" = false, "bug" = true, "target" = "client" }
author = "jdisanti"
[[aws-sdk-rust]]
message = """Client creation now takes microseconds instead of milliseconds.
Previously, it would take 2-3 milliseconds for each client instantiation due to time spent compiling regexes.
For applications that used several clients, this would increase start-up time in cases where it really matters,
such as for AWS Lambda cold starts. This time was improved by both changing regex implementation and caching the
result of the compilation."""
references = ["aws-sdk-rust#975", "smithy-rs#3269"]
meta = { "breaking" = false, "tada" = true, "bug" = false }
author = "jdisanti"
[[aws-sdk-rust]]
message = """Add `test_credentials` to `ConfigLoader` in `aws_config`. This allows the following pattern during tests:
```rust
async fn main() {
let conf = aws_config::defaults(BehaviorVersion::latest())
.test_credentials()
.await;
}
```
This is designed for unit tests and using local mocks like DynamoDB Local and LocalStack with the SDK.
"""
meta = { "breaking" = false, "tada" = true, "bug" = false }
author = "rcoh"
references = ["smithy-rs#3279", "aws-sdk-rust#971"]
[[aws-sdk-rust]]
message = "Improve the error messages for when auth fails to select an auth scheme for a request."
references = ["aws-sdk-rust#979", "smithy-rs#3277"]
meta = { "breaking" = false, "tada" = false, "bug" = false }
author = "jdisanti"
[[smithy-rs]]
message = "Improve the error messages for when auth fails to select an auth scheme for a request."
references = ["smithy-rs#3277"]
meta = { "breaking" = false, "tada" = false, "bug" = false, "target" = "client" }
author = "jdisanti"
[[aws-sdk-rust]]
message = "Fix documentation and examples on HyperConnector and HyperClientBuilder."
references = ["aws-sdk-rust#986", "smithy-rs#3282"]
meta = { "breaking" = false, "tada" = false, "bug" = false }
author = "jdisanti"
[[smithy-rs]]
message = "Fix documentation and examples on HyperConnector and HyperClientBuilder."
references = ["smithy-rs#3282"]
meta = { "breaking" = false, "tada" = false, "bug" = false, "target" = "client" }
author = "jdisanti"
[[smithy-rs]]
message = "Expose local socket address from ConnectionMetadata."
references = ["aws-sdk-rust#990"]
meta = { "breaking" = false, "tada" = false, "bug" = false, "target" = "client" }
author = "declanvk"
[[smithy-rs]]
message = "All generated docs now include docsrs labels when features are required"
references = ["smithy-rs#3121", "smithy-rs#3295"]
meta = { "breaking" = false, "tada" = true, "bug" = false, "target" = "all" }
author = "rcoh"
[[aws-sdk-rust]]
message = "All generated docs now include docsrs labels when features are required"
references = ["smithy-rs#3121", "smithy-rs#3295"]
meta = { "breaking" = false, "tada" = true, "bug" = false }
author = "rcoh"
[[smithy-rs]]
message = "[`Number`](https://docs.rs/aws-smithy-types/latest/aws_smithy_types/enum.Number.html) `TryInto` implementations now succesfully convert from `f64` to numeric types when no precision is lost. This fixes some deserialization issues where numbers like `25.0` were sent when `Byte` fields were expected."
references = ["smithy-rs#3294"]
meta = { "breaking" = false, "tada" = false, "bug" = false, "target" = "all" }
author = "rcoh"
[[smithy-rs]]
message = "Add support for constructing [`SdkBody`] and [`ByteStream`] from `http-body` 1.0 bodies. Note that this is initial support and works via a backwards compatibility shim to http-body 0.4. Hyper 1.0 is not supported."
references = ["smithy-rs#3300", "aws-sdk-rust#977"]

View File

@ -5,34 +5,6 @@
{
"smithy-rs": [],
"aws-sdk-rust": [
{
"message": "Make properties of S3Control PublicAccessBlockConfiguration optional. Previously, they defaulted to false, but this created invalid requests.",
"meta": {
"bug": true,
"breaking": true,
"tada": false
},
"author": "milesziemer",
"references": [
"smithy-rs#3246"
],
"since-commit": "e155c3048b9989fe406ef575d461ea01dfaf294c",
"age": 5
},
{
"message": "Allow `--` to be used in bucket names for S3",
"meta": {
"bug": true,
"breaking": false,
"tada": false
},
"author": "rcoh",
"references": [
"smithy-rs#3253"
],
"since-commit": "48e3c95a3f10eebd5a637f8e7670c4232cdabbe4",
"age": 4
},
{
"message": "Retry additional classes of H2 errors (H2 GoAway & H2 ResetStream)",
"meta": {
@ -46,7 +18,7 @@
"aws-sdk-rust#858"
],
"since-commit": "88970ba88ef45266aade152c7c1da8e90b24c0d7",
"age": 2
"age": 5
},
{
"message": "Make some properties for IoT types optional. Previously, they defaulted to false, but that isn't how the service actual works.",
@ -60,7 +32,7 @@
"smithy-rs#3256"
],
"since-commit": "88970ba88ef45266aade152c7c1da8e90b24c0d7",
"age": 2
"age": 5
},
{
"message": "Fix `config::Builder::set_credentials_provider` to override a credentials provider previously set.",
@ -75,7 +47,7 @@
"smithy-rs#3278"
],
"since-commit": "529b3f03e2b945ea2e5e879183ccfd8e74b7377c",
"age": 1
"age": 4
},
{
"message": "`config::Config::credentials_provider` has been broken since `release-2023-11-15` and is now marked as `deprecated` explicitly.",
@ -90,7 +62,110 @@
"smithy-rs#3278"
],
"since-commit": "529b3f03e2b945ea2e5e879183ccfd8e74b7377c",
"age": 1
"age": 4
},
{
"message": "Loading native TLS trusted certs for the default HTTP client now only occurs if the default HTTP client is not overridden in config.",
"meta": {
"bug": true,
"breaking": false,
"tada": false
},
"author": "jdisanti",
"references": [
"smithy-rs#3262"
],
"since-commit": "fc335cbc87e70aa63895828fca55b51795b94a6c",
"age": 3
},
{
"message": "Client creation now takes microseconds instead of milliseconds.\nPreviously, it would take 2-3 milliseconds for each client instantiation due to time spent compiling regexes.\nFor applications that used several clients, this would increase start-up time in cases where it really matters,\nsuch as for AWS Lambda cold starts. This time was improved by both changing regex implementation and caching the\nresult of the compilation.",
"meta": {
"bug": false,
"breaking": false,
"tada": true
},
"author": "jdisanti",
"references": [
"aws-sdk-rust#975",
"smithy-rs#3269"
],
"since-commit": "fc335cbc87e70aa63895828fca55b51795b94a6c",
"age": 3
},
{
"message": "Add `test_credentials` to `ConfigLoader` in `aws_config`. This allows the following pattern during tests:\n\n```rust\nasync fn main() {\n let conf = aws_config::defaults(BehaviorVersion::latest())\n .test_credentials()\n .await;\n}\n```\n\nThis is designed for unit tests and using local mocks like DynamoDB Local and LocalStack with the SDK.\n",
"meta": {
"bug": false,
"breaking": false,
"tada": true
},
"author": "rcoh",
"references": [
"smithy-rs#3279",
"aws-sdk-rust#971"
],
"since-commit": "fc335cbc87e70aa63895828fca55b51795b94a6c",
"age": 3
},
{
"message": "Improve the error messages for when auth fails to select an auth scheme for a request.",
"meta": {
"bug": false,
"breaking": false,
"tada": false
},
"author": "jdisanti",
"references": [
"aws-sdk-rust#979",
"smithy-rs#3277"
],
"since-commit": "fc335cbc87e70aa63895828fca55b51795b94a6c",
"age": 3
},
{
"message": "Fix documentation and examples on HyperConnector and HyperClientBuilder.",
"meta": {
"bug": false,
"breaking": false,
"tada": false
},
"author": "jdisanti",
"references": [
"aws-sdk-rust#986",
"smithy-rs#3282"
],
"since-commit": "fc335cbc87e70aa63895828fca55b51795b94a6c",
"age": 3
},
{
"message": "All generated docs now include docsrs labels when features are required",
"meta": {
"bug": false,
"breaking": false,
"tada": true
},
"author": "rcoh",
"references": [
"smithy-rs#3121",
"smithy-rs#3295"
],
"since-commit": "fc335cbc87e70aa63895828fca55b51795b94a6c",
"age": 3
},
{
"message": "`crate::event_receiver::EventReceiver` is now re-exported as `crate::primitives::event_stream::EventReceiver` when a service supports event stream operations.",
"meta": {
"bug": true,
"breaking": false,
"tada": false
},
"author": "ysaito1001",
"references": [
"smithy-rs#3305"
],
"since-commit": "9f0ba850e03241f657e2e40ca185780e0a5878cb",
"age": 2
}
],
"aws-sdk-model": []

View File

@ -7,6 +7,8 @@ use async_stream::stream;
use aws_sdk_transcribestreaming::config::{Credentials, Region};
use aws_sdk_transcribestreaming::error::SdkError;
use aws_sdk_transcribestreaming::operation::start_stream_transcription::StartStreamTranscriptionOutput;
#[allow(unused)] // making sure `EventReceiver` is re-exported
use aws_sdk_transcribestreaming::primitives::event_stream::EventReceiver;
use aws_sdk_transcribestreaming::primitives::event_stream::{HeaderValue, Message};
use aws_sdk_transcribestreaming::primitives::Blob;
use aws_sdk_transcribestreaming::types::error::{AudioStreamError, TranscriptResultStreamError};

View File

@ -14,6 +14,7 @@ import software.amazon.smithy.rust.codegen.core.rustlang.rustTemplate
import software.amazon.smithy.rust.codegen.core.rustlang.writable
import software.amazon.smithy.rust.codegen.core.smithy.CodegenContext
import software.amazon.smithy.rust.codegen.core.smithy.RuntimeType
import software.amazon.smithy.rust.codegen.core.smithy.RuntimeType.Companion.eventReceiver
import software.amazon.smithy.rust.codegen.core.smithy.RustCrate
import software.amazon.smithy.rust.codegen.core.util.hasEventStreamMember
import software.amazon.smithy.rust.codegen.core.util.hasEventStreamOperations
@ -101,11 +102,13 @@ fun pubUseSmithyPrimitivesEventStream(
if (codegenContext.serviceShape.hasEventStreamOperations(model)) {
rustTemplate(
"""
pub use #{EventReceiver};
pub use #{Header};
pub use #{HeaderValue};
pub use #{Message};
pub use #{StrBytes};
""",
"EventReceiver" to eventReceiver(rc),
"Header" to RuntimeType.smithyTypes(rc).resolve("event_stream::Header"),
"HeaderValue" to RuntimeType.smithyTypes(rc).resolve("event_stream::HeaderValue"),
"Message" to RuntimeType.smithyTypes(rc).resolve("event_stream::Message"),

View File

@ -10,7 +10,6 @@ import software.amazon.smithy.model.Model
import software.amazon.smithy.rust.codegen.core.rustlang.RustWriter
import software.amazon.smithy.rust.codegen.core.smithy.CodegenContext
import software.amazon.smithy.rust.codegen.core.smithy.RustCrate
import software.amazon.smithy.rust.codegen.core.smithy.generators.StructureGeneratorTest.Companion.model
import software.amazon.smithy.rust.codegen.core.testutil.asSmithyModel
import software.amazon.smithy.rust.codegen.core.testutil.generatePluginContext
import software.amazon.smithy.rust.codegen.core.testutil.testCodegenContext
@ -25,6 +24,11 @@ class SmithyTypesPubUseExtraTest {
return """
namespace test
service TestService {
version: "123"
operations: [SomeOperation]
}
$additionalShape
structure SomeStruct {
}
@ -46,22 +50,23 @@ class SmithyTypesPubUseExtraTest {
""".asSmithyModel()
}
private val rustCrate: RustCrate
private val codegenContext: CodegenContext = testCodegenContext(model)
private fun initialize(model: Model): Pair<CodegenContext, RustCrate> {
val codegenContext = testCodegenContext(model)
init {
val (context, _) =
generatePluginContext(
model,
runtimeConfig = codegenContext.runtimeConfig,
)
rustCrate =
val rustCrate =
RustCrate(
context.fileManifest,
codegenContext.symbolProvider,
codegenContext.settings.codegenConfig,
codegenContext.expectModuleDocProvider(),
)
return Pair(codegenContext, rustCrate)
}
private fun reexportsWithEmptyModel() = reexportsWithMember()
@ -72,11 +77,12 @@ class SmithyTypesPubUseExtraTest {
unionMember: String = "",
additionalShape: String = "",
) = RustWriter.root().let { writer ->
pubUseSmithyPrimitives(
codegenContext,
modelWithMember(inputMember, outputMember, unionMember, additionalShape),
rustCrate,
)(writer)
val model = modelWithMember(inputMember, outputMember, unionMember, additionalShape)
val props = initialize(model)
val context = props.first
val rustCrate = props.second
pubUseSmithyPrimitives(context, model, rustCrate)(writer)
pubUseSmithyPrimitivesEventStream(context, model)(writer)
writer.toString()
}
@ -164,4 +170,26 @@ class SmithyTypesPubUseExtraTest {
streamingTypes,
)
}
@Test
fun `it re-exports when a model has event stream`() {
val eventStreamTypes =
listOf(
"crate::event_receiver::EventReceiver",
"::aws_smithy_types::event_stream::Header",
"::aws_smithy_types::event_stream::HeaderValue",
"::aws_smithy_types::event_stream::Message",
"::aws_smithy_types::str_bytes::StrBytes",
)
val eventStreamShape = "@streaming union EventStream { foo: SomeStruct }"
assertHasReexports(
reexportsWithMember(additionalShape = eventStreamShape, inputMember = "m: EventStream"),
eventStreamTypes,
)
assertHasReexports(
reexportsWithMember(additionalShape = eventStreamShape, outputMember = "m: EventStream"),
eventStreamTypes,
)
}
}

View File

@ -12,10 +12,10 @@ rust.msrv=1.72.1
org.gradle.jvmargs=-Xmx1024M
# Version number to use for the generated stable runtime crates
smithy.rs.runtime.crate.stable.version=1.0.3
smithy.rs.runtime.crate.stable.version=1.1.1
# Version number to use for the generated unstable runtime crates
smithy.rs.runtime.crate.unstable.version=0.60.0
smithy.rs.runtime.crate.unstable.version=0.60.1
kotlin.code.style=official

View File

@ -4,13 +4,14 @@
*/
use crate::fs::Fs;
use anyhow::{anyhow, bail, Context};
use anyhow::{anyhow, Context};
use clap::Parser;
use once_cell::sync::Lazy;
use regex::Regex;
use smithy_rs_tool_common::package::PackageStability;
use std::borrow::Cow;
use std::path::{Path, PathBuf};
use tracing::warn;
static STABLE_VERSION_REGEX: Lazy<Regex> = Lazy::new(|| {
Regex::new(
@ -104,7 +105,8 @@ fn update_gradle_properties<'a>(
// Special version tag used on the `main` branch
&& current_version != semver::Version::parse("0.0.0-smithy-rs-head").unwrap()
{
bail!("Moving from {current_version} to {upgraded_version} would be a *downgrade*. This command doesn't allow it!");
// NOTE: do not backport this change to mainline during merge.
warn!("Moving from {current_version} to {upgraded_version} is a *downgrade*.");
}
Ok(version_regex.replace(gradle_properties, format!("${{field}}{}", upgraded_version)))
}
@ -187,7 +189,9 @@ mod tests {
assert_eq!("smithy.rs.runtime.crate.stable.version=1.0.3", updated);
}
// ignored: we are temporarily removing this safeguard
#[test]
#[ignore]
fn downgrading_stable_crate_should_be_caught_as_err() {
let gradle_properties = "smithy.rs.runtime.crate.stable.version=1.0.2";
let version = semver::Version::new(1, 0, 1);
@ -197,7 +201,9 @@ mod tests {
assert!(format!("{:?}", result).contains("downgrade"));
}
// ignored: we are temporarily removing this safeguard
#[test]
#[ignore]
fn downgrading_unstable_crate_should_be_caught_as_err() {
let gradle_properties = "smithy.rs.runtime.crate.unstable.version=0.57.1";
let version = semver::Version::new(0, 57, 0);