Skip to content

fix(codegen): limit the Bucket param dedupe to S3 service #626

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 1, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
Expand Down Expand Up @@ -96,9 +97,7 @@ public abstract class HttpBindingProtocolGenerator implements ProtocolGenerator
private final boolean isErrorCodeInBody;
private final EventStreamGenerator eventStreamGenerator = new EventStreamGenerator();
private final LinkedHashMap<String, String> headerBuffer = new LinkedHashMap<>();
private final Set<String> contextParamDeduplicationControlSet = SetUtils.of(
"Bucket"
);
private Set<String> contextParamDeduplicationParamControlSet = new HashSet<>();

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

/**
* Indicate that param names in the set should be de-duplicated when appearing in
* both contextParams (endpoint ruleset related) and HTTP URI segments / labels.
*/
public void setContextParamDeduplicationParamControlSet(Set<String> contextParamDeduplicationParamControlSet) {
this.contextParamDeduplicationParamControlSet = contextParamDeduplicationParamControlSet;
}

@Override
public final ApplicationProtocol getApplicationProtocol() {
return APPLICATION_PROTOCOL;
Expand Down Expand Up @@ -751,8 +758,8 @@ private void writeResolvedPath(
// do not want to include it in the operation URI to be resolved.
// We use this logic plus a temporary control-list, since it is not yet known
// how many services and param names will have this issue.

return !(isContextParam && contextParamDeduplicationControlSet.contains(content));
return !(isContextParam
&& contextParamDeduplicationParamControlSet.contains(content));
})
.map(Segment::toString)
.collect(Collectors.joining("/"))
Expand Down