fix(smithy-aws-core): omit Result wrapper for empty awsQuery output#714
Open
Alan4506 wants to merge 2 commits into
Open
fix(smithy-aws-core): omit Result wrapper for empty awsQuery output#714Alan4506 wants to merge 2 commits into
Alan4506 wants to merge 2 commits into
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem:
The awsQuery protocol returns XML responses wrapped in two layers: an outer
<{OperationName}Response>element, and inside it an<{OperationName}Result>element and a<ResponseMetadata>element. For example, Amazon SNSCreateTopicreturns:To deserialize this,
AwsQueryClientProtocol._response_wrapper_elementstells the XML deserializer to descend through both wrapper elements before reading members. The current implementation always returns both:The problem is that some operations' output shapes do not have members, so they do not get a
<{OperationName}Result>element from the service. The response body contains only<ResponseMetadata>inside the outer wrapper. Requiring<{OperationName}Result>then fails.This was found while testing Amazon SNS
SetTopicAttributesandDeleteTopicoperations. For example:The call failed with:
Description of changes:
In
_response_wrapper_elements, only include the<{OperationName}Result>wrapper when the operation's output shape has members. Operations with empty output are unwrapped using just the outer<{OperationName}Response>. The return type is changed fromtuple[str, str]totuple[str, ...]since it now returns either one or two wrapper names.Testing:
tests/unit/aio/test_protocols.pythat deserializes an empty-output awsQuery response, and asserts it returns the output shape instead of raising.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.