Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix error struct with default impl (#3190)
## Motivation and Context <!--- Why is this change required? What problem does it solve? --> <!--- If it fixes an open issue, please link to the issue here --> When an error member has a default value, it will generate errors (specifically is_none not found on type String) with smithy-rs client unless you manually specify @required More Here: #3182 ## Description <!--- Describe your changes in detail --> Adds recomendation change to address error structures with a default implementation like so: ```kotlin if (errorMessageMember != null) { val symbol = symbolProvider.toSymbol(errorMessageMember) if (symbol.isOptional()) { rust( """ if tmp.message.is_none() { tmp.message = _error_message; } """, ) } } ..... ``` ```smithy @error("client") structure Error { @required requestId: String @required message: String code: String = "400" context: String } ``` ## Testing <!--- Please describe in detail how you tested your changes --> <!--- Include details of your testing environment, and the tests you ran to --> <!--- see how your change affects other areas of the code, etc. --> Added the above and ran `./gradlew codegen-client-test:build` with a build successful ## Checklist <!--- If a checkbox below is not applicable, then please DELETE it rather than leaving it unchecked --> - [x] I have updated `CHANGELOG.next.toml` if I made changes to the smithy-rs codegen or runtime crates - [ ] I have updated `CHANGELOG.next.toml` if I made changes to the AWS SDK, generated SDK code, or SDK runtime crates ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._ --------- Co-authored-by: John DiSanti <[email protected]>
- Loading branch information