Skip to content
Open
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 @@ -254,6 +254,7 @@ private String getCommandExample(String serviceName, String configName, String c
packageName)
+ String.format("// const { %s, %s } = require(\"%s\"); // CommonJS import%n", serviceName, commandName,
packageName)
+ "// See AWS SDK config options: https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/configuring-the-jssdk.html\n"
+ String.format("const client = new %s(config);%n", serviceName)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is smithy, we shouldn't link to AWS docs.

A preface block to the line containing the client init should be injectable by the downstream code generator. You can refer to the CodeSection interface usage in this repo on how to do that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could replace config with {} so at least there would be no question about an undefined variable.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of a link, there could be a comment saying that the exported type of the config is the client class name plus the word "Config".

e.g.

import { S3Client, S3ClientConfig } from "@aws-sdk/client-s3";

+ String.format("const input = %s%n",
StructureExampleGenerator.generateStructuralHintDocumentation(
Expand Down