-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix error struct with default impl #3190
Conversation
@jdisanti let me know if I need to make any changes, pretty new to the code base 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking the time to do this! ❤️
Just a couple minor things.
@@ -27,6 +27,10 @@ structure Error { | |||
|
|||
@required | |||
message: String | |||
|
|||
code: String = "400" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for thinking to add a test!
It would be nice for this to get its own isolated test case though so that it doesn't get lost in the future.
Would you mind creating a ProtocolParserGeneratorTest.kt
file in src/test/kotlin/... same path as ProtocolParserGenerator .../
that tests this in isolation? Here's an example of how to do a client integration test that runs the full client code generator against a test model and verifies it compiles:
Line 12 in c4a14d7
class AwsQueryTest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure can, would you like me to also revert the changes made in the current file or should I leave that in?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, please revert.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done and done 😄
Motivation and Context
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
Adds recomendation change to address error structures with a default implementation like so:
Testing
Added the above and ran
./gradlew codegen-client-test:build
with a build successfulChecklist
CHANGELOG.next.toml
if I made changes to the smithy-rs codegen or runtime cratesCHANGELOG.next.toml
if I made changes to the AWS SDK, generated SDK code, or SDK runtime cratesBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.