Skip to content

Skip OperationGenerator in types-only codegen mode#1083

Merged
adwsingh merged 4 commits intosmithy-lang:mainfrom
AgentKWang:fix/types-mode-skip-operation-generator
Mar 17, 2026
Merged

Skip OperationGenerator in types-only codegen mode#1083
adwsingh merged 4 commits intosmithy-lang:mainfrom
AgentKWang:fix/types-mode-skip-operation-generator

Conversation

@AgentKWang
Copy link
Contributor

Issue #, if available: #1082

Description of changes:
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.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

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 smithy-lang#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.
@sugmanue
Copy link
Contributor

Nit: we don't use conventional commits.

@AgentKWang AgentKWang changed the title fix: skip OperationGenerator in types-only codegen mode Skip OperationGenerator in types-only codegen mode Mar 17, 2026
@adwsingh adwsingh merged commit 77f1749 into smithy-lang:main Mar 17, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants