Skip to content

Commit

Permalink
fix(s3-control): default config.signingEscapePath to false (#4013)
Browse files Browse the repository at this point in the history
  • Loading branch information
kuhe authored Oct 4, 2022
1 parent b19f355 commit 0d599da
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions clients/client-s3-control/src/runtimeConfig.shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ export const getRuntimeConfig = (config: S3ControlClientConfig) => ({
logger: config?.logger ?? ({} as __Logger),
regionInfoProvider: config?.regionInfoProvider ?? defaultRegionInfoProvider,
serviceId: config?.serviceId ?? "S3 Control",
signingEscapePath: config?.signingEscapePath ?? false,
urlParser: config?.urlParser ?? parseUrl,
});
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,27 @@
import static software.amazon.smithy.typescript.codegen.integration.RuntimeClientPlugin.Convention.HAS_CONFIG;
import static software.amazon.smithy.typescript.codegen.integration.RuntimeClientPlugin.Convention.HAS_MIDDLEWARE;

import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.Consumer;
import software.amazon.smithy.aws.traits.ServiceTrait;
import software.amazon.smithy.codegen.core.SymbolProvider;
import software.amazon.smithy.model.Model;
import software.amazon.smithy.model.shapes.MemberShape;
import software.amazon.smithy.model.shapes.OperationShape;
import software.amazon.smithy.model.shapes.ServiceShape;
import software.amazon.smithy.model.shapes.Shape;
import software.amazon.smithy.model.traits.RequiredTrait;
import software.amazon.smithy.model.transform.ModelTransformer;
import software.amazon.smithy.typescript.codegen.LanguageTarget;
import software.amazon.smithy.typescript.codegen.TypeScriptSettings;
import software.amazon.smithy.typescript.codegen.TypeScriptWriter;
import software.amazon.smithy.typescript.codegen.integration.RuntimeClientPlugin;
import software.amazon.smithy.typescript.codegen.integration.TypeScriptIntegration;
import software.amazon.smithy.utils.ListUtils;
import software.amazon.smithy.utils.MapUtils;
import software.amazon.smithy.utils.SmithyInternalApi;

/**
Expand Down Expand Up @@ -81,6 +88,25 @@ public Model preprocessModel(Model model, TypeScriptSettings settings) {
});
}

@Override
public Map<String, Consumer<TypeScriptWriter>> getRuntimeConfigWriters(
TypeScriptSettings settings, Model model,
SymbolProvider symbolProvider, LanguageTarget target
) {
if (!isS3Control(settings.getService(model))) {
return Collections.emptyMap();
}
switch (target) {
case SHARED:
return MapUtils.of("signingEscapePath", writer -> {
writer.write("false");
});
case NODE:
default:
return Collections.emptyMap();
}
}

private static boolean isS3Control(ServiceShape service) {
String serviceId = service.getTrait(ServiceTrait.class).map(ServiceTrait::getSdkId).orElse("");
return serviceId.equals("S3 Control");
Expand Down

0 comments on commit 0d599da

Please sign in to comment.