From f848f0d6bf4663c79939b831d15c3879c8d6b934 Mon Sep 17 00:00:00 2001 From: Luc Talatinian Date: Mon, 11 Dec 2023 12:05:33 -0500 Subject: [PATCH] fix: request compression codegen was broken for operations specified under resource --- .../go/codegen/requestcompression/RequestCompression.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/codegen/smithy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/requestcompression/RequestCompression.java b/codegen/smithy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/requestcompression/RequestCompression.java index b6f7779c8..c0d1fe7c3 100644 --- a/codegen/smithy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/requestcompression/RequestCompression.java +++ b/codegen/smithy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/requestcompression/RequestCompression.java @@ -35,7 +35,6 @@ import software.amazon.smithy.model.knowledge.TopDownIndex; import software.amazon.smithy.model.shapes.OperationShape; import software.amazon.smithy.model.shapes.ServiceShape; -import software.amazon.smithy.model.shapes.ShapeId; import software.amazon.smithy.model.traits.RequestCompressionTrait; import software.amazon.smithy.utils.ListUtils; import software.amazon.smithy.utils.MapUtils; @@ -81,13 +80,12 @@ public void writeAdditionalFiles( GoDelegator goDelegator ) { ServiceShape service = settings.getService(model); - for (ShapeId operationID : service.getAllOperations()) { - OperationShape operation = model.expectShape(operationID, OperationShape.class); + TopDownIndex.of(model).getContainedOperations(service).forEach(operation -> { if (!operation.hasTrait(RequestCompressionTrait.class)) { - continue; + return; } goDelegator.useShapeWriter(operation, writeMiddlewareHelper(symbolProvider, operation)); - } + }); }