Skip to content

chore(codegen): use submodule imports for core pkg #7109

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
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 @@ -162,7 +162,10 @@ public void prepareCustomizations(
) {
if (isAwsService(settings, model) && target.equals(LanguageTarget.NODE)) {
writer.addDependency(AwsDependency.AWS_SDK_CORE);
writer.addImport("emitWarningIfUnsupportedVersion", "awsCheckVersion", AwsDependency.AWS_SDK_CORE);
writer.addImportSubmodule(
"emitWarningIfUnsupportedVersion", "awsCheckVersion",
AwsDependency.AWS_SDK_CORE, "/client"
);
writer.write("awsCheckVersion(process.version);");
}
if (target.equals(LanguageTarget.NODE)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@ static void generateDocumentBodyShapeSerde(
static void generateJsonParseBody(GenerationContext context) {
TypeScriptWriter writer = context.getWriter();
writer.addDependency(AwsDependency.AWS_SDK_CORE);
writer.addImport("parseJsonBody", "parseBody", AwsDependency.AWS_SDK_CORE);
writer.addImportSubmodule(
"parseJsonBody", "parseBody",
AwsDependency.AWS_SDK_CORE, "/protocols"
);
}

static void generateJsonParseBodyWithQueryHeader(GenerationContext context) {
Expand All @@ -129,7 +132,10 @@ static void generateJsonParseBodyWithQueryHeader(GenerationContext context) {
static void generateJsonParseErrorBody(GenerationContext context) {
TypeScriptWriter writer = context.getWriter();
writer.addDependency(AwsDependency.AWS_SDK_CORE);
writer.addImport("parseJsonErrorBody", "parseErrorBody", AwsDependency.AWS_SDK_CORE);
writer.addImportSubmodule(
"parseJsonErrorBody", "parseErrorBody",
AwsDependency.AWS_SDK_CORE, "/protocols"
);
}

/**
Expand All @@ -141,7 +147,10 @@ static void generateJsonParseErrorBody(GenerationContext context) {
static void generateXmlParseBody(GenerationContext context) {
TypeScriptWriter writer = context.getWriter();
writer.addDependency(AwsDependency.AWS_SDK_CORE);
writer.addImport("parseXmlBody", "parseBody", AwsDependency.AWS_SDK_CORE);
writer.addImportSubmodule(
"parseXmlBody", "parseBody",
AwsDependency.AWS_SDK_CORE, "/protocols"
);
}

/**
Expand All @@ -153,7 +162,10 @@ static void generateXmlParseBody(GenerationContext context) {
static void generateXmlParseErrorBody(GenerationContext context) {
TypeScriptWriter writer = context.getWriter();
writer.addDependency(AwsDependency.AWS_SDK_CORE);
writer.addImport("parseXmlErrorBody", "parseErrorBody", AwsDependency.AWS_SDK_CORE);
writer.addImportSubmodule(
"parseXmlErrorBody", "parseErrorBody",
AwsDependency.AWS_SDK_CORE, "/protocols"
);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@ public void generateSharedComponents(GenerationContext context) {
writer.addDependency(AwsDependency.XML_BUILDER);

writer.addDependency(AwsDependency.AWS_SDK_CORE);
writer.addImport("loadRestXmlErrorCode", null, AwsDependency.AWS_SDK_CORE);
writer.addImportSubmodule(
"loadRestXmlErrorCode", null,
AwsDependency.AWS_SDK_CORE, "/protocols"
);

writer.write(
context.getStringStore().flushVariableDeclarationCode()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ public String bigIntegerShape(BigIntegerShape shape) {
@Override
public String unionShape(UnionShape shape) {
context.getWriter().addDependency(AwsDependency.AWS_SDK_CORE);
context.getWriter().addImport("awsExpectUnion", "__expectUnion", AwsDependency.AWS_SDK_CORE);
context.getWriter().addImportSubmodule(
"awsExpectUnion", "__expectUnion",
AwsDependency.AWS_SDK_CORE, "/protocols"
);
return getDelegateDeserializer(shape, "__expectUnion(" + dataSource + ")");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,12 @@ final class JsonMemberSerVisitor extends DocumentMemberSerVisitor {
this.serdeElisionEnabled = !this.isAwsQueryCompat && !context.getSettings().generateServerSdk();
if (isAwsQueryCompat) {
writer.addDependency(AwsDependency.AWS_SDK_CORE);
writer.addImport("_toStr", null, AwsDependency.AWS_SDK_CORE);
writer.addImport("_toNum", null, AwsDependency.AWS_SDK_CORE);
writer.addImport("_toBool", null, AwsDependency.AWS_SDK_CORE);
writer.addImportSubmodule("_toStr", null,
AwsDependency.AWS_SDK_CORE, "/protocols");
writer.addImportSubmodule("_toNum", null,
AwsDependency.AWS_SDK_CORE, "/protocols");
writer.addImportSubmodule("_toBool", null,
AwsDependency.AWS_SDK_CORE, "/protocols");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,10 @@ public void generateSharedComponents(GenerationContext context) {
TypeScriptWriter writer = context.getWriter();
writer.addUseImports(getApplicationProtocol().getResponseType());
writer.addDependency(AwsDependency.AWS_SDK_CORE);
writer.addImport("loadRestJsonErrorCode", null, AwsDependency.AWS_SDK_CORE);
writer.addImportSubmodule(
"loadRestJsonErrorCode", null,
AwsDependency.AWS_SDK_CORE, "/protocols"
);

if (context.getService().hasTrait(AwsQueryCompatibleTrait.class)) {
AwsProtocolUtils.generateJsonParseBodyWithQueryHeader(context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@ public void generateSharedComponents(GenerationContext context) {
writer.addUseImports(getApplicationProtocol().getResponseType());
writer.addImport("take", null, TypeScriptDependency.AWS_SMITHY_CLIENT);
writer.addDependency(AwsDependency.AWS_SDK_CORE);
writer.addImport("loadRestJsonErrorCode", null, AwsDependency.AWS_SDK_CORE);
writer.addImportSubmodule(
"loadRestJsonErrorCode", null,
AwsDependency.AWS_SDK_CORE, "/protocols"
);

writer.write(
context.getStringStore().flushVariableDeclarationCode()
Expand All @@ -122,7 +125,10 @@ public void generateSharedComponents(GenerationContext context) {
@Override
protected void importUnionDeserializer(TypeScriptWriter writer) {
writer.addDependency(AwsDependency.AWS_SDK_CORE);
writer.addImport("awsExpectUnion", "__expectUnion", AwsDependency.AWS_SDK_CORE);
writer.addImportSubmodule(
"awsExpectUnion", "__expectUnion",
AwsDependency.AWS_SDK_CORE, "/protocols"
);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,10 @@ public void customizeSupportedHttpAuthSchemes(
.build())
.putDefaultSigner(LanguageTarget.SHARED, w -> w
.addDependency(AwsDependency.AWS_SDK_CORE)
.addImport("AwsSdkSigV4Signer", null, AwsDependency.AWS_SDK_CORE)
.addImportSubmodule(
"AwsSdkSigV4Signer", null,
AwsDependency.AWS_SDK_CORE, "/httpAuthSchemes"
)
.write("new AwsSdkSigV4Signer()"))
.build();
supportedHttpAuthSchemesIndex.putHttpAuthScheme(authScheme.getSchemeId(), authScheme);
Expand Down Expand Up @@ -237,7 +240,10 @@ public void customizeSupportedHttpAuthSchemes(
.build())
.putDefaultSigner(LanguageTarget.SHARED, w -> w
.addDependency(AwsDependency.AWS_SDK_CORE)
.addImport("AwsSdkSigV4ASigner", null, AwsDependency.AWS_SDK_CORE)
.addImportSubmodule(
"AwsSdkSigV4ASigner", null,
AwsDependency.AWS_SDK_CORE, "/httpAuthSchemes"
)
.write("new AwsSdkSigV4ASigner()"))
.build();
supportedHttpAuthSchemesIndex.putHttpAuthScheme(authSchemeSigV4a.getSchemeId(), authSchemeSigV4a);
Expand Down
Loading