Skip to content

Commit

Permalink
codegen: Updates SDK's generated serde for unmodeled operation input/…
Browse files Browse the repository at this point in the history
…output (#1050)

Updates the SDK's generate serializers and deserializers for operations without modeled input and output types. This fixes #1047 where the SDK was attempting to deserialize a response from a service for an operation that had no modeled output. The SDK should of ignored the response instead of trying to deserialize it.

This update will not attempt to serialize inputs for operations without modeled inputs, and will discard responses from services of operations with unmodeled outputs.

Related to aws/smithy-go#261
Fixes #1047
  • Loading branch information
jasdel authored Jan 16, 2021
1 parent 796ec32 commit 61895a9
Show file tree
Hide file tree
Showing 244 changed files with 14,435 additions and 41,879 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@ protected void serializeInputDocument(GenerationContext context, OperationShape
writer.openBlock("if err := $L(input, bodyEncoder.Value); err != nil {", "}", functionName, () -> {
writer.write("return out, metadata, &smithy.SerializationError{Err: err}");
}).write("");
} else {
writer.write("_ = input");
writer.write("");
}

writer.write("err = bodyEncoder.Encode()");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ protected void serializeInputDocument(GenerationContext context, OperationShape

// If there are no members then there's nothing to serialize
if (input.members().size() == 0) {
// Prevent warnings caused by input not being used
writer.write("_ = input");
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,9 @@ private static String getSerializedXMLShapeName(ProtocolGenerator.GenerationCont
Optional<SyntheticClone> clone = shape.getTrait(SyntheticClone.class);
if (clone.isPresent()) {
SyntheticClone cl = clone.get();
shapeName = cl.getArchetype().getName();
if (cl.getArchetype().isPresent()) {
shapeName = cl.getArchetype().get().getName();
}
}

// check if shape is member shape
Expand Down
54 changes: 54 additions & 0 deletions internal/protocoltest/awsrestjson/deserializers.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 61895a9

Please sign in to comment.