-
Notifications
You must be signed in to change notification settings - Fork 618
chore: assert deserialized types are correct #2515
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
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2515 +/- ##
=======================================
Coverage ? 59.64%
=======================================
Files ? 495
Lines ? 26361
Branches ? 6210
=======================================
Hits ? 15724
Misses ? 10637
Partials ? 0 Continue to review full report at Codecov.
|
@@ -1165,7 +1168,7 @@ export const deserializeAws_restJson1CreateAccessPreviewCommand = async ( | |||
}; | |||
const data: any = await parseBody(output.body, context); | |||
if (data.id !== undefined && data.id !== null) { |
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.
Don't know how the generator is structured, but we should be able to remove this wrapping if
function that appears a lot as well. (Though I wouldn't block on it)
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.
This is probably due to differences with handling of top-level members.
bdea0fe
to
5d8a7dd
Compare
This adds a few methods to assert that a type is the expected type before returning it. This is useful to make sure that we aren't blindly returning json that is invalid.
5d8a7dd
to
4ca9735
Compare
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread. |
Issue
n/a
Description
This adds expectations for the default member deserialization so that an error will be thrown if the type being deserialized isn't correct.
Testing
Tests were added.
Additional context
See smithy-lang/smithy-typescript#365 for the other half of this
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.