Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: smithy-lang/smithy-rs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 5d5c5e3cb2c97216a73a5cb578a531e9e96d97e1
Choose a base ref
..
head repository: smithy-lang/smithy-rs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: a64277a86087bc8ba1f0a77debe015311869681a
Choose a head ref
Showing with 9,651 additions and 2,097 deletions.
  1. +125 −0 CHANGELOG.next.toml
  2. +3 −2 aws/rust-runtime/aws-config/external-types.toml
  3. +5 −2 aws/rust-runtime/aws-config/src/default_provider.rs
  4. +4 −4 aws/rust-runtime/aws-config/src/default_provider/retry_config.rs
  5. +86 −47 aws/rust-runtime/aws-config/src/ecs.rs
  6. +2 −0 aws/rust-runtime/aws-config/src/environment/mod.rs
  7. +24 −15 aws/rust-runtime/aws-config/src/environment/retry_config.rs
  8. +40 −220 aws/rust-runtime/aws-config/src/imds/client.rs
  9. +289 −0 aws/rust-runtime/aws-config/src/imds/client/error.rs
  10. +19 −19 aws/rust-runtime/aws-config/src/imds/client/token.rs
  11. +28 −9 aws/rust-runtime/aws-config/src/imds/credentials.rs
  12. +2 −2 aws/rust-runtime/aws-config/src/json_credentials.rs
  13. +17 −34 aws/rust-runtime/aws-config/src/lib.rs
  14. +5 −5 aws/rust-runtime/aws-config/src/meta/credentials/chain.rs
  15. +2 −1 aws/rust-runtime/aws-config/src/meta/mod.rs
  16. +1 −1 aws/rust-runtime/aws-config/src/profile/parser/parse.rs
  17. +13 −8 aws/rust-runtime/aws-config/src/profile/retry_config.rs
  18. +87 −0 aws/rust-runtime/aws-config/src/retry.rs
  19. +11 −0 aws/rust-runtime/aws-config/src/timeout.rs
  20. +2 −1 aws/rust-runtime/aws-config/src/web_identity_token.rs
  21. +1 −1 aws/rust-runtime/aws-config/test-data/default-provider-chain/imds_default_chain_error/test-case.json
  22. +1 −1 aws/rust-runtime/aws-config/test-data/default-provider-chain/imds_disabled/test-case.json
  23. +1 −1 aws/rust-runtime/aws-config/test-data/default-provider-chain/imds_no_iam_role/test-case.json
  24. +1 −1 aws/rust-runtime/aws-config/test-data/default-provider-chain/imds_token_fail/test-case.json
  25. +1 −1 aws/rust-runtime/aws-config/test-data/profile-provider/credential_process_failure/test-case.json
  26. +1 −1 aws/rust-runtime/aws-config/test-data/profile-provider/empty_config/test-case.json
  27. +35 −14 aws/rust-runtime/aws-endpoint/src/lib.rs
  28. +1 −1 aws/rust-runtime/aws-endpoint/src/partition/endpoint.rs
  29. +1 −1 aws/rust-runtime/aws-endpoint/src/partition/mod.rs
  30. +14 −20 aws/rust-runtime/aws-http/src/auth.rs
  31. +31 −9 aws/rust-runtime/aws-http/src/user_agent.rs
  32. +18 −8 aws/rust-runtime/aws-inlineable/src/presigning.rs
  33. +50 −32 aws/rust-runtime/aws-sig-auth/src/middleware.rs
  34. +1 −1 aws/rust-runtime/aws-types/external-types.toml
  35. +2 −1 aws/rust-runtime/aws-types/src/credentials/mod.rs
  36. +140 −114 aws/rust-runtime/aws-types/src/credentials/provider.rs
  37. +11 −6 aws/rust-runtime/aws-types/src/endpoint.rs
  38. +4 −2 aws/rust-runtime/aws-types/src/sdk_config.rs
  39. +5 −3 aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsEndpointDecorator.kt
  40. +2 −2 aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/customize/s3/S3Decorator.kt
  41. +2 −6 aws/sdk/integration-tests/dynamodb/tests/endpoints.rs
  42. +3 −3 aws/sdk/integration-tests/s3/tests/streaming-response.rs
  43. +10 −7 aws/sdk/integration-tests/s3/tests/timeouts.rs
  44. +14 −0 ...rc/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/ClientInstantiator.kt
  45. +2 −2 .../kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/HttpBoundProtocolGenerator.kt
  46. +453 −0 codegen-core/common-test-models/constraints.smithy
  47. +4 −1 codegen-core/common-test-models/misc.smithy
  48. +5 −1 codegen-core/common-test-models/naming-obstacle-course-ops.smithy
  49. +3 −1 codegen-core/common-test-models/pokemon-common.smithy
  50. +4 −4 codegen-core/common-test-models/pokemon.smithy
  51. +8 −2 codegen-core/common-test-models/rest-json-extras.smithy
  52. +3 −1 codegen-core/common-test-models/simple.smithy
  53. +3 −0 codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/rustlang/CargoDependency.kt
  54. +8 −0 codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/rustlang/RustType.kt
  55. +19 −0 codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/CodegenDelegator.kt
  56. +5 −0 codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/RuntimeType.kt
  57. +84 −33 codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/SymbolVisitor.kt
  58. +29 −1 ...re/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/BuilderGenerator.kt
  59. +2 −2 ...-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/EnumGenerator.kt
  60. +24 −4 ...n-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/Instantiator.kt
  61. +2 −19 .../src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/StructureGenerator.kt
  62. +22 −3 ...rc/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/error/ErrorGenerator.kt
  63. +90 −36 ...in/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/http/HttpBindingGenerator.kt
  64. +9 −2 ...kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/http/RequestBindingGenerator.kt
  65. +10 −2 ...otlin/software/amazon/smithy/rust/codegen/core/smithy/generators/http/ResponseBindingGenerator.kt
  66. +2 −0 ...lin/software/amazon/smithy/rust/codegen/core/smithy/generators/protocol/MakeOperationGenerator.kt
  67. +10 −3 codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/AwsJson.kt
  68. +11 −5 codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/AwsQuery.kt
  69. +11 −5 codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/Ec2Query.kt
  70. +8 −3 codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/RestJson.kt
  71. +9 −4 codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/RestXml.kt
  72. +9 −5 ...kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/parse/AwsQueryParserGenerator.kt
  73. +6 −2 ...kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/parse/Ec2QueryParserGenerator.kt
  74. +52 −46 ...ftware/amazon/smithy/rust/codegen/core/smithy/protocols/parse/EventStreamUnmarshallerGenerator.kt
  75. +114 −63 ...ain/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/parse/JsonParserGenerator.kt
  76. +6 −2 .../kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/parse/RestXmlParserGenerator.kt
  77. +3 −3 .../software/amazon/smithy/rust/codegen/core/smithy/protocols/parse/StructuredDataParserGenerator.kt
  78. +38 −37 ...software/amazon/smithy/rust/codegen/core/smithy/protocols/parse/XmlBindingTraitParserGenerator.kt
  79. +22 −21 ...in/software/amazon/smithy/rust/codegen/core/smithy/protocols/serialize/JsonSerializerGenerator.kt
  80. +10 −3 .../amazon/smithy/rust/codegen/core/smithy/protocols/serialize/XmlBindingTraitSerializerGenerator.kt
  81. +58 −24 ...re/src/test/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/InstantiatorTest.kt
  82. +6 −1 ...in/software/amazon/smithy/rust/codegen/core/smithy/protocols/parse/AwsQueryParserGeneratorTest.kt
  83. +6 −1 ...in/software/amazon/smithy/rust/codegen/core/smithy/protocols/parse/Ec2QueryParserGeneratorTest.kt
  84. +6 −0 ...kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/parse/JsonParserGeneratorTest.kt
  85. +2 −0 ...ware/amazon/smithy/rust/codegen/core/smithy/protocols/parse/XmlBindingTraitParserGeneratorTest.kt
  86. +14 −2 codegen-server-test/build.gradle.kts
  87. +7 −3 ...main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/PythonCodegenServerPlugin.kt
  88. +43 −20 ...ain/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/PythonServerCodegenVisitor.kt
  89. +4 −15 .../software/amazon/smithy/rust/codegen/server/python/smithy/generators/PythonServerEnumGenerator.kt
  90. +109 −0 ...c/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/ConstrainedShapeSymbolProvider.kt
  91. +123 −0 ...ain/kotlin/software/amazon/smithy/rust/codegen/server/smithy/ConstraintViolationSymbolProvider.kt
  92. +133 −0 codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/Constraints.kt
  93. +21 −0 ...ain/kotlin/software/amazon/smithy/rust/codegen/server/smithy/LengthTraitValidationErrorMessage.kt
  94. +124 −0 ...otlin/software/amazon/smithy/rust/codegen/server/smithy/PubCrateConstrainedShapeSymbolProvider.kt
  95. +37 −0 ...in/software/amazon/smithy/rust/codegen/server/smithy/PubCrateConstraintViolationSymbolProvider.kt
  96. +12 −9 ...rver/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/RustCodegenServerPlugin.kt
  97. +4 −0 ...-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/ServerCodegenContext.kt
  98. +227 −22 ...-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/ServerCodegenVisitor.kt
  99. +0 −3 ...gen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/ServerRuntimeType.kt
  100. +22 −7 ...en-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/ServerRustSettings.kt
  101. +65 −0 ...server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/ServerSymbolProviders.kt
  102. +166 −0 ...main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/UnconstrainedShapeSymbolProvider.kt
  103. +248 −0 ...c/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/ValidateUnsupportedConstraints.kt
  104. +38 −0 ...mazon/smithy/rust/codegen/server/smithy/customizations/BeforeIteratingOverMapJsonCustomization.kt
  105. +160 −0 ...in/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ConstrainedMapGenerator.kt
  106. +22 −0 ...lin/software/amazon/smithy/rust/codegen/server/smithy/generators/ConstrainedMapGeneratorCommon.kt
  107. +24 −0 ...n/software/amazon/smithy/rust/codegen/server/smithy/generators/ConstrainedShapeGeneratorCommon.kt
  108. +183 −0 ...kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ConstrainedStringGenerator.kt
  109. +51 −0 .../software/amazon/smithy/rust/codegen/server/smithy/generators/ConstrainedTraitForEnumGenerator.kt
  110. +121 −0 ...n/software/amazon/smithy/rust/codegen/server/smithy/generators/MapConstraintViolationGenerator.kt
  111. +148 −0 ...are/amazon/smithy/rust/codegen/server/smithy/generators/PubCrateConstrainedCollectionGenerator.kt
  112. +142 −0 ...n/software/amazon/smithy/rust/codegen/server/smithy/generators/PubCrateConstrainedMapGenerator.kt
  113. +218 −0 ...software/amazon/smithy/rust/codegen/server/smithy/generators/ServerBuilderConstraintViolations.kt
  114. +542 −0 ...ain/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerBuilderGenerator.kt
  115. +238 −0 ...ithy/rust/codegen/server/smithy/generators/ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt
  116. +35 −0 ...c/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerBuilderSymbol.kt
  117. +69 −39 ...c/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerEnumGenerator.kt
  118. +23 −0 ...rc/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerInstantiator.kt
  119. +2 −1 ...n/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerOperationGenerator.kt
  120. +5 −0 ...n/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerServiceGeneratorV2.kt
  121. +32 −0 ...ftware/amazon/smithy/rust/codegen/server/smithy/generators/ServerStructureConstrainedTraitImpl.kt
  122. +139 −0 .../software/amazon/smithy/rust/codegen/server/smithy/generators/UnconstrainedCollectionGenerator.kt
  123. +207 −0 .../kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/UnconstrainedMapGenerator.kt
  124. +248 −0 ...otlin/software/amazon/smithy/rust/codegen/server/smithy/generators/UnconstrainedUnionGenerator.kt
  125. +50 −3 ...oftware/amazon/smithy/rust/codegen/server/smithy/generators/http/ServerRequestBindingGenerator.kt
  126. +49 −3 ...ftware/amazon/smithy/rust/codegen/server/smithy/generators/http/ServerResponseBindingGenerator.kt
  127. +89 −7 ...in/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/protocol/ServerProtocol.kt
  128. +7 −31 ...tware/amazon/smithy/rust/codegen/server/smithy/generators/protocol/ServerProtocolTestGenerator.kt
  129. +8 −8 ...rver/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/protocols/ServerAwsJson.kt
  130. +129 −96 ...n/software/amazon/smithy/rust/codegen/server/smithy/protocols/ServerHttpBoundProtocolGenerator.kt
  131. +17 −0 ...amazon/smithy/rust/codegen/server/smithy/protocols/{ServerRestJsonFactory.kt → ServerRestJson.kt}
  132. +59 −15 ...r/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/testutil/ServerTestHelpers.kt
  133. +42 −0 ...tware/amazon/smithy/rust/codegen/server/smithy/traits/ShapeReachableFromOperationInputTagTrait.kt
  134. +74 −0 ...en/server/smithy/transformers/AttachValidationExceptionToConstrainedOperationInputsInAllowList.kt
  135. +38 −0 ...ftware/amazon/smithy/rust/codegen/server/smithy/transformers/RemoveEbsModelValidationException.kt
  136. +72 −0 .../amazon/smithy/rust/codegen/server/smithy/transformers/ShapesReachableFromOperationInputTagger.kt
  137. +98 −0 ...st/kotlin/software/amazon/smithy/rust/codegen/server/smithy/ConstrainedShapeSymbolProviderTest.kt
  138. +135 −0 codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/ConstraintsTest.kt
  139. +113 −0 ...n/software/amazon/smithy/rust/codegen/server/smithy/PubCrateConstrainedShapeSymbolProviderTest.kt
  140. +103 −0 .../kotlin/software/amazon/smithy/rust/codegen/server/smithy/UnconstrainedShapeSymbolProviderTest.kt
  141. +254 −0 ...software/amazon/smithy/rust/codegen/server/smithy/ValidateUnsupportedConstraintsAreNotUsedTest.kt
  142. +158 −0 ...otlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ConstrainedMapGeneratorTest.kt
  143. +179 −0 ...in/software/amazon/smithy/rust/codegen/server/smithy/generators/ConstrainedStringGeneratorTest.kt
  144. +9 −6 .../software/amazon/smithy/rust/codegen/server/smithy/generators/ServerCombinedErrorGeneratorTest.kt
  145. +9 −19 ...st/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerEnumGeneratorTest.kt
  146. +4 −5 ...est/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerInstantiatorTest.kt
  147. +124 −0 ...tware/amazon/smithy/rust/codegen/server/smithy/generators/UnconstrainedCollectionGeneratorTest.kt
  148. +164 −0 ...lin/software/amazon/smithy/rust/codegen/server/smithy/generators/UnconstrainedMapGeneratorTest.kt
  149. +102 −0 ...n/software/amazon/smithy/rust/codegen/server/smithy/generators/UnconstrainedUnionGeneratorTest.kt
  150. +5 −1 ...c/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/protocols/EventStreamTestTools.kt
  151. +6 −5 .../amazon/smithy/rust/codegen/server/smithy/protocols/parse/EventStreamUnmarshallerGeneratorTest.kt
  152. +14 −11 rust-runtime/aws-smithy-async/src/future/timeout.rs
  153. +2 −1 rust-runtime/aws-smithy-http-server/Cargo.toml
  154. +4 −0 rust-runtime/aws-smithy-http-server/examples/pokemon-service/Cargo.toml
  155. +74 −0 rust-runtime/aws-smithy-http-server/examples/pokemon-service/src/bin/pokemon-service-connect-info.rs
  156. +11 −8 rust-runtime/aws-smithy-http-server/examples/pokemon-service/src/lib.rs
  157. +8 −12 rust-runtime/aws-smithy-http-server/src/rejection.rs
  158. +163 −0 rust-runtime/aws-smithy-http-server/src/routing/into_make_service_with_connect_info.rs
  159. +17 −1 rust-runtime/aws-smithy-http-server/src/routing/mod.rs
  160. +53 −17 rust-runtime/aws-smithy-http-server/src/runtime_error.rs
  161. +144 −124 rust-runtime/aws-smithy-json/src/deserialize.rs
  162. +82 −36 rust-runtime/aws-smithy-json/src/deserialize/error.rs
  163. +119 −130 rust-runtime/aws-smithy-json/src/deserialize/token.rs
  164. +41 −23 rust-runtime/aws-smithy-json/src/escape.rs
  165. +47 −24 rust-runtime/aws-smithy-types-convert/src/date_time.rs
  166. +8 −7 rust-runtime/aws-smithy-types/src/base64.rs
  167. +102 −55 rust-runtime/aws-smithy-types/src/date_time/format.rs
  168. +2 −3 rust-runtime/aws-smithy-types/src/date_time/mod.rs
  169. +85 −3 rust-runtime/aws-smithy-types/src/error.rs
  170. +73 −88 rust-runtime/aws-smithy-types/src/lib.rs
  171. +11 −10 rust-runtime/aws-smithy-types/src/primitive.rs
  172. +31 −88 rust-runtime/aws-smithy-types/src/retry.rs
  173. +3 −0 rust-runtime/aws-smithy-types/src/{timeout/config.rs → timeout.rs}
  174. +0 −64 rust-runtime/aws-smithy-types/src/timeout/error.rs
  175. +0 −13 rust-runtime/aws-smithy-types/src/timeout/mod.rs
  176. +51 −25 rust-runtime/aws-smithy-xml/src/decode.rs
  177. +7 −3 rust-runtime/aws-smithy-xml/src/encode.rs
  178. +14 −20 rust-runtime/aws-smithy-xml/src/unescape.rs
  179. +12 −12 rust-runtime/aws-smithy-xml/tests/handwritten_parsers.rs
  180. +5 −8 rust-runtime/aws-smithy-xml/tests/handwritten_serializers.rs
  181. +15 −0 rust-runtime/inlineable/src/constrained.rs
  182. +9 −7 rust-runtime/inlineable/src/ec2_query_errors.rs
  183. +27 −23 rust-runtime/inlineable/src/endpoint_lib/partition.rs
  184. +1 −1 rust-runtime/inlineable/src/json_errors.rs
  185. +2 −0 rust-runtime/inlineable/src/lib.rs
  186. +7 −5 rust-runtime/inlineable/src/rest_xml_unwrapped_errors.rs
  187. +11 −7 rust-runtime/inlineable/src/rest_xml_wrapped_errors.rs
125 changes: 125 additions & 0 deletions CHANGELOG.next.toml
Original file line number Diff line number Diff line change
@@ -214,3 +214,128 @@ message = "Several breaking changes have been made to errors. See [the upgrade g
references = ["smithy-rs#1926", "smithy-rs#1819"]
meta = { "breaking" = true, "tada" = false, "bug" = false }
author = "jdisanti"

[[smithy-rs]]
message = """
[Constraint traits](https://awslabs.github.io/smithy/2.0/spec/constraint-traits.html) in server SDKs are beginning to be supported. The following are now supported:
* The `length` trait on `string` shapes.
* The `length` trait on `map` shapes.
Upon receiving a request that violates the modeled constraints, the server SDK will reject it with a message indicating why.
Unsupported (constraint trait, target shape) combinations will now fail at code generation time, whereas previously they were just ignored. This is a breaking change to raise awareness in service owners of their server SDKs behaving differently than what was modeled. To continue generating a server SDK with unsupported constraint traits, set `codegenConfig.ignoreUnsupportedConstraints` to `true` in your `smithy-build.json`.
"""
references = ["smithy-rs#1199", "smithy-rs#1342", "smithy-rs#1401"]
meta = { "breaking" = true, "tada" = true, "bug" = false, "target" = "server" }
author = "david-perez"

[[smithy-rs]]
message = """
Server SDKs now generate "constrained types" for constrained shapes. Constrained types are [newtypes](https://rust-unofficial.github.io/patterns/patterns/behavioural/newtype.html) that encapsulate the modeled constraints. They constitute a [widespread pattern to guarantee domain invariants](https://www.lpalmieri.com/posts/2020-12-11-zero-to-production-6-domain-modelling/) and promote correctness in your business logic. So, for example, the model:
```smithy
@length(min: 1, max: 69)
string NiceString
```
will now render a `struct NiceString(String)`. Instantiating a `NiceString` is a fallible operation:
```rust
let data: String = ... ;
let nice_string = NiceString::try_from(data).expect("data is not nice");
```
A failed attempt to instantiate a constrained type will yield a `ConstraintViolation` error type you may want to handle. This type's API is subject to change.
Constrained types _guarantee_, by virtue of the type system, that your service's operation outputs adhere to the modeled constraints. To learn more about the motivation for constrained types and how they work, see [the RFC](https://github.com/awslabs/smithy-rs/pull/1199).
If you'd like to opt-out of generating constrained types, you can set `codegenConfig.publicConstrainedTypes` to `false`. Note that if you do, the generated server SDK will still honor your operation input's modeled constraints upon receiving a request, but will not help you in writing business logic code that adheres to the constraints, and _will not prevent you from returning responses containing operation outputs that violate said constraints_.
"""
references = ["smithy-rs#1342", "smithy-rs#1119"]
meta = { "breaking" = true, "tada" = true, "bug" = false, "target" = "server" }
author = "david-perez"

[[smithy-rs]]
message = """
Structure builders in server SDKs have undergone significant changes.
The API surface has been reduced. It is now simpler and closely follows what you would get when using the [`derive_builder`](https://docs.rs/derive_builder/latest/derive_builder/) crate:
1. Builders no longer have `set_*` methods taking in `Option<T>`. You must use the unprefixed method, named exactly after the structure's field name, and taking in a value _whose type matches exactly that of the structure's field_.
2. Builders no longer have convenience methods to pass in an element for a field whose type is a vector or a map. You must pass in the entire contents of the collection up front.
3. Builders no longer implement [`PartialEq`](https://doc.rust-lang.org/std/cmp/trait.PartialEq.html).
Bug fixes:
4. Builders now always fail to build if a value for a `required` member is not provided. Previously, builders were falling back to a default value (e.g. `""` for `String`s) for some shapes. This was a bug.
Additions:
5. A structure `Structure` with builder `Builder` now implements `TryFrom<Builder> for Structure` or `From<Builder> for Structure`, depending on whether the structure [is constrained](https://awslabs.github.io/smithy/2.0/spec/constraint-traits.html) or not, respectively.
To illustrate how to migrate to the new API, consider the example model below.
```smithy
structure Pokemon {
@required
name: String,
@required
description: String,
@required
evolvesTo: PokemonList
}
list PokemonList {
member: Pokemon
}
```
In the Rust code below, note the references calling out the changes described in the numbered list above.
Before:
```rust
let eevee_builder = Pokemon::builder()
// (1) `set_description` takes in `Some<String>`.
.set_description(Some("Su código genético es muy inestable. Puede evolucionar en diversas razas de Pokémon.".to_owned()))
// (2) Convenience method to add one element to the `evolvesTo` list.
.evolves_to(vaporeon)
.evolves_to(jolteon)
.evolves_to(flareon);
// (3) Builder types can be compared.
assert_ne!(eevee_builder, Pokemon::builder());
// (4) Builds fine even though we didn't provide a value for `name`, which is `required`!
let _eevee = eevee_builder.build();
```
After:
```rust
let eevee_builder = Pokemon::builder()
// (1) `set_description` no longer exists. Use `description`, which directly takes in `String`.
.description("Su código genético es muy inestable. Puede evolucionar en diversas razas de Pokémon.".to_owned())
// (2) Convenience methods removed; provide the entire collection up front.
.evolves_to(vec![vaporeon, jolteon, flareon]);
// (3) Binary operation `==` cannot be applied to `pokemon::Builder`.
// assert_ne!(eevee_builder, Pokemon::builder());
// (4) `required` member `name` was not set.
// (5) Builder type can be fallibly converted to the structure using `TryFrom` or `TryInto`.
let _error = Pokemon::try_from(eevee_builder).expect_err("name was not provided");
```
"""
references = ["smithy-rs#1714", "smithy-rs#1342"]
meta = { "breaking" = true, "tada" = true, "bug" = true, "target" = "server" }
author = "david-perez"

[[smithy-rs]]
message = """
Server SDKs now correctly reject operation inputs that don't set values for `required` structure members. Previously, in some scenarios, server SDKs would accept the request and set a default value for the member (e.g. `""` for a `String`), even when the member shape did not have [Smithy IDL v2's `default` trait](https://awslabs.github.io/smithy/2.0/spec/type-refinement-traits.html#smithy-api-default-trait) attached. The `default` trait is [still unsupported](https://github.com/awslabs/smithy-rs/issues/1860).
"""
references = ["smithy-rs#1714", "smithy-rs#1342", "smithy-rs#1860"]
meta = { "breaking" = true, "tada" = false, "bug" = true, "target" = "server" }
author = "david-perez"
5 changes: 3 additions & 2 deletions aws/rust-runtime/aws-config/external-types.toml
Original file line number Diff line number Diff line change
@@ -16,8 +16,9 @@ allowed_external_types = [
"aws_smithy_types::retry",
"aws_smithy_types::retry::*",
"aws_smithy_types::timeout",
"aws_smithy_types::timeout::config::TimeoutConfig",
"aws_smithy_types::timeout::error::ConfigError",
"aws_smithy_types::timeout::OperationTimeoutConfig",
"aws_smithy_types::timeout::TimeoutConfig",
"aws_smithy_types::timeout::TimeoutConfigBuilder",
"aws_types::*",
"http::response::Response",
"http::uri::Uri",
7 changes: 5 additions & 2 deletions aws/rust-runtime/aws-config/src/default_provider.rs
Original file line number Diff line number Diff line change
@@ -3,8 +3,11 @@
* SPDX-License-Identifier: Apache-2.0
*/

//! Default Provider chains for [`region`](default_provider::region), [`credentials`](default_provider::credentials),
//! [retries](default_provider::retry_config), [timeouts](default_provider::timeout_config) and [app name](default_provider::app_name).
//! Providers that implement the default AWS provider chain
//!
//! Default Provider chains for [`region`](crate::default_provider::region), [`credentials`](crate::default_provider::credentials),
//! [retries](crate::default_provider::retry_config), [timeouts](crate::default_provider::timeout_config) and
//! [app name](crate::default_provider::app_name).
//!
//! Typically, this module is used via [`load_from_env`](crate::load_from_env) or [`from_env`](crate::from_env). It should only be used directly
//! if you need to set custom configuration options to override the default resolution chain.
Original file line number Diff line number Diff line change
@@ -3,11 +3,11 @@
* SPDX-License-Identifier: Apache-2.0
*/

use aws_smithy_types::retry::RetryConfig;

use crate::environment::retry_config::EnvironmentVariableRetryConfigProvider;
use crate::profile;
use crate::provider_config::ProviderConfig;
use aws_smithy_types::error::display::DisplayErrorContext;
use aws_smithy_types::retry::RetryConfig;

/// Default RetryConfig Provider chain
///
@@ -90,11 +90,11 @@ impl Builder {
// We match this instead of unwrapping so we can print the error with the `Display` impl instead of the `Debug` impl that unwrap uses
let builder_from_env = match self.env_provider.retry_config_builder() {
Ok(retry_config_builder) => retry_config_builder,
Err(err) => panic!("{}", err),
Err(err) => panic!("{}", DisplayErrorContext(&err)),
};
let builder_from_profile = match self.profile_file.build().retry_config_builder().await {
Ok(retry_config_builder) => retry_config_builder,
Err(err) => panic!("{}", err),
Err(err) => panic!("{}", DisplayErrorContext(&err)),
};

builder_from_env
Loading