fix ListBuckets tag order #8329
Merged
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.
This PR fixes #8325
This bug seemed really weird, as our response was exactly the same as AWS, format was the same.
However, after trying to debug the issue in Java, it seemed the
Owner
field was properly parsed by the SDK.After looking at the code of the SDK, it seemed the order of the XML tag was important for the way they populate each bucket with the owner. Basically, if the Owner tag is second, they first populate every bucket with an empty owner, even though the owner was properly parsed at the end. (I'll put the Java code snippet from the SDK at the end of the PR).
We keep the order from the specs when we serialize the response: we use and iterate over the shapes members.
In the specs,
Buckets
is first andOwner
is second. The trick is to removeBuckets
from the specs and add it back, to put it as the last member. Dirty, but it works.I could test the fix in the
localstack-java-utils
repo, by adding a test case inS3FeaturesTest
.I've also added an integration test that is AWS validated to keep the order.
SDK snippet: