smithy-rs/codegen-server
Fahad Zubair 2c3a4c1564
Operations with an event stream member shape must have `ValidationException` (#3814)
This PR addresses an issue where, if an operation's input includes an
event streaming member, the builder for the operation input or output
may raise a `ConstraintViolation` when `build_enforcing_all_constraints`
is called and the event streaming member field is not set. This occurs
because the member shape is required.

The standard error message that is shown when `ValidationException` is
not attached to an operation is also displayed in this case:

*Operation test#TestOperation takes in input that is constrained
(https://awslabs.github.io/smithy/2.0/spec/constraint-traits.html), and
as such can fail with a validation exception. You must model this
behavior in the operation shape in your model file.*

```smithy
use smithy.framework#ValidationException

operation TestOperation {
    ...
    errors: [..., ValidationException] // <-- Add this.
}
```
Closes: [3813](https://github.com/smithy-lang/smithy-rs/issues/3813)

---------

Co-authored-by: Fahad Zubair <fahadzub@amazon.com>
2024-09-04 15:05:23 +00:00
..
python Add server RPC v2 CBOR support (#2544) 2024-07-17 09:50:52 +00:00
src Operations with an event stream member shape must have `ValidationException` (#3814) 2024-09-04 15:05:23 +00:00
typescript Fix the build against JDK 20 (#3323) 2023-12-15 16:18:36 +00:00
README.md Fix Server README to remove stale warning on unstable good generation (#3658) 2024-06-11 09:34:05 +00:00
build.gradle.kts Add server RPC v2 CBOR support (#2544) 2024-07-17 09:50:52 +00:00

README.md

Smithy Rust Server Generator

Server-side Smithy code generator

Design documentation

Project Layout

  • codegen-server: Server-side code generation.
  • codegen-server-test: Server-side Smithy test and validation generation. Common commands:
    • ./gradlew :codegen-server-test:test Generate code and run tests against it