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

fix streaming members shape #138

Merged
merged 2 commits into from
Mar 2, 2020

Conversation

AllanZhengYP
Copy link
Contributor

@AllanZhengYP AllanZhengYP commented Feb 27, 2020

  • Fix the streaming member's shape from Uint8Array to Readable|ReadableStream|Blob
  • For streaming members in command input, ease the restriction to allow
    Uint8Array, Buffer and string

updated PutObjectCommandInput:

export type PutObjectCommandInput = Omit<PutObjectRequest, "Body"> & {
  Body?: PutObjectRequest["Body"] | string | Uint8Array | Buffer;
};

Only command input that has streaming member is updated.

Fixes: aws/aws-sdk-js-v3#843

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

* Fix the streaming member's shape from Uint8Array to Readable|ReadableStream|Blob
* For streaming members in command input, ease the restriction to allow
  Uint8Array, Buffer and string
@AllanZhengYP AllanZhengYP requested a review from kstich February 27, 2020 21:47
@@ -186,6 +194,29 @@ private void writeOutputType(String typeName, Optional<StructureShape> outputSha
}
}

private List<MemberShape> getStramingMembers(StructureShape shape) {
Copy link
Contributor

Choose a reason for hiding this comment

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

s/getStramingMembers/getStreamingMembers

*/
private void writeStreamingInputType(
String typeName,
Optional<StructureShape> inputShape,
Copy link
Contributor

Choose a reason for hiding this comment

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

This should just take the content of the optional, it's already known to exist when this is called and is required by the contents of the function as well.

writer.write("export type $L = $T;", typeName, symbolProvider.toSymbol(inputShape.get()));
StructureShape input = inputShape.get();
List<MemberShape> streamingMembers = getStramingMembers(input);
if (!streamingMembers.isEmpty()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: can this conditional be flipped? Streaming members are less likely to exist as well.

@AllanZhengYP AllanZhengYP requested a review from kstich February 29, 2020 00:29
@kstich kstich merged commit 7ab7594 into smithy-lang:master Mar 2, 2020
AllanZhengYP added a commit to AllanZhengYP/aws-sdk-js-v3 that referenced this pull request Mar 2, 2020
AllanZhengYP added a commit to AllanZhengYP/aws-sdk-js-v3 that referenced this pull request Mar 5, 2020
AllanZhengYP added a commit to AllanZhengYP/aws-sdk-js-v3 that referenced this pull request Mar 5, 2020
* Update streaming member types(smithy-lang/smithy-typescript#138)
* Fix streaming type types when they are required(smithy-lang/smithy-typescript#140)
AllanZhengYP added a commit to AllanZhengYP/aws-sdk-js-v3 that referenced this pull request Mar 5, 2020
* Update streaming member types(smithy-lang/smithy-typescript#138)
* Fix streaming type types when they are required(smithy-lang/smithy-typescript#140)
AllanZhengYP added a commit to aws/aws-sdk-js-v3 that referenced this pull request Mar 5, 2020
* Update streaming member types(smithy-lang/smithy-typescript#138)
* Fix streaming type types when they are required(smithy-lang/smithy-typescript#140)
AllanZhengYP added a commit to AllanZhengYP/aws-sdk-js-v3 that referenced this pull request Mar 20, 2020
* Update streaming member types(smithy-lang/smithy-typescript#138)
* Fix streaming type types when they are required(smithy-lang/smithy-typescript#140)
trivikr pushed a commit to trivikr/aws-sdk-js-v3 that referenced this pull request Mar 20, 2020
* Update streaming member types(smithy-lang/smithy-typescript#138)
* Fix streaming type types when they are required(smithy-lang/smithy-typescript#140)
trivikr pushed a commit to trivikr/aws-sdk-js-v3 that referenced this pull request Mar 24, 2020
* Update streaming member types(smithy-lang/smithy-typescript#138)
* Fix streaming type types when they are required(smithy-lang/smithy-typescript#140)
trivikr pushed a commit to trivikr/aws-sdk-js-v3 that referenced this pull request Mar 24, 2020
* Update streaming member types(smithy-lang/smithy-typescript#138)
* Fix streaming type types when they are required(smithy-lang/smithy-typescript#140)
srchase pushed a commit to srchase/smithy-typescript that referenced this pull request Mar 17, 2023
* Fix the streaming member's shape from Uint8Array to Readable|ReadableStream|Blob
* For streaming members in command input, ease the restriction to allow
  Uint8Array, Buffer and string
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.

Streaming members type is incomplete
2 participants