Skip to content
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

Customize S3's GetBucketLocation call to correctly parse the response #516

Merged
merged 3 commits into from
Jun 18, 2021

Conversation

jdisanti
Copy link
Collaborator

This PR adds a custom Smithy trait to customize the XML deserialization codegen for S3's GetBucketLocation call to fix aws-sdk-rust#116.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@jdisanti jdisanti force-pushed the customize-get-bucket-location branch from f44ee33 to e622f8a Compare June 18, 2021 00:01
@rcoh
Copy link
Collaborator

rcoh commented Jun 18, 2021

Full review coming tomorrow–instead of adding it as an integration test, add it to s3-tests.smithy. that will make it easier to upstream

Copy link
Collaborator

@rcoh rcoh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (although see one question inline)! stoked that this came out so concise.

writeOperationWrapper(context) { tagName ->
parseStructureInner(members, builder = "builder", Ctx(tag = tagName, accum = null))
if (outputShape.hasTrait<S3UnwrappedXmlOutputTrait>()) {
unwrappedResponseParser("builder", "decoder", "start_el", outputShape.members())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason you didn't just call parseStructureInner here? You could still validate the one member constraint here if you wanted

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, parseStructInner calls parseLoop which advances to the next tag (which won't exist in this case).

@jdisanti jdisanti merged commit 8075c77 into smithy-lang:main Jun 18, 2021
@jdisanti jdisanti deleted the customize-get-bucket-location branch June 18, 2021 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants