feat: move common middlewares to shared addCommonMiddlewares#674
Open
Tongs2000 wants to merge 2 commits into
Open
feat: move common middlewares to shared addCommonMiddlewares#674Tongs2000 wants to merge 2 commits into
Tongs2000 wants to merge 2 commits into
Conversation
3a10e51 to
1f79d32
Compare
wty-Bryant
reviewed
Jun 5, 2026
| if err := addProtocolFinalizerMiddlewares(stack, options, operation); err != nil { | ||
| return fmt.Errorf("add protocol finalizers: %v", err) | ||
| }"""); | ||
| writer.addUseImports(SmithyGoDependency.FMT); |
Contributor
There was a problem hiding this comment.
nit: add import before use it
| .resolvedFunction(SymbolUtils.createValueSymbolBuilder(REGISTER_MIDDLEWARE).build()) | ||
| .useClientOptions() | ||
| .build()) | ||
| .isCommon(true) |
Contributor
There was a problem hiding this comment.
so there might be some other operations shared middlewares (e.g. addRetry, req/resp logging etc) that can be marked as common imo, you may already include some of them in go v2 pr, so it will help after you created the bumped go v2 pr (ik it's hard to collect them all in single pr)
Contributor
Author
There was a problem hiding this comment.
Yes — the other common middlewares (addRetry, addClientUserAgent, addRecursionDetection, etc.) are marked in the companion aws-sdk-go-v2 PR at aws/aws-sdk-go-v2 branch feat-invoke-operation-refactor. Only ClientLogger lives in smithy-go, the rest are AWS-specific integrations.
0df0cba to
ee10944
Compare
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: aws/aws-sdk-go-v2#3321
Move common middlewares (those identical across every operation) into a shared
addCommonMiddlewaresmethod on Client, called frominvokeOperation. Per-operationaddOperation*Middlewaresfunctions now only register what is truly unique(serializer, deserializer, predicate-scoped customizations).Results in ~47% reduction in per-operation function compiled size. SQS benchmark: ~2,550 bytes saved per operation, ~57 KB net savings across 23 operations.
Companion PR in aws-sdk-go-v2 will bump SMITHY_GO_CODEGEN_VERSION and mark additional AWS-specific plugins as common.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.