-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Customize S3's GetBucketLocation call to correctly parse the response (…
…#516) * Customize S3's GetBucketLocation call to correctly parse the response * Move the regression test into s3-tests.smithy
- Loading branch information
Showing
5 changed files
with
100 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
34 changes: 34 additions & 0 deletions
34
...ain/kotlin/software/amazon/smithy/rust/codegen/smithy/traits/S3UnwrappedXmlOutputTrait.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0. | ||
*/ | ||
|
||
package software.amazon.smithy.rust.codegen.smithy.traits | ||
|
||
import software.amazon.smithy.model.node.Node | ||
import software.amazon.smithy.model.shapes.ShapeId | ||
import software.amazon.smithy.model.traits.AnnotationTrait | ||
|
||
/** | ||
* S3's GetBucketLocation response shape can't be represented with Smithy's restXml protocol | ||
* without customization. We add this trait to the S3 model at codegen time so that a different | ||
* code path is taken in the XML deserialization codegen to generate code that parses the S3 | ||
* response shape correctly. | ||
* | ||
* From what the S3 model states, the generated parser would expect: | ||
* ``` | ||
* <LocationConstraint xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> | ||
* <LocationConstraint>us-west-2</LocationConstraint> | ||
* </LocationConstraint> | ||
* ``` | ||
* | ||
* But S3 actually responds with: | ||
* ``` | ||
* <LocationConstraint xmlns="http://s3.amazonaws.com/doc/2006-03-01/">us-west-2</LocationConstraint> | ||
* ``` | ||
*/ | ||
class S3UnwrappedXmlOutputTrait : AnnotationTrait(ID, Node.objectNode()) { | ||
companion object { | ||
val ID = ShapeId.from("smithy.api.internal#s3UnwrappedXmlOutputTrait") | ||
} | ||
} |