Skip to content

chore: remove variables from xml serializeMap #1174

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

Merged
merged 2 commits into from
May 12, 2020

Conversation

trivikr
Copy link
Member

@trivikr trivikr commented May 12, 2020

Issue #, if available:
Similar to #1153

Description of changes:
remove variables from xml serializeMap

Before:

const serializeAws_restXmlS3UserMetadata = (
  input: { [key: string]: string },
  context: __SerdeContext
): any => {
  const collectedNodes: any = [];
  Object.keys(input).forEach(key => {
    const entryNode = new __XmlNode("entry");
    const keyNode = new __XmlNode("NonEmptyMaxLength1024String")
      .addChildNode(new __XmlText(key))
      .withName("key");
    entryNode.addChildNode(keyNode);
    const node = new __XmlNode("MaxLength1024String").addChildNode(
      new __XmlText(input[key])
    );
    entryNode.addChildNode(node.withName("value"));
    collectedNodes.push(entryNode);
  });
  return collectedNodes;
};

After:

const serializeAws_restXmlS3UserMetadata = (
  input: { [key: string]: string },
  context: __SerdeContext
): any => {
  return Object.keys(input).map(key => {
    const entryNode = new __XmlNode("entry");
    const keyNode = new __XmlNode("NonEmptyMaxLength1024String")
      .addChildNode(new __XmlText(key))
      .withName("key");
    entryNode.addChildNode(keyNode);
    const node = new __XmlNode("MaxLength1024String").addChildNode(
      new __XmlText(input[key])
    );
    entryNode.addChildNode(node.withName("value"));
    return entryNode;
  });
};

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

@aws-sdk-js-automation
Copy link

AWS CodeBuild CI Report

  • CodeBuild project: sdk-staging-test
  • Commit ID: b518cff
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@trivikr trivikr changed the title feat: remove variables from xml serializeMap chore: remove variables from xml serializeMap May 12, 2020
Copy link
Contributor

@alexforsyth alexforsyth left a comment

Choose a reason for hiding this comment

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

Sweet. I like the JS style. LGTM

@trivikr trivikr merged commit 5f820e6 into aws:master May 12, 2020
@trivikr trivikr deleted the remove-collectedNodes-xml-serializeMap branch May 12, 2020 19:40
@lock
Copy link

lock bot commented May 20, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked as resolved and limited conversation to collaborators May 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants