30
30
import java .util .function .Consumer ;
31
31
import java .util .logging .Logger ;
32
32
import java .util .stream .Collectors ;
33
+ import software .amazon .smithy .aws .traits .ServiceTrait ;
33
34
import software .amazon .smithy .codegen .core .CodegenException ;
34
35
import software .amazon .smithy .codegen .core .Symbol ;
35
36
import software .amazon .smithy .codegen .core .SymbolProvider ;
@@ -96,9 +97,12 @@ public abstract class HttpBindingProtocolGenerator implements ProtocolGenerator
96
97
private final boolean isErrorCodeInBody ;
97
98
private final EventStreamGenerator eventStreamGenerator = new EventStreamGenerator ();
98
99
private final LinkedHashMap <String , String > headerBuffer = new LinkedHashMap <>();
99
- private final Set <String > contextParamDeduplicationControlSet = SetUtils .of (
100
+ private final Set <String > contextParamDeduplicationParamControlSet = SetUtils .of (
100
101
"Bucket"
101
102
);
103
+ private final Set <String > contextParamDeduplicationServiceControlSet = SetUtils .of (
104
+ "S3"
105
+ );
102
106
103
107
/**
104
108
* Creates a Http binding protocol generator.
@@ -735,6 +739,11 @@ private void writeResolvedPath(
735
739
.getContextParams (context .getModel ().getShape (operation .getInputShape ()).get ())
736
740
: Collections .emptyMap ();
737
741
742
+ String serviceId = context .getService ()
743
+ .getTrait (ServiceTrait .class )
744
+ .map (ServiceTrait ::getSdkId )
745
+ .orElse ("" );
746
+
738
747
// Always write the bound path, but only the actual segments.
739
748
writer .write ("let resolvedPath = `$L` + $S;" ,
740
749
"${basePath?.endsWith('/') ? basePath.slice(0, -1) : (basePath || '')}" ,
@@ -751,8 +760,9 @@ private void writeResolvedPath(
751
760
// do not want to include it in the operation URI to be resolved.
752
761
// We use this logic plus a temporary control-list, since it is not yet known
753
762
// how many services and param names will have this issue.
754
-
755
- return !(isContextParam && contextParamDeduplicationControlSet .contains (content ));
763
+ return !(isContextParam
764
+ && contextParamDeduplicationParamControlSet .contains (content )
765
+ && contextParamDeduplicationServiceControlSet .contains (serviceId ));
756
766
})
757
767
.map (Segment ::toString )
758
768
.collect (Collectors .joining ("/" ))
0 commit comments