Skip OperationGenerator in types-only codegen mode#1083
Merged
adwsingh merged 4 commits intosmithy-lang:mainfrom Mar 17, 2026
Merged
Skip OperationGenerator in types-only codegen mode#1083adwsingh merged 4 commits intosmithy-lang:mainfrom
adwsingh merged 4 commits intosmithy-lang:mainfrom
Conversation
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.
Contributor
|
Nit: we don't use conventional commits. |
sugmanue
reviewed
Mar 17, 2026
...en/codegen-plugin/src/main/java/software/amazon/smithy/java/codegen/DirectedJavaCodegen.java
Outdated
Show resolved
Hide resolved
…va/codegen/DirectedJavaCodegen.java Co-authored-by: Manuel Sugawara <sugmanue@amazon.com>
adwsingh
approved these changes
Mar 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.