Skip to content

Commit 11b9cd9

Browse files
authored
fix: exclude CustomEndpoints plugin from Endpoints 2.0 services (#1337)
* fix: exclude CustomEndpoints plugin from Endpoints 2.0 services * linting
1 parent 53cd7ac commit 11b9cd9

File tree

1 file changed

+7
-0
lines changed
  • smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration

1 file changed

+7
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
import static software.amazon.smithy.typescript.codegen.integration.RuntimeClientPlugin.Convention.HAS_MIDDLEWARE;
1010

1111
import java.util.List;
12+
import software.amazon.smithy.model.shapes.ServiceShape;
13+
import software.amazon.smithy.rulesengine.traits.EndpointRuleSetTrait;
1214
import software.amazon.smithy.typescript.codegen.TypeScriptDependency;
1315
import software.amazon.smithy.utils.SmithyInternalApi;
1416

@@ -25,6 +27,7 @@ public List<RuntimeClientPlugin> getClientPlugins() {
2527
RuntimeClientPlugin.builder()
2628
.withConventions(
2729
TypeScriptDependency.CONFIG_RESOLVER.dependency, "CustomEndpoints", HAS_CONFIG)
30+
.servicePredicate((m, s) -> !isEndpointsV2Service(s))
2831
.build(),
2932
RuntimeClientPlugin.builder()
3033
.withConventions(TypeScriptDependency.MIDDLEWARE_RETRY.dependency, "Retry")
@@ -34,4 +37,8 @@ public List<RuntimeClientPlugin> getClientPlugins() {
3437
HAS_MIDDLEWARE)
3538
.build());
3639
}
40+
41+
private static boolean isEndpointsV2Service(ServiceShape serviceShape) {
42+
return serviceShape.hasTrait(EndpointRuleSetTrait.class);
43+
}
3744
}

0 commit comments

Comments
 (0)