fix: various typos (#813)

* fix: various typos

* undo: model spellchecking

* revert: bad change to model docs
This commit is contained in:
Zelda Hessler 2021-10-27 13:21:06 -05:00 committed by GitHub
parent ad588131f0
commit 1586d0b0c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
61 changed files with 116 additions and 115 deletions

View File

@ -362,7 +362,7 @@ This week also sees the addition of a robust async caching credentials provider.
To upgrade to the new release, update `tag` to `v0.0.14-alpha`:
```
[dependencies]
# eg. S3:
# e.g. S3:
aws-sdk-s3 = { git = "https://github.com/awslabs/aws-sdk-rust", tag = "v0.0.14-alpha" }
```
@ -455,7 +455,7 @@ To update to the new release, change your tag to `v0.0.10-alpha`.
- :tada: Add support for EKS (smithy-rs#553)
- :warning: **Breaking Change:** httpLabel no longer causes fields to be non-optional. You may need to adapt code that uses models. (#537)
- :warning: **Breaking Change:** `Exception` is **not** renamed to `Error`. Code may need to be updated to replace `Error` with `Exception` when naming error shapes.
- :warning: **Breaking Change:** Models are now in strict pascal case including acronyms (eg. `dynamodb::model::{SSESpecification => SseSpecification}`)
- :warning: **Breaking Change:** Models are now in strict pascal case including acronyms (e.g. `dynamodb::model::{SSESpecification => SseSpecification}`)
- Add more SES examples, and improve examples for Batch.
- Improved error handling ergonomics: Errors now provide `is_<variantname>()` methods to simplify error handling
- :bug: Bugfix: Fix bug in `create_multipart_upload`: #127 (smithy-rs#531, @eagletmt)
@ -477,7 +477,7 @@ To upgrade to the new release, update `tag` to `v0.0.9-alpha`:
```toml
[dependencies]
# eg. Cloudwatch Logs:
# e.g. Cloudwatch Logs:
aws-sdk-cloudwatchlogs = { git = "https://github.com/awslabs/aws-sdk-rust", tag = "v0.0.9-alpha" }
```
@ -510,7 +510,7 @@ To upgrade to the new release, update `tag` to `v0.0.8-alpha`:
```toml
[dependencies]
# eg. EC2:
# e.g. EC2:
aws-sdk-ec2 = { git = "https://github.com/awslabs/aws-sdk-rust", tag = "v0.0.8-alpha" }
```
@ -541,7 +541,7 @@ This week weve added MediaLive, MediaPackage, SNS, Batch, STS, RDS, RDSData,
To upgrade to the new release, update `tag` to `v0.0.7-alpha`:
```toml
[dependencies]
# eg. SNS:
# e.g. SNS:
aws-sdk-sns = { git = "https://github.com/awslabs/aws-sdk-rust", tag = "v0.0.7-alpha" }
```
@ -594,7 +594,7 @@ Thanks!
v0.0.5-alpha (May 25th, 2021)
=============================
You can install the new release by updating your dependencies to `tag = "v0.0.5-alpha"`, eg.
You can install the new release by updating your dependencies to `tag = "v0.0.5-alpha"`, e.g.
```toml
[dependencies]
aws-sdk-s3 = { git = "https://github.com/awslabs/aws-sdk-rust", tag = "v0.0.5-alpha" }
@ -622,7 +622,7 @@ Thanks!
v0.0.4-alpha (May 18th, 2021)
=============================
You can install the new release by updating your dependencies to `tag = "v0.0.4-alpha"`, eg.
You can install the new release by updating your dependencies to `tag = "v0.0.4-alpha"`, e.g.
```toml
[dependencies]
aws-sdk-lambda = { git = "https://github.com/awslabs/aws-sdk-rust", tag = "v0.0.4-alpha" }
@ -636,7 +636,7 @@ aws-sdk-lambda = { git = "https://github.com/awslabs/aws-sdk-rust", tag = "v0.0.
- Types represented by the Smithy `Set` type now generate `Vec<T>` in all cases. This is also technically breaking but not currently exposed. (smithy-rs#270)
- Bugfix: The `.message()`field of errors will now look for both `message` and `Message` in the model (smithy-rs#374)
- Add support for the `AWS_REGION` environment variable. (smithy-rs#362)
- The request type generated by the fluent builders, eg. `dynamodb.list_tables()` is now `Debug` (smithy-rs#377, @declanvk)
- The request type generated by the fluent builders, e.g. `dynamodb.list_tables()` is now `Debug` (smithy-rs#377, @declanvk)
And more: See the corresponding [smithy-rs release](https://github.com/awslabs/smithy-rs/releases/tag/v0.9).

View File

@ -10,5 +10,5 @@ cdk bootstrap aws://accountid/region
cdk deploy
# make lunch, go for a bike ride, etc. ~1h.
kubectl exec rust-sdk-test -it bash
# write some rust code, eg. test.rs, run it.
# write some rust code, e.g. test.rs, run it.
```

View File

@ -5,7 +5,7 @@
//! Ecs Credentials Provider
//!
//! This credential provider is frequently used with an AWS-provided credentials service (eg.
//! This credential provider is frequently used with an AWS-provided credentials service (e.g.
//! [IAM Roles for tasks](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-iam-roles.html).
//! However, it's possible to use environment variables to configure this provider to use your own
//! credentials sources.

View File

@ -47,7 +47,7 @@ impl EnvironmentVariableCredentialsProvider {
}
#[doc(hidden)]
/// Create a new `EnvironmentVariableCredentialsProvider` with `Env` overriden
/// Create a new `EnvironmentVariableCredentialsProvider` with `Env` overridden
///
/// This function is intended for tests that mock out the process environment.
pub fn new_with_env(env: Env) -> Self {

View File

@ -246,10 +246,10 @@ pub enum ImdsError {
/// IO Error
///
/// An error occurred comunication with IMDS
/// An error occurred communication with IMDS
IoError(Box<dyn Error + Send + Sync + 'static>),
/// An unexpected error occured communicating with IMDS
/// An unexpected error occurred communicating with IMDS
Unexpected(Box<dyn Error + Send + Sync + 'static>),
}
@ -270,11 +270,11 @@ impl Display for ImdsError {
response
),
ImdsError::IoError(err) => {
write!(f, "An IO error occured communicating with IMDS: {}", err)
write!(f, "An IO error occurred communicating with IMDS: {}", err)
}
ImdsError::Unexpected(err) => write!(
f,
"An unexpected error occured communicating with IMDS: {}",
"An unexpected error occurred communicating with IMDS: {}",
err
),
}
@ -413,7 +413,7 @@ pub enum BuildError {
/// The endpoint mode was invalid
InvalidEndpointMode(InvalidEndpointMode),
/// The AWS Profile (eg. `~/.aws/config`) was invalid
/// The AWS Profile (e.g. `~/.aws/config`) was invalid
InvalidProfile(ProfileParseError),
/// The specified endpoint was not a valid URI

View File

@ -14,7 +14,7 @@ pub(crate) enum InvalidJsonCredentials {
/// The response was missing a required field
MissingField(&'static str),
/// Another unhandled error occured
/// Another unhandled error occurred
Other(Cow<'static, str>),
}

View File

@ -42,7 +42,7 @@ impl<'a> ProfileChain<'a> {
/// A base member of the profile chain
///
/// Base providers do not require input credentials to provide their own credentials,
/// eg. IMDS, ECS, Environment variables
/// e.g. IMDS, ECS, Environment variables
#[derive(Debug, Clone)]
#[non_exhaustive]
pub enum BaseProvider<'a> {

View File

@ -123,7 +123,7 @@ impl ProviderConfig {
/// HttpSettings for HTTP connectors
///
/// # Stabilility
/// # Stability
/// As HTTP settings stabilize, they will move to `aws-types::config::Config` so that they
/// can be used to configure HTTP connectors for service clients.
#[non_exhaustive]

View File

@ -47,7 +47,7 @@ pub(crate) mod util {
///
/// STS Assume Role providers MUST assign a name to their generated session. When a user does not
/// provide a name for the session, the provider will choose a name composed of a base + a timestamp,
/// eg. `profile-file-provider-123456789`
/// e.g. `profile-file-provider-123456789`
pub(crate) fn default_session_name(base: &str) -> String {
let now = SystemTime::now()
.duration_since(UNIX_EPOCH)

View File

@ -38,10 +38,10 @@ impl AsRef<str> for Signature {
/// a signature.
///
/// Prior to signing, the following fields MUST be present in the property bag:
/// - [`SigningRegion`](SigningRegion): The region used when signing the request, eg. `us-east-1`
/// - [`SigningService`](SigningService): The name of the service to use when signing the request, eg. `dynamodb`
/// - [`SigningRegion`](SigningRegion): The region used when signing the request, e.g. `us-east-1`
/// - [`SigningService`](SigningService): The name of the service to use when signing the request, e.g. `dynamodb`
/// - [`Credentials`](Credentials): Credentials to sign with
/// - [`OperationSigningConfig`](OperationSigningConfig): Operation specific signing configuration, eg.
/// - [`OperationSigningConfig`](OperationSigningConfig): Operation specific signing configuration, e.g.
/// changes to URL encoding behavior, or headers that must be omitted.
/// If any of these fields are missing, the middleware will return an error.
///

View File

@ -50,7 +50,7 @@ pub enum PayloadChecksumKind {
#[non_exhaustive]
#[derive(Debug, Eq, PartialEq)]
pub enum PercentEncodingMode {
/// Re-encode the resulting URL (eg. %30 becomes `%2530)
/// Re-encode the resulting URL (e.g. %30 becomes `%2530)
Double,
/// Take the resulting URL as-is

View File

@ -64,7 +64,7 @@ fn parse_request(
s: &[u8],
) -> Result<Request<bytes::Bytes>, Box<dyn StdError + Send + Sync + 'static>> {
let mut headers = [httparse::EMPTY_HEADER; 64];
// httparse 1.5 requres two trailing newlines to head the header section.
// httparse 1.5 requires two trailing newlines to head the header section.
let mut with_newline = Vec::from(s);
with_newline.push(b'\n');
let mut req = httparse::Request::new(&mut headers);

View File

@ -27,9 +27,9 @@ struct Inner {
/// Credential Expiry
///
/// A timepoint at which the credentials should no longer
/// be used because they have expired. The primary purpose of this value is to allow
/// credentials to communicate to the caching provider when they need to be refreshed.
/// A SystemTime at which the credentials should no longer be used because they have expired.
/// The primary purpose of this value is to allow credentials to communicate to the caching
/// provider when they need to be refreshed.
///
/// If these credentials never expire, this value will be set to `None`
expires_after: Option<SystemTime>,

View File

@ -65,7 +65,7 @@ impl CredentialsError {
}
}
/// An unexpected error occured loading credentials from this provider
/// An unexpected error occurred loading credentials from this provider
///
/// Unhandled errors should not occur during normal operation and should be reserved for exceptional
/// cases, such as a JSON API returning an output that was not parseable as JSON.
@ -77,7 +77,7 @@ impl CredentialsError {
/// The credentials provider returned an error
///
/// Provider errors may occur during normal use of a credentials provider, eg. a 503 when
/// Provider errors may occur during normal use of a credentials provider, e.g. a 503 when
/// retrieving credentials from IMDS.
pub fn provider_error(cause: impl Into<Box<dyn Error + Send + Sync + 'static>>) -> Self {
Self::ProviderError {
@ -120,7 +120,7 @@ impl Display for CredentialsError {
)
}
CredentialsError::ProviderError { cause } => {
write!(f, "An error occured while loading credentials: {}", cause)
write!(f, "An error occurred while loading credentials: {}", cause)
}
}
}

View File

@ -54,7 +54,7 @@ class AwsReadmeDecorator : RustCodegenDecorator {
"""
## Getting Started
> Examples are availble for many services and operations, check out the
> Examples are available for many services and operations, check out the
> [examples folder in GitHub](https://github.com/awslabs/aws-sdk-rust/tree/main/sdk/examples).
The SDK provides one crate per AWS service. You must add [Tokio](https://crates.io/crates/tokio)

View File

@ -18,7 +18,7 @@ struct Opt {
#[structopt(long)]
resource_id: String,
/// The resource type, eg. "AWS::EC2::SecurityGroup"
/// The resource type, e.g. "AWS::EC2::SecurityGroup"
#[structopt(long)]
resource_type: String,

View File

@ -22,7 +22,7 @@ struct Opt {
#[structopt(short, long)]
input_file: String,
/// Whether to display additonal informmation.
/// Whether to display additional information.
#[structopt(short, long)]
verbose: bool,
}

View File

@ -17,7 +17,7 @@ struct Opt {
#[structopt(short, long)]
key: String,
/// Whether to display additonal information.
/// Whether to display additional information.
#[structopt(short, long)]
verbose: bool,
}

View File

@ -18,7 +18,7 @@ struct Opt {
#[structopt(short, long)]
key: String,
/// Whether to display additonal informmation.
/// Whether to display additional information.
#[structopt(short, long)]
verbose: bool,
}

View File

@ -18,7 +18,7 @@ struct Opt {
#[structopt(short, long)]
length: i32,
/// Whether to display additonal informmation.
/// Whether to display additional information.
#[structopt(short, long)]
verbose: bool,
}

View File

@ -32,7 +32,7 @@ struct Opt {
#[structopt(short, long)]
output_file: String,
/// Whether to display additonal runtime information.
/// Whether to display additional runtime information.
#[structopt(short, long)]
verbose: bool,
}

View File

@ -26,7 +26,7 @@ struct Opt {
#[structopt(short, long)]
secret_value: String,
/// Whether to display additonal runtime information
/// Whether to display additional runtime information
#[structopt(short, long)]
verbose: bool,
}

View File

@ -23,7 +23,7 @@ struct Opt {
#[structopt(short, long)]
name: String,
/// Whether to display additonal runtime information
/// Whether to display additional runtime information
#[structopt(short, long)]
verbose: bool,
}

View File

@ -19,7 +19,7 @@ struct Opt {
#[structopt(short, long)]
region: Option<String>,
/// Whether to display additonal runtime information
/// Whether to display additional runtime information
#[structopt(short, long)]
verbose: bool,
}

View File

@ -67,8 +67,8 @@ async fn main() {
shared_config.region().unwrap()
);
println!("Parameter name: {}", name);
println!("Paramter value: {}", parameter_value);
println!("Paramter description: {}", description);
println!("Parameter value: {}", parameter_value);
println!("Parameter description: {}", description);
tracing_subscriber::fmt::init();
}

View File

@ -3,7 +3,7 @@
This folder contains hand-written integration tests that are specific to
individual services. In order for your test to be merged into the final artifact:
- The crate name must match the generated crate name, eg. `kms`, `dynamodb`
- The crate name must match the generated crate name, e.g. `kms`, `dynamodb`
- Your test must be placed into the `tests` folder. **Everything else in your test crate is ignored.**
The contents of the `test` folder will be combined with code-generated integration

View File

@ -37,12 +37,12 @@ class RustCodegenPlugin : SmithyBuildPlugin {
Logger.getLogger(ReservedWordSymbolProvider::class.java.name).level = Level.OFF
// Discover `RustCodegenDecorators` on the classpath. `RustCodegenDectorator` return different types of
// customization. A customization is a function of:
// - location (eg. the mutate section of an operation)
// - context (eg. the of the operation)
// - location (e.g. the mutate section of an operation)
// - context (e.g. the of the operation)
// - writer: The active RustWriter at the given location
val codegenDecorator = CombinedCodegenDecorator.fromClasspath(context)
// CodegenVistor is the main driver of code generation that traverses the model and generates code
// CodegenVisitor is the main driver of code generation that traverses the model and generates code
CodegenVisitor(context, codegenDecorator).execute()
}
@ -50,7 +50,7 @@ class RustCodegenPlugin : SmithyBuildPlugin {
/** SymbolProvider
* When generating code, smithy types need to be converted into Rust typesthat is the core role of the symbol provider
*
* The Symbol provider is composed of a base `SymbolVisitor` which handles the core funcitonality, then is layered
* The Symbol provider is composed of a base `SymbolVisitor` which handles the core functionality, then is layered
* with other symbol providers, documented inline, to handle the full scope of Smithy types.
*/
fun baseSymbolProvider(
@ -59,17 +59,17 @@ class RustCodegenPlugin : SmithyBuildPlugin {
symbolVisitorConfig: SymbolVisitorConfig = DefaultConfig
) =
SymbolVisitor(model, serviceShape = serviceShape, config = symbolVisitorConfig)
// Generate different types for EventStream shapes (eg. transcribe streaming)
// Generate different types for EventStream shapes (e.g. transcribe streaming)
.let {
EventStreamSymbolProvider(symbolVisitorConfig.runtimeConfig, it, model)
}
// Generate `ByteStream` instead of `Blob` for streaming binary shapes (eg. S3 GetObject)
// Generate `ByteStream` instead of `Blob` for streaming binary shapes (e.g. S3 GetObject)
.let { StreamingShapeSymbolProvider(it, model) }
// Add Rust attributes (like `#[derive(PartialEq)]`) to generated shapes
.let { BaseSymbolMetadataProvider(it) }
// Streaming shapes need different derives (eg. they cannot derive Eq)
// Streaming shapes need different derives (e.g. they cannot derive Eq)
.let { StreamingShapeMetadataProvider(it, model) }
// Rename shapes that clash with Rust reserved words & and other SDK specific features eg. `send()` cannot
// Rename shapes that clash with Rust reserved words & and other SDK specific features e.g. `send()` cannot
// be the name of an operation input
.let { RustReservedWordSymbolProvider(it) }
}

View File

@ -27,7 +27,7 @@ sealed class RustType {
// TODO: when Kotlin supports, sealed interfaces, seal Container
/**
* A Rust type that contains [member], another RustType. Used to generically operate over
* shapes that contain other shapes, eg. [stripOuter] and [contains].
* shapes that contain other shapes, e.g. [stripOuter] and [contains].
*/
interface Container {
val member: RustType
@ -238,7 +238,7 @@ sealed class Attribute {
/**
* A custom Attribute
*
* [annotation] represents the body of the attribute, eg. `cfg(foo)` in `#[cfg(foo)]`
* [annotation] represents the body of the attribute, e.g. `cfg(foo)` in `#[cfg(foo)]`
* If [container] is set, this attribute refers to its container rather than its successor. This generates `#![cfg(foo)]`
*
* Finally, any symbols listed will be imported when this attribute is rendered. This enables using attributes like

View File

@ -67,7 +67,7 @@ private fun <T : CodeWriter, U> T.withTemplate(
* Write a block to the writer.
* If [conditional] is true, the [textBeforeNewLine], followed by [block], followed by [textAfterNewLine]
* If [conditional] is false, only [block] is written.
* This enables conditionally wrapping a block in a prefix/suffix, eg.
* This enables conditionally wrapping a block in a prefix/suffix, e.g.
*
* ```
* writer.withBlock("Some(", ")", conditional = symbol.isOptional()) {
@ -392,7 +392,7 @@ class RustWriter private constructor(
}
/**
* Generate RustDoc links, eg. [`Abc`](crate::module::Abc)
* Generate RustDoc links, e.g. [`Abc`](crate::module::Abc)
*/
inner class RustDocLinker : BiFunction<Any, String, String> {
override fun apply(t: Any, u: String): String {

View File

@ -32,11 +32,11 @@ data class CodegenContext(
*/
val serviceShape: ServiceShape,
/**
* Smithy Protocol to generate, eg. RestJson1
* Smithy Protocol to generate, e.g. RestJson1
*/
val protocol: ShapeId,
/**
* The name of the cargo crate to generate eg. `aws-sdk-s3`
* The name of the cargo crate to generate e.g. `aws-sdk-s3`
* This is loaded from the smithy-build.json during codegen.
*/
val moduleName: String,

View File

@ -27,6 +27,7 @@ import java.util.Optional
*
* This can be configured via the `runtimeConfig.version` field in smithy-build.json
*/
data class RuntimeCrateLocation(val path: String?, val version: String?) {
init {
check(path != null || version != null) {
@ -114,7 +115,7 @@ data class RuntimeType(val name: String?, val dependency: RustDependency?, val n
* Convert this [RuntimeType] into a [Symbol].
*
* This is not commonly required, but is occasionally useful when you want to force an import without referencing a type
* (eg. when bringing a trait into scope). See [CodegenWriter.addUseImports].
* (e.g. when bringing a trait into scope). See [CodegenWriter.addUseImports].
*/
fun toSymbol(): Symbol {
val builder = Symbol.builder().name(name).namespace(namespace, "::")

View File

@ -26,14 +26,14 @@ class RustCodegenPlugin : SmithyBuildPlugin {
override fun execute(context: PluginContext) {
// Suppress extremely noisy logs about reserved words
Logger.getLogger(ReservedWordSymbolProvider::class.java.name).level = Level.OFF
// Discover `RustCodegenDecorators` on the classpath. `RustCodegenDectorator` return different types of
// Discover `RustCodegenDecorators` on the classpath. `RustCodegenDecorator` return different types of
// customization. A customization is a function of:
// - location (eg. the mutate section of an operation)
// - context (eg. the of the operation)
// - location (e.g. the mutate section of an operation)
// - context (e.g. the of the operation)
// - writer: The active RustWriter at the given location
val codegenDecorator = CombinedCodegenDecorator.fromClasspath(context)
// CodegenVistor is the main driver of code generation that traverses the model and generates code
// CodegenVisitor is the main driver of code generation that traverses the model and generates code
CodegenVisitor(context, codegenDecorator).execute()
}
@ -46,15 +46,15 @@ class RustCodegenPlugin : SmithyBuildPlugin {
*/
fun baseSymbolProvider(model: Model, serviceShape: ServiceShape, symbolVisitorConfig: SymbolVisitorConfig = DefaultConfig) =
SymbolVisitor(model, serviceShape = serviceShape, config = symbolVisitorConfig)
// Generate different types for EventStream shapes (eg. transcribe streaming)
// Generate different types for EventStream shapes (e.g. transcribe streaming)
.let { EventStreamSymbolProvider(symbolVisitorConfig.runtimeConfig, it, model) }
// Generate `ByteStream` instead of `Blob` for streaming binary shapes (eg. S3 GetObject)
// Generate `ByteStream` instead of `Blob` for streaming binary shapes (e.g. S3 GetObject)
.let { StreamingShapeSymbolProvider(it, model) }
// Add Rust attributes (like `#[derive(PartialEq)]`) to generated shapes
.let { BaseSymbolMetadataProvider(it) }
// Streaming shapes need different derives (eg. they cannot derive Eq)
// Streaming shapes need different derives (e.g. they cannot derive Eq)
.let { StreamingShapeMetadataProvider(it, model) }
// Rename shapes that clash with Rust reserved words & and other SDK specific features eg. `send()` cannot
// Rename shapes that clash with Rust reserved words & and other SDK specific features e.g. `send()` cannot
// be the name of an operation input
.let { RustReservedWordSymbolProvider(it) }
}

View File

@ -42,7 +42,7 @@ open class WrappingSymbolProvider(private val base: RustSymbolProvider) : RustSy
}
/**
* Attach `meta` to symbols. `meta` is used by the generators (eg. StructureGenerator) to configure the generated models.
* Attach `meta` to symbols. `meta` is used by the generators (e.g. StructureGenerator) to configure the generated models.
*
* Protocols may inherit from this class and override the `xyzMeta` methods to modify structure generation.
*/

View File

@ -11,10 +11,10 @@ import software.amazon.smithy.rust.codegen.smithy.generators.LibRsCustomization
import software.amazon.smithy.rust.codegen.smithy.generators.LibRsSection
val ClippyAllowLints = listOf(
// Sometimes operations are named the same as our module eg. output leading to `output::output`
// Sometimes operations are named the same as our module e.g. output leading to `output::output`
"module_inception",
// Currently, we don't recase acronyms in models, eg. SSEVersion
// Currently, we don't recase acronyms in models, e.g. SSEVersion
"upper_case_acronyms",
// Large errors trigger this warning, we are unlikely to optimize this case currently

View File

@ -16,7 +16,7 @@ import software.amazon.smithy.rust.codegen.rustlang.writable
* // Sections can be state-carrying to allow implementations to make different choices based on
* // different operations
* data class RequestCreation(protocolConfig: ProtocolConfig, operation: OperationShape) : Section("RequestCreation")
* // Sections can be stateless, eg. this section that could write code into the
* // Sections can be stateless, e.g. this section that could write code into the
* // top level operation module
* object OperationModule : ServiceConfig("OperationTopLevel")
* }

View File

@ -180,7 +180,7 @@ class BuilderGenerator(
val outerType = memberSymbol.rustType()
val coreType = outerType.stripOuter<RustType.Option>()
val memberName = symbolProvider.toMemberName(member)
// Render a context-aware builder method for certain types, eg. a method for vectors that automatically
// Render a context-aware builder method for certain types, e.g. a method for vectors that automatically
// appends
when (coreType) {
is RustType.Vec -> renderVecHelper(member, memberName, coreType)

View File

@ -48,7 +48,7 @@ class EndpointTraitBindings(
* The returned expression is a `Result<EndpointPrefix, UriError>`
*/
fun render(writer: RustWriter, input: String) {
// the Rust format pattern to make the endpoint prefix eg. "{}.foo"
// the Rust format pattern to make the endpoint prefix e.g. "{}.foo"
val formatLiteral = endpointTrait.prefixFormatString()
if (endpointTrait.hostPrefix.labels.isEmpty()) {
// if there are no labels, we don't need string formatting

View File

@ -75,7 +75,7 @@ class StructureGenerator(
/**
* Search for lifetimes used by the members of the struct and generate a declaration.
* eg. `<'a, 'b>`
* e.g. `<'a, 'b>`
*/
private fun lifetimeDeclaration(): String {
val lifetimes = members

View File

@ -49,13 +49,13 @@ sealed class ServiceConfig(name: String) : Section(name) {
object ConfigStructAdditionalDocs : ServiceConfig("ConfigStructAdditionalDocs")
/**
* Struct definition of `Config`. Fields should end with `,` (eg. `foo: Box<u64>,`)
* Struct definition of `Config`. Fields should end with `,` (e.g. `foo: Box<u64>,`)
*/
object ConfigStruct : ServiceConfig("ConfigStruct")
/**
* impl block of `Config`. (eg. to add functions)
* eg.
* impl block of `Config`. (e.g. to add functions)
* e.g.
* ```kotlin
* rust("pub fn is_cross_region() -> bool { true }")
* ```
@ -70,7 +70,7 @@ sealed class ServiceConfig(name: String) : Section(name) {
/**
* Convert from a field in the builder to the final field in config
* eg.
* e.g.
* ```kotlin
* rust("""my_field: my_field.unwrap_or_else(||"default")""")
* ```

View File

@ -88,7 +88,7 @@ class CombinedErrorGenerator(
}
rust(
"""
/// An unexpected error, eg. invalid JSON returned by the service or an unknown error code
/// An unexpected error, e.g. invalid JSON returned by the service or an unknown error code
Unhandled(Box<dyn #T + Send + Sync + 'static>),
""",
RuntimeType.StdError

View File

@ -33,7 +33,7 @@ import software.amazon.smithy.rust.codegen.util.inputShape
* **Note:** There is only one real implementation of this interface. The other implementation is test only.
* All protocols use the same class.
*
* Different protocols (eg. JSON vs. XML) need to use different functionality to generate request bodies.
* Different protocols (e.g. JSON vs. XML) need to use different functionality to generate request bodies.
*/
interface ProtocolBodyGenerator {
data class BodyMetadata(val takesOwnership: Boolean)
@ -75,7 +75,7 @@ interface ProtocolTraitImplGenerator {
open class ProtocolGenerator(
codegenContext: CodegenContext,
/**
* `Protocol` contains all protocol specific information. Each smithy protocol, eg. RestJson, RestXml, etc. will
* `Protocol` contains all protocol specific information. Each smithy protocol, e.g. RestJson, RestXml, etc. will
* have their own implementation of the protocol interface which defines how an input shape becomes and http::Request
* and an output shape is build from an http::Response.
*/

View File

@ -30,7 +30,7 @@ import software.amazon.smithy.rust.codegen.smithy.protocols.serialize.Structured
/**
* Describes a protocol to the [HttpBoundProtocolGenerator].
*
* Each protocol (eg. RestXml, RestJson, etc.) will provide its own implementation of the [Protocol] interface.
* Each protocol (e.g. RestXml, RestJson, etc.) will provide its own implementation of the [Protocol] interface.
*/
interface Protocol {
/** Resolves HTTP bindings (which part of a request fields are mapped to) */

View File

@ -57,7 +57,7 @@ interface StructuredDataParserGenerator {
fun documentParser(operationShape: OperationShape): RuntimeType
/**
* Generate a parser for a server operation input structuree
* Generate a parser for a server operation input structure
* ```rust
* fn deser_operation_crate_operation_my_operation_input(
* value: &[u8], builder: my_operation_input::Builder

View File

@ -26,7 +26,7 @@ import kotlin.streams.toList
*
* This works by **adding** new shapes to the model for operation inputs & outputs. These new shapes have `SyntheticInputTrait`
* and `SyntheticOutputTrait` attached to them as needed. This enables downstream code generators to determine if a shape is
* "real" vs. a shape created as a synethic input/output.
* "real" vs. a shape created as a synthetic input/output.
*
* The trait also tracks the original shape id for certain serialization tasks that require it to exist.
*/
@ -34,7 +34,7 @@ object OperationNormalizer {
// Functions to construct synthetic shape IDs—Don't rely on these in external code.
// Rename safety: Operations cannot be renamed
// In order to ensure that the fully qualified smithy id of a synthetic shape can never conflict with an existing shape,
// the `synthetic` namespace is appened.
// the `synthetic` namespace is appended.
private fun OperationShape.syntheticInputId() =
ShapeId.fromParts(this.id.namespace + ".synthetic", "${this.id.name}Input")
@ -76,7 +76,7 @@ object OperationNormalizer {
/**
* Synthetic output shape for `operation`
* eg. `<SomeOperation>Output`
* e.g. `<SomeOperation>Output`
*
* If the operation does not have an output, an empty shape is generated
*/
@ -95,7 +95,7 @@ object OperationNormalizer {
/**
* Synthetic input shape for `operation`
* eg. `<SomeOperation>Input`
* e.g. `<SomeOperation>Input`
*
* If the input operation does not have an input, an empty shape is generated
*/

View File

@ -11,7 +11,7 @@ import software.amazon.smithy.utils.StringUtils
fun String.doubleQuote(): String = StringUtils.escapeJavaString(this, "")
/**
* Double quote a string, eg. "abc" -> "\"abc\""
* Double quote a string, e.g. "abc" -> "\"abc\""
*/
fun String.dq(): String = this.doubleQuote()

View File

@ -174,7 +174,7 @@ class StructureGeneratorTest {
writer
.withModule(
"model",
// By attaching this lint, any missing documentation becomes a compiler erorr
// By attaching this lint, any missing documentation becomes a compiler error
RustMetadata(additionalAttributes = listOf(Attribute.Custom("deny(missing_docs)")), public = true)
) {
StructureGenerator(model, provider, this, model.lookup("com.test#Inner")).render()

View File

@ -43,7 +43,7 @@ class RustWriterTest {
val sut = RustWriter.forModule("parent")
val requestBuilder = RuntimeType.HttpRequestBuilder
sut.withModule("inner") {
rustBlock("fn build(builer: #T)", requestBuilder) {
rustBlock("fn build(builder: #T)", requestBuilder) {
}
}
val httpDep = CargoDependency.Http.dependencies[0]

View File

@ -21,7 +21,7 @@ This document proposes an overhaul to the configuration design to facilitate thr
Using the SDK requires two crates:
1. `aws-sdk-<someservice>`: The service you want to use (eg. `dynamodb`, `s3`, `sesv2`)
1. `aws-sdk-<someservice>`: The service you want to use (e.g. `dynamodb`, `s3`, `sesv2`)
2. `aws-config`: AWS metaconfiguration. This crate contains all the of logic to load configuration for the SDK (regions,
credentials, retry configuration, etc.)
@ -50,7 +50,7 @@ async fn main() -> Result<(), dynamodb::Error> {
}
```
> Tip: Every AWS service exports a top level `Error` type (eg. [aws_sdk_dynamodb::Error](https://awslabs.github.io/aws-sdk-rust/aws_sdk_dynamodb/enum.Error.html)).
> Tip: Every AWS service exports a top level `Error` type (e.g. [aws_sdk_dynamodb::Error](https://awslabs.github.io/aws-sdk-rust/aws_sdk_dynamodb/enum.Error.html)).
> Individual operations return specific error types that contain only the [error variants returned by the operation](https://awslabs.github.io/aws-sdk-rust/aws_sdk_dynamodb/error/struct.ListTablesError.html).
> Because all the individual errors implement `Into<dynamodb::Error>`, you can use `dynamodb::Error` as the return type along with `?`.

View File

@ -17,7 +17,7 @@ List objects in Smithy are transformed into vectors in Rust. Based on the output
Because floats are not Hashable in Rust, for simplicity smithy-rs translates all sets to into `Vec<T>` instead of `HashSet<T>`. In the future, a breaking change may be made to introduce a library-provided wrapper type for Sets.
## Map
Because `key` MUST be a string in Smithy maps, we avoid the hashibility issue encountered with `Set`. There are optimizations that could be considered (eg. since these maps will probably never be modified), however, pending customer feedback, Smithy Maps become `HashMap<String, V>` in Rust.
Because `key` MUST be a string in Smithy maps, we avoid the hashibility issue encountered with `Set`. There are optimizations that could be considered (e.g. since these maps will probably never be modified), however, pending customer feedback, Smithy Maps become `HashMap<String, V>` in Rust.
## Structure
> See `StructureGenerator.kt` for more details

View File

@ -1,13 +1,13 @@
# Smithy
The Rust SDK uses Smithy models and code generation tooling to generate an SDK. Smithy is an open source IDL (interface design language) developed by Amazon. Although the Rust SDK uses Smithy models for AWS services, smithy-rs and Smithy models in general are not AWS specific.
Design documentation here covers both our implementation of Smithy Primitives (eg. simple shape) as well as more complex Smithy traits like [Endpoint](./endpoint.md).
Design documentation here covers both our implementation of Smithy Primitives (e.g. simple shape) as well as more complex Smithy traits like [Endpoint](./endpoint.md).
## Internals
Smithy introduces a few concepts that are defined here:
1. Shape: The core Smithy primitive. A smithy model is composed of nested shapes defining an API.
1. `Symbol`: A Representation of a type including namespaces & and any dependencies required to use a type. A shape can be converted into a symbol by a `SymbolVisitor`. A `SymbolVisitor` maps shapes to types in your programming language (eg. Rust). In the Rust SDK, see [SymbolVisitor.kt](https://github.com/awslabs/smithy-rs/blob/c049a37f8cba5f9bec2e96c28db83e7efb2edc53/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/SymbolVisitor.kt). Symbol visitors are composable—many specific behaviors are mixed in via small & focused symbol providers, eg. support for the streaming trait is mixed in separately.
1. `Symbol`: A Representation of a type including namespaces & and any dependencies required to use a type. A shape can be converted into a symbol by a `SymbolVisitor`. A `SymbolVisitor` maps shapes to types in your programming language (e.g. Rust). In the Rust SDK, see [SymbolVisitor.kt](https://github.com/awslabs/smithy-rs/blob/c049a37f8cba5f9bec2e96c28db83e7efb2edc53/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/SymbolVisitor.kt). Symbol visitors are composable—many specific behaviors are mixed in via small & focused symbol providers, e.g. support for the streaming trait is mixed in separately.
2. `Writer`: Writers are code generation primitives that collect code prior to being written to a file. Writers enable language specific helpers to be added to simplify codegen for a given language. For example, `smithy-rs` adds `rustBlock` to [`RustWriter`](https://github.com/awslabs/smithy-rs/blob/908dec558e26bbae6fe4b7d9d1c221dd81699b59/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/rustlang/RustWriter.kt) to create a "Rust block" of code.
```kotlin
writer.rustBlock("struct Model") {
@ -24,4 +24,4 @@ Smithy introduces a few concepts that are defined here:
}
```
3. Generators: A Generator, eg. `StructureGenerator`, `UnionGenerator` generates more complex Rust code from a Smithy model. Protocol generators pull these individual tools together to generate code for an entire service / protocol.
3. Generators: A Generator, e.g. `StructureGenerator`, `UnionGenerator` generates more complex Rust code from a Smithy model. Protocol generators pull these individual tools together to generate code for an entire service / protocol.

View File

@ -4,4 +4,4 @@ Signing, endpoint specification, and logging are all handled as middleware. The
Middleware is defined as minimally as possible, then adapted into the middleware system used by the IO layer. Tower is the de facto standard for HTTP middleware in Rust—we will probably use it. But we also want to make our middleware usable for users who aren't using Tower (or if we decide to not use Tower in the long run).
Because of this, rather than implementing all our middleware as "Tower Middleware", we implement it narrowly (eg. as a function that operates on `operation::Request`), then define optional adapters to make our middleware tower compatible.
Because of this, rather than implementing all our middleware as "Tower Middleware", we implement it narrowly (e.g. as a function that operates on `operation::Request`), then define optional adapters to make our middleware tower compatible.

View File

@ -18,7 +18,7 @@ use tower::BoxError;
/// SDK never attempted to dispatch the underlying `http::Request`. These represent errors that
/// occurred during the request construction pipeline. These generally stem from configuration issues.
/// 2. [`RequestDispatchError`](SendOperationError::RequestDispatchError): Errors where the inner
/// tower service failed (eg. because the hostname couldn't be resolved, connection errors,
/// tower service failed (e.g. because the hostname couldn't be resolved, connection errors,
/// socket hangup etc.). In this case, we don't know how much of the request was _actually_ sent
/// to the client. We only know that we never got back an `http::Response` (and instead got an error).
///
@ -30,7 +30,7 @@ use tower::BoxError;
pub enum SendOperationError {
/// The request could not be constructed
///
/// These errors usually stem from configuration issues (eg. no region, bad credential provider, etc.)
/// These errors usually stem from configuration issues (e.g. no region, bad credential provider, etc.)
RequestConstructionError(BoxError),
/// The request could not be dispatched

View File

@ -44,10 +44,10 @@ pub struct Parts<H, R> {
pub metadata: Option<Metadata>,
}
/// An error occured attempting to build an `Operation` from an input
/// An error occurred attempting to build an `Operation` from an input
///
/// These are almost always due to user error caused by limitations of specific fields due to
/// protocol serialization (eg. fields that can only be a subset ASCII because they are serialized
/// protocol serialization (e.g. fields that can only be a subset ASCII because they are serialized
/// as the name of an HTTP header)
#[non_exhaustive]
#[derive(Debug, Error)]

View File

@ -50,7 +50,7 @@ pub trait ParseHttpResponse {
/// APIs like AwsJson 1.0/1.1 and the error path of most streaming APIs
///
/// Using an explicit body type of Bytes here is a conscious decision—If you _really_ need
/// to precisely control how the data is loaded into memory (eg. by using `bytes::Buf`), implement
/// to precisely control how the data is loaded into memory (e.g. by using `bytes::Buf`), implement
/// your handler in `parse_unloaded`.
///
/// Production code will never call `parse_loaded` without first calling `parse_unloaded`. However,

View File

@ -23,7 +23,7 @@ type BoxError = Box<dyn Error + Send + Sync>;
/// Successful SDK Result
#[derive(Debug)]
pub struct SdkSuccess<O> {
/// Raw Response from the service. (eg. Http Response)
/// Raw Response from the service. (e.g. Http Response)
pub raw: operation::Response,
/// Parsed response from the service
@ -93,7 +93,7 @@ impl ConnectorError {
}
}
/// Construct a [`ConnectorError`] from an error caused by the user (eg. invalid HTTP request)
/// Construct a [`ConnectorError`] from an error caused by the user (e.g. invalid HTTP request)
pub fn user(err: BoxError) -> Self {
Self {
err,
@ -101,7 +101,7 @@ impl ConnectorError {
}
}
/// Construct a [`ConnectorError`] from an IO related error (eg. socket hangup)
/// Construct a [`ConnectorError`] from an IO related error (e.g. socket hangup)
pub fn io(err: BoxError) -> Self {
Self {
err,
@ -148,7 +148,7 @@ enum ConnectorErrorKind {
/// A timeout occurred while processing the request
Timeout,
/// A user-caused error (eg. invalid HTTP request)
/// A user-caused error (e.g. invalid HTTP request)
User,
/// Socket/IO error

View File

@ -14,7 +14,7 @@ pub fn run_data(data: &[u8]) {
aws_smithy_json::deserialize::json_token_iter(data).collect::<Result<Vec<Token>, Error>>()
{
// Exercise string unescaping since the later comparison against Serde
// reserializes, and thus, loses UTF-16 surrogate pairs.
// re-serializes, and thus, loses UTF-16 surrogate pairs.
for token in tokens {
if let Token::ValueString { value, .. } = token {
if let Ok(unescaped) = value.to_unescaped() {

View File

@ -45,7 +45,7 @@ pub(crate) mod http_date {
///
/// Some notes:
/// - HTTP date does not support years before `0000`—this will cause a panic.
/// - If you _don't_ want subsecond precision (eg. if you want strict adherence to the spec),
/// - If you _don't_ want subsecond precision (e.g. if you want strict adherence to the spec),
/// you need to zero-out the instant before formatting
/// - If subsecond nanos are 0, no fractional seconds are added
/// - If subsecond nanos are nonzero, 3 digits of fractional seconds are added

View File

@ -44,7 +44,7 @@ pub enum ErrorKind {
pub trait ProvideErrorKind {
/// Returns the `ErrorKind` when the error is modeled as retryable
///
/// If the error kind cannot be determined (eg. the error is unmodeled at the error kind depends
/// If the error kind cannot be determined (e.g. the error is unmodeled at the error kind depends
/// on an HTTP status code, return `None`.
fn retryable_error_kind(&self) -> Option<ErrorKind>;
@ -66,7 +66,7 @@ pub enum RetryKind {
/// Retry the associated request due to a known `ErrorKind`.
Error(ErrorKind),
/// An Explicit retry (eg. from `x-amz-retry-after`).
/// An Explicit retry (e.g. from `x-amz-retry-after`).
///
/// Note: The specified `Duration` is considered a suggestion and may be replaced or ignored.
Explicit(Duration),

View File

@ -58,7 +58,7 @@ impl Name<'_> {
#[derive(Debug, PartialEq)]
pub struct Attr<'a> {
name: Name<'a>,
// attribute values can be escaped (eg. with double quotes, so we need a Cow)
// attribute values can be escaped (e.g. with double quotes, so we need a Cow)
value: Cow<'a, str>,
}

View File

@ -23,7 +23,7 @@ impl Display for Error {
///
/// XmlWriter (and friends) make generating an invalid XML document a type error. Nested branches
/// of the Xml document mutable borrow from the root. You cannot continue writing to the root
/// until the nested branch is dropped and dropping the nested branch writes the terminator (eg.
/// until the nested branch is dropped and dropping the nested branch writes the terminator (e.g.
/// closing element).
///
/// The one exception to this rule is names—it is possible to construct an invalid Xml Name. However,

View File

@ -29,7 +29,7 @@ pub fn unescape(s: &str) -> Result<Cow<str>, XmlError> {
res.push_str(prefix);
}
for section in sections {
// entites look like &<somedata>;
// entities look like &<somedata>;
match section.find(';') {
Some(idx) => {
let entity = &section[..idx];
@ -40,11 +40,11 @@ pub fn unescape(s: &str) -> Result<Cow<str>, XmlError> {
"quot" => res.push('"'),
"apos" => res.push('\''),
entity => {
// eg. &#xD;
// e.g. &#xD;
let (entity, radix) = if let Some(entity) = entity.strip_prefix("#x") {
(entity, 16)
} else if let Some(entity) = entity.strip_prefix("#") {
// eg. &#123;
// e.g. &#123;
(entity, 10)
} else {
return Err(XmlError::InvalidEscape {