-
Notifications
You must be signed in to change notification settings - Fork 918
Rest Xml marshaller/unmarshaller refactor #758
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
Conversation
@@ -74,7 +74,7 @@ | |||
.memberFieldInfo( | |||
SdkField.<String> builder(MarshallingType.STRING) | |||
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) | |||
.locationName("member").build()).build()).build()).build(); | |||
.locationName("member").build()).build()).flattened(false).build()).build(); |
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.
In my branch I only add flattened when it's not false. Helps cut the noise down a bit.
|
||
public <T extends AwsRequest> ProtocolMarshaller<Request<T>> createProtocolMarshaller(OperationInfo operationInfo, | ||
T origRequest, | ||
String xmlNameSpaceUri) { |
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.
Might be worth having some mechanism to communicate protocol specific metadata in OperationInfo. Like some attribute map similar to the execution attributes. Or allowing protocols to extend OperationInfo to add additional properties.
|
||
// TODO Is it required? No shape uses this. Fix casting | ||
// See line 8 in MarshalHeaderMembersMacro.ftl | ||
public static final XmlMarshaller<List> LiST = new SimpleHeaderMarshaller<List>(null) { |
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.
I don't think we need to support this and should remove it until we need it. It's not clear how we should marshall lists in headers as it's not yet defined.
return; | ||
} | ||
|
||
for (Map.Entry<String, String> entry : ((Map<String, String>) map).entrySet()) { |
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.
Do we need to assume it's a string or can we lookup in the marshaller registry and delegate?
@SdkInternalApi | ||
public interface XmlUnmarshaller<T> { | ||
|
||
T unmarshall(XmlUnmarshallerContext context, |
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.
NP one liner
pom.xml
Outdated
@@ -549,7 +549,7 @@ | |||
</execution> | |||
</executions> | |||
<configuration> | |||
<failOnWarning>true</failOnWarning> | |||
<failOnWarning>false</failOnWarning> |
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.
What's this?
services/budgets/pom.xml
Outdated
@@ -29,4 +29,14 @@ | |||
AWS Budgets Service | |||
</description> | |||
<url>https://aws.amazon.com/sdkforjava</url> | |||
|
|||
<dependencies> |
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.
Remove
@@ -0,0 +1,29 @@ | |||
|
|||
# |
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.
Why's this in codegen-resources?
services/s3/pom.xml
Outdated
@@ -63,5 +63,9 @@ | |||
<version>${awsjavasdk.version}</version> | |||
<scope>test</scope> | |||
</dependency> | |||
<dependency> |
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.
Remove
940be6d
to
44e23c7
Compare
5db4222
to
fb81b6b
Compare
fb81b6b
to
358df4d
Compare
358df4d
to
af5c829
Compare
@Override | ||
public void marshall(SdkBytes val, XmlMarshallerContext context, String paramName, SdkField<SdkBytes> sdkField, | ||
ValueToStringConverter.ValueToString<SdkBytes> converter) { | ||
context.xmlGenerator().xmlWriter().value(val.asByteBuffer()); |
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.
Is this base64 encoded?
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.
yes (here)
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.
Is it worth just moving that up to this level? We've got a ValueToString for SDK_BYTES that base64 encodes already.
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.
Makes sense. I will use it
} | ||
|
||
/** | ||
* This value indicates if the root element in the response xml document should be ignored |
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.
Do we need this or can we just use the PayloadTrait?
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.
As we discussed yesterday, we are setting a customization to enable this value for operation like S3 GetBucketLocationOutput
. So we need it
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.
I was thinking that we would use that customization to just apply the payload trait to LocationConstraint. Wouldn't that have the same behavior?
@@ -55,7 +55,8 @@ | |||
private static final Region DESTINATION_REGION = Region.of("us-west-2"); | |||
|
|||
private static RdsPresignInterceptor<CopyDbSnapshotRequest> presignInterceptor = new CopyDbSnapshotPresignInterceptor(); | |||
private final CopyDbSnapshotRequestMarshaller marshaller = new CopyDbSnapshotRequestMarshaller(new AwsQueryProtocolFactory()); | |||
private final CopyDbSnapshotRequestMarshaller marshaller = | |||
new CopyDbSnapshotRequestMarshaller(AwsQueryProtocolFactory.builder().build()); |
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.
Should we just have a create method?
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.
We need to add overload create
methods if we add state to this class, so i avoided it. We don't use it in many places, so it should be fine. We can always add it later.
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.
Sounds good.
@Override | ||
public SdkHttpFullRequest modifyHttpRequest(Context.ModifyHttpRequest context, ExecutionAttributes executionAttributes) { | ||
SdkHttpFullRequest request = context.httpRequest(); | ||
if (request.contentStreamProvider().isPresent() && !request.firstMatchingHeader(CONTENT_MD5).isPresent()) { |
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.
Does this add MD5 for all operations? what about PutObject?
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.
Ignoring PutObject and UploadPart as discussed offline
491e2ca
to
297087e
Compare
…a5323a23 Pull request: release <- staging/194ffc2d-3f15-4f2c-95ce-60e7a5323a23
TODO