Skip to content
Unverified Commit f50c8eb9 authored by Aaron Todd's avatar Aaron Todd Committed by GitHub
Browse files

remove sdkId transform by default (#4064)

## Motivation and Context
fixes https://github.com/awslabs/aws-sdk-rust/issues/1252

## Description
The service ID we [were
setting](https://github.com/smithy-lang/smithy-rs/blob/5f7113f506f301296311ef637e40d226e0a6e548/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/ServiceEnvConfigDecorator.kt#L27)
for service specific environment configuration was wrong. It was wrong
in two ways:

1. The
[sdkId](https://github.com/smithy-lang/smithy-rs/blob/7db3e9f08e422e386c56d5916c69ab495d739ee8/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/util/Smithy.kt#L157)
extension we defined strips whitespace and lowercases the ID from the
model.
2. It also used `toSnakeCase()` which will not have the same effect as
internally that uses `splitOnWordBoundaries` which uses heuristics to
determine where a word boundary is and isn't restricted to spaces.

It looks like we've always applied this transform to sdkId from what I
can tell with the original use being to set the operation metadata for
the service name and it was carried through when making an extension.
This PR makes `sdkId()` return the ID from the model untouched. I think
this is the safest default as remembering when you can use the extension
vs not is error prone. Any required/desired transformations should be
done localized to where it's used. In this case the
`ServiceEnvConfigDecorator` doesn't need to transform sdkId as the
[runtime already does
it](https://github.com/smithy-lang/smithy-rs/blob/d1bbd018618da9ab8f8bdb1f27d9ec75c42d2505/aws/rust-runtime/aws-runtime/src/env_config.rs#L351)

## Testing

Tested on the bedrock-agent and bedrock-agent-runtime models described
in the issue

## Questions

There were only four uses of the `sdkId()` function I could find:
1. Operation metadata
2. Span names
3. Service env config
4. Default retry partition naming

I think this is a safe change though it will result in different log
output. Unclear if anyone would be predicating off service name if we
expose it anywhere (e.g. in an interceptor).

## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] For changes to the AWS SDK, generated SDK code, or SDK runtime
crates, I have created a changelog entry Markdown file in the
`.changelog` directory, specifying "aws-sdk-rust" in the `applies_to`
key.

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
parent f10556df
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment