Skip to content

Commit

Permalink
Merge branch 'main' into jdisanti-reduce-image-rebuilds
Browse files Browse the repository at this point in the history
  • Loading branch information
rcoh authored Feb 1, 2023
2 parents 9bfb88b + 7a0bcc2 commit 7e2684d
Show file tree
Hide file tree
Showing 17 changed files with 621 additions and 286 deletions.
28 changes: 26 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,19 @@ December 12th, 2022

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`.
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 `codegen.ignoreUnsupportedConstraints` to `true` in your `smithy-build.json`.

```json
{
...
"rust-server-codegen": {
...
"codegen": {
"ignoreUnsupportedConstraints": true
}
}
}
```
- ⚠🎉 (server, [smithy-rs#1342](https://github.com/awslabs/smithy-rs/issues/1342), [smithy-rs#1119](https://github.com/awslabs/smithy-rs/issues/1119)) 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
Expand All @@ -84,7 +96,19 @@ December 12th, 2022

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_.
If you'd like to opt-out of generating constrained types, you can set `codegen.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_.

```json
{
...
"rust-server-codegen": {
...
"codegen": {
"publicConstrainedTypes": false
}
}
}
```
- 🐛⚠🎉 (server, [smithy-rs#1714](https://github.com/awslabs/smithy-rs/issues/1714), [smithy-rs#1342](https://github.com/awslabs/smithy-rs/issues/1342)) 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:
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.next.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,9 @@ let result = cache
references = ["smithy-rs#2246"]
meta = { "breaking" = false, "tada" = false, "bug" = false }
author = "ysaito1001"

[[smithy-rs]]
message = "The [`@uniqueItems`](https://smithy.io/2.0/spec/constraint-traits.html#uniqueitems-trait) trait on `list` shapes is now supported in server SDKs."
references = ["smithy-rs#2232", "smithy-rs#1670"]
meta = { "breaking" = false, "tada" = true, "bug" = false, "target" = "server"}
author = "david-perez"
Loading

0 comments on commit 7e2684d

Please sign in to comment.