-
Notifications
You must be signed in to change notification settings - Fork 81
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
feat!: XML response deserialization #1299
Conversation
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.
Mostly questions with couple requested changes
Sources/Core/AWSClientRuntime/Protocols/Ec2Query/Ec2Response.swift
Outdated
Show resolved
Hide resolved
...main/kotlin/software/amazon/smithy/aws/swift/codegen/awsjson/AwsJson1_0_ProtocolGenerator.kt
Show resolved
Hide resolved
...lin/software/amazon/smithy/aws/swift/codegen/restxml/AWSHttpProtocolRestXMLCustomizations.kt
Show resolved
Hide resolved
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.
Lgtm
@@ -56,14 +62,36 @@ class S3ErrorIntegration : SwiftIntegration { | |||
private val httpResponseBinding = SectionWriter { writer, _ -> | |||
val ctx = writer.getContext("ctx") as ProtocolGenerator.GenerationContext | |||
val errorShapes = writer.getContext("errorShapes") as List<StructureShape> | |||
writer.write("let restXMLError = try await \$N.makeError(from: httpResponse)", AWSClientRuntimeTypes.RestXML.RestXMLError) |
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 has resulted in a regression issue when we get 404 errors from S3. An example, if we call the following API with an object that does not exist, it should throw a NotFound
error, instead throws a RestXMLDecodeError.missingRequiredData
try await s3Client.headObject(...)
Issue #
#964
Description of changes
Uses a new first-party system for deserializing XML responses and errors, replacing the
XMLCoder
third-party Swift coder for XML.AWSClientRuntimeTests
that were just copied from protocol testsSerdeContext
is unused, and is removedAWSHttpRequestXMLEncoder
andAWSHttpResponseXMLDecoder
are removed, since XML no longer uses decodersAlso:
.getOrNull()
"syntactic sugar" method for converting Java optional to Kotlin nullable with Kotlin built-in.orElse(null)
New/existing dependencies impact assessment, if applicable
No new dependencies were added to this change. The
XMLCoder
third-party Swift package is removed.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.