Skip to content

Commit 20949f2

Browse files
authored
fix(codegen): limit the Bucket param dedupe to S3 service (#626)
1 parent 60094d9 commit 20949f2

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration/HttpBindingProtocolGenerator.java

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import java.util.Collection;
2020
import java.util.Collections;
2121
import java.util.Comparator;
22+
import java.util.HashSet;
2223
import java.util.LinkedHashMap;
2324
import java.util.List;
2425
import java.util.Locale;
@@ -96,9 +97,7 @@ public abstract class HttpBindingProtocolGenerator implements ProtocolGenerator
9697
private final boolean isErrorCodeInBody;
9798
private final EventStreamGenerator eventStreamGenerator = new EventStreamGenerator();
9899
private final LinkedHashMap<String, String> headerBuffer = new LinkedHashMap<>();
99-
private final Set<String> contextParamDeduplicationControlSet = SetUtils.of(
100-
"Bucket"
101-
);
100+
private Set<String> contextParamDeduplicationParamControlSet = new HashSet<>();
102101

103102
/**
104103
* Creates a Http binding protocol generator.
@@ -110,6 +109,14 @@ public HttpBindingProtocolGenerator(boolean isErrorCodeInBody) {
110109
this.isErrorCodeInBody = isErrorCodeInBody;
111110
}
112111

112+
/**
113+
* Indicate that param names in the set should be de-duplicated when appearing in
114+
* both contextParams (endpoint ruleset related) and HTTP URI segments / labels.
115+
*/
116+
public void setContextParamDeduplicationParamControlSet(Set<String> contextParamDeduplicationParamControlSet) {
117+
this.contextParamDeduplicationParamControlSet = contextParamDeduplicationParamControlSet;
118+
}
119+
113120
@Override
114121
public final ApplicationProtocol getApplicationProtocol() {
115122
return APPLICATION_PROTOCOL;
@@ -751,8 +758,8 @@ private void writeResolvedPath(
751758
// do not want to include it in the operation URI to be resolved.
752759
// We use this logic plus a temporary control-list, since it is not yet known
753760
// how many services and param names will have this issue.
754-
755-
return !(isContextParam && contextParamDeduplicationControlSet.contains(content));
761+
return !(isContextParam
762+
&& contextParamDeduplicationParamControlSet.contains(content));
756763
})
757764
.map(Segment::toString)
758765
.collect(Collectors.joining("/"))

0 commit comments

Comments
 (0)