Skip to content
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

Add packageDocumentation and improve interface inheritance #770

Merged
merged 1 commit into from
May 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,9 @@ private void generateCommandMiddlewareResolver(String configType) {
}

private void addInputAndOutputTypes() {
writer.writeDocs("@public");
writer.write("export { __MetadataBearer, $$Command };");

writeInputType(inputType.getName(), operationIndex.getInput(operation), symbol.getName());
writeOutputType(outputType.getName(), operationIndex.getOutput(operation), symbol.getName());
writer.write("");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import software.amazon.smithy.model.knowledge.TopDownIndex;
import software.amazon.smithy.model.shapes.OperationShape;
import software.amazon.smithy.model.shapes.ServiceShape;
import software.amazon.smithy.model.traits.DocumentationTrait;
import software.amazon.smithy.model.traits.PaginatedTrait;
import software.amazon.smithy.typescript.codegen.integration.ProtocolGenerator;
import software.amazon.smithy.utils.SmithyInternalApi;
Expand All @@ -45,6 +46,12 @@ static void writeIndex(
ProtocolGenerator protocolGenerator,
TypeScriptWriter writer
) {

writer.write("/* eslint-disable */");
settings.getService(model).getTrait(DocumentationTrait.class).ifPresent(trait ->
writer.writeDocs(trait.getValue() + "\n\n" + "@packageDocumentation"));


if (settings.generateClient()) {
writeClientExports(settings, model, symbolProvider, writer);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ static String getResolvedConfigTypeName(Symbol symbol) {
@Override
public void run() {
writer.addImport("Client", "__Client", "@aws-sdk/smithy-client");
writer.write("export { __Client }\n");
syall marked this conversation as resolved.
Show resolved Hide resolved
writer.addImport("getRuntimeConfig", "__getRuntimeConfig",
Paths.get(".", CodegenUtils.SOURCE_FOLDER, "runtimeConfig").toString());

Expand Down Expand Up @@ -162,7 +163,7 @@ private void generateConfig() {
writer.writeDocs("@public");
// The default configuration type is always just the base-level
// Smithy configuration requirements.
writer.write("type $LType = Partial<__SmithyConfiguration<$T>>", configType,
writer.write("export type $LType = Partial<__SmithyConfiguration<$T>>", configType,
applicationProtocol.getOptionsType());
writer.write(" & ClientDefaults");

Expand Down Expand Up @@ -197,7 +198,7 @@ private void generateConfig() {
// each "Input" configuration type.
writer.write("");
writer.writeDocs("@public");
writer.write("type $LType = __SmithyResolvedConfiguration<$T>",
writer.write("export type $LType = __SmithyResolvedConfiguration<$T>",
resolvedConfigType, applicationProtocol.getOptionsType());
writer.write(" & Required<ClientDefaults>");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ private void writeAdditionalFiles(
TypeScriptDependency.AWS_SMITHY_CLIENT.packageName);
writer.addImport("ServiceExceptionOptions", "__ServiceExceptionOptions",
TypeScriptDependency.AWS_SMITHY_CLIENT.packageName);
// Export ServiceException information to allow
// documentation inheritance to consume their types
writer.write("export { __ServiceException, __ServiceExceptionOptions }\n");
syall marked this conversation as resolved.
Show resolved Hide resolved
writer.writeDocs("@public\n\nBase exception class for all service exceptions from "
+ serviceName + " service.");
writer.openBlock("export class $L extends __ServiceException {", serviceExceptionName);
Expand Down