-
Notifications
You must be signed in to change notification settings - Fork 92
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
docs: add more information about BLOB values in structures #1182
Conversation
8ce05b5
to
8e4a002
Compare
@@ -46,7 +47,8 @@ public abstract class StructureExampleGenerator { | |||
*/ | |||
public static String generateStructuralHintDocumentation(Shape shape, Model model, boolean isComment) { | |||
StringBuilder buffer = new StringBuilder(); | |||
shape(shape, buffer, model, 0, new ShapeTracker()); | |||
boolean isInput = shape.hasTrait(InputTrait.class); |
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 think it's better to define isInput
from where generateStructuralHintDocumentation()
is called.
This is mostly because I'm unsure if smithy-typescript applies input / output traits if the corresponding structures are missing the traits.
Lines 69 to 71 in 9275e12
// TODO: Not using below because it would break existing AWS SDKs. Maybe it should be configurable | |
// so generic SDKs call this by default, but AWS SDKs can opt-out of it via a setting. | |
// runner.createDedicatedInputsAndOutputs(); |
Just to be safe, I think it's better to pass in the isInput
boolean at these locations:
-
Input:
Lines 213 to 215 in 9275e12
+ String.format("const input = %s%n", StructureExampleGenerator.generateStructuralHintDocumentation( model.getShape(operation.getInputShape()).get(), model, false)) -
Output:
Lines 218 to 220 in 9275e12
+ String.format("%s%n", StructureExampleGenerator.generateStructuralHintDocumentation( model.getShape(operation.getOutputShape()).get(), model, true))
aws/aws-sdk-js-v3#5240
The PR improves the inline documentation generated for structural hints for operation inputs and outputs.
It differentiates between input and output of the same Smithy type (BLOB). For TypeScript, the inputs are wider than a single type for convenience, and the output has mixin methods attached, again for user convenience.
For a sample diff, see first commit in aws/aws-sdk-js-v3#5864
Examples
output side
STREAMING_BLOB_VALUE
becomes
BLOB_VALUE
becomes
input side
STREAMING_BLOB_VALUE
becomes
BLOB_VALUE
becomes