From eaa7f232622a41f8f502576ecc9014c3247ca06e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kehan=F0=9F=9A=80?= Date: Tue, 17 Mar 2026 12:26:51 -0400 Subject: [PATCH 1/2] fix: skip OperationGenerator in types-only codegen mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In types-only mode, OperationGenerator is invoked for operations added to the synthetic service by SyntheticServiceTransform. OperationGenerator calls EventStreamIndex, which iterates all operation input/output members via model.expectShape(). The synthetic model built by SyntheticServiceTransform has an incomplete transitive closure — @mixin shapes (e.g. BaseError, ComponentInstanceMixin) are flattened during model assembly and not resolvable via expectShape() in the transformed model, causing ExpectationNotMetException. The old DirectedJavaTypeCodegen (removed in #1057) never implemented generateOperation(), so this path was never hit. The unified DirectedJavaCodegen runs OperationGenerator unconditionally, which is unnecessary in types-only mode — operation input/output types are generated through generateStructure(), not generateOperation(). This adds an isTypesOnly() guard to generateOperation() and refactors generateService() to use the same helper. --- .../smithy/java/codegen/DirectedJavaCodegen.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/codegen/codegen-plugin/src/main/java/software/amazon/smithy/java/codegen/DirectedJavaCodegen.java b/codegen/codegen-plugin/src/main/java/software/amazon/smithy/java/codegen/DirectedJavaCodegen.java index d5b25b208..6061442a8 100644 --- a/codegen/codegen-plugin/src/main/java/software/amazon/smithy/java/codegen/DirectedJavaCodegen.java +++ b/codegen/codegen-plugin/src/main/java/software/amazon/smithy/java/codegen/DirectedJavaCodegen.java @@ -130,6 +130,13 @@ public void generateOperation(GenerateOperationDirective directive) { // In TYPES-only mode, generateService is a no-op (the synthetic service has no real service shape) - if (modes.contains(CodegenMode.TYPES) && !modes.contains(CodegenMode.CLIENT) - && !modes.contains(CodegenMode.SERVER)) { + if (isTypesOnly()) { return; } @@ -188,4 +194,10 @@ public void customizeAfterIntegrations(CustomizeDirective Date: Tue, 17 Mar 2026 16:46:30 -0400 Subject: [PATCH 2/2] Update codegen/codegen-plugin/src/main/java/software/amazon/smithy/java/codegen/DirectedJavaCodegen.java Co-authored-by: Manuel Sugawara --- .../amazon/smithy/java/codegen/DirectedJavaCodegen.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/codegen/codegen-plugin/src/main/java/software/amazon/smithy/java/codegen/DirectedJavaCodegen.java b/codegen/codegen-plugin/src/main/java/software/amazon/smithy/java/codegen/DirectedJavaCodegen.java index 6061442a8..4170b142d 100644 --- a/codegen/codegen-plugin/src/main/java/software/amazon/smithy/java/codegen/DirectedJavaCodegen.java +++ b/codegen/codegen-plugin/src/main/java/software/amazon/smithy/java/codegen/DirectedJavaCodegen.java @@ -130,10 +130,6 @@ public void generateOperation(GenerateOperationDirective