-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Operations with an event stream member shape must have `ValidationExc…
…eption` (#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](#3813) --------- Co-authored-by: Fahad Zubair <[email protected]>
- Loading branch information
Showing
4 changed files
with
57 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
applies_to: ["server"] | ||
authors: ["drganjoo"] | ||
references: ["smithy-rs#3813"] | ||
breaking: true | ||
new_feature: false | ||
bug_fix: true | ||
--- | ||
Operations with event stream member shapes must include `ValidationException` in the errors list. This is necessary because the member shape is a required field, and the builder for the operation input or output returns a `std::result::Result` with the error set to `crate::model::ValidationExceptionField`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters