Skip to content

Commit

Permalink
Rename SyntheticClone to Synthetic
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Yuan authored and syall committed Jan 3, 2023
1 parent b302f0a commit 4dd79b8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import software.amazon.smithy.go.codegen.GoWriter;
import software.amazon.smithy.go.codegen.SmithyGoDependency;
import software.amazon.smithy.go.codegen.SymbolUtils;
import software.amazon.smithy.go.codegen.SyntheticClone;
import software.amazon.smithy.go.codegen.integration.HttpRpcProtocolGenerator;
import software.amazon.smithy.go.codegen.integration.ProtocolGenerator;
import software.amazon.smithy.go.codegen.integration.ProtocolUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ protected void writeDefaultHeaders(GenerationContext context, OperationShape ope
protected void serializeInputDocument(GenerationContext context, OperationShape operation) {
GoWriter writer = context.getWriter().get();

// Stub synthetic clone inputs mean there never was an input modeled, always serialize empty JSON object
// Stub synthetic inputs mean there never was an input modeled, always serialize empty JSON object
// as place holder.
if (CodegenUtils.isStubSyntheticClone(ProtocolUtils.expectInput(context.getModel(), operation))) {
if (CodegenUtils.isStubSynthetic(ProtocolUtils.expectInput(context.getModel(), operation))) {
writer.addUseImports(SmithyGoDependency.STRINGS);
writer.openBlock("if request, err = request.SetStream(strings.NewReader(`{}`)); err != nil {",
"}", () -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import software.amazon.smithy.go.codegen.GoValueAccessUtils;
import software.amazon.smithy.go.codegen.GoWriter;
import software.amazon.smithy.go.codegen.SmithyGoDependency;
import software.amazon.smithy.go.codegen.SyntheticClone;
import software.amazon.smithy.go.codegen.Synthetic;
import software.amazon.smithy.go.codegen.integration.HttpBindingProtocolGenerator;
import software.amazon.smithy.go.codegen.integration.ProtocolGenerator;
import software.amazon.smithy.go.codegen.integration.ProtocolUtils;
Expand Down Expand Up @@ -119,7 +119,7 @@ protected void writeMiddlewarePayloadAsDocumentSerializerDelegator(
Shape payloadShape = model.expectShape(memberShape.getTarget());

String functionName;
if (payloadShape.hasTrait(SyntheticClone.class)) {
if (payloadShape.hasTrait(Synthetic.class)) {
functionName = ProtocolGenerator.getDocumentSerializerFunctionName(
payloadShape, context.getService(), context.getProtocolName());
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import software.amazon.smithy.go.codegen.GoWriter;
import software.amazon.smithy.go.codegen.SmithyGoDependency;
import software.amazon.smithy.go.codegen.SymbolUtils;
import software.amazon.smithy.go.codegen.SyntheticClone;
import software.amazon.smithy.go.codegen.Synthetic;
import software.amazon.smithy.go.codegen.integration.ProtocolGenerator;
import software.amazon.smithy.go.codegen.knowledge.GoPointableIndex;
import software.amazon.smithy.model.shapes.MemberShape;
Expand Down Expand Up @@ -253,12 +253,12 @@ private static String getSerializedXMLShapeName(ProtocolGenerator.GenerationCont
String shapeName = shapeSymbol.getName();
ServiceShape service = context.getService();

// check if synthetic cloned shape
Optional<SyntheticClone> clone = shape.getTrait(SyntheticClone.class);
if (clone.isPresent()) {
SyntheticClone cl = clone.get();
if (cl.getArchetype().isPresent()) {
shapeName = cl.getArchetype().get().getName(service);
// check if synthetic shape
Optional<Synthetic> synthOptional = shape.getTrait(Synthetic.class);
if (synthOptional.isPresent()) {
Synthetic synth = synthOptional.get();
if (synth.getArchetype().isPresent()) {
shapeName = synth.getArchetype().get().getName(service);
}
}

Expand Down

0 comments on commit 4dd79b8

Please sign in to comment.