Skip to content

Conversation

lauzadis
Copy link
Contributor

@lauzadis lauzadis commented Jan 21, 2025

Issue #

Description of changes

This change is required to comply with Smithy protocol tests which assert that empty header values are sent.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@lauzadis lauzadis requested a review from a team as a code owner January 21, 2025 15:29
@lauzadis lauzadis changed the title misc: Allow serializing empty headers fix: Allow serializing empty headers Jan 21, 2025
@lauzadis lauzadis added the no-changelog Indicates that a changelog entry isn't required for a pull request. Use sparingly. label Jan 21, 2025

This comment has been minimized.

1 similar comment

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

@lauzadis lauzadis changed the title fix: Allow serializing empty headers fix: address various failing protocol tests Jan 21, 2025

This comment has been minimized.

Comment on lines 252 to 254
if (builderMemberSymbol.shape is BlobShape && builderMemberSymbol.isNotNullable) {
writer.addImport(RuntimeTypes.Core.Text.Encoding.decodeBase64)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

decodeBase64 is used in KotlinSymbolProvider, but we don't have access to the KotlinWriter there, so the import gets added here if necessary. Any other ideas to work around this?

Copy link
Contributor

Choose a reason for hiding this comment

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

Correct, we don't have a KotlinWriter (nor should we) in KotlinSymbolProvider. But we're still providing symbols and symbols can declare additional imports. We should be setting up those references before returning from the symbol provider.

This probably means a bit of a light refactor in the symbol provider since it's mostly slinging text strings around and wrapping it into a symbol right before returning. But we probably need better awareness of non-textual symbol info in places like getDefaultValue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did a minimal refactor to give getDefaultValue access to the Symbol being built, calling addReferences where appropriate

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

targetShape.isBlobShape -> "${node.toString().dq()}.encodeToByteArray()"
targetShape.isBlobShape -> "${node.toString().dq()}.decodeBase64().encodeToByteArray()"
Copy link
Contributor

Choose a reason for hiding this comment

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

Question: Don't we need this for streaming targets too? (i.e., the when branch above this one)

Comment on lines 252 to 254
if (builderMemberSymbol.shape is BlobShape && builderMemberSymbol.isNotNullable) {
writer.addImport(RuntimeTypes.Core.Text.Encoding.decodeBase64)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Correct, we don't have a KotlinWriter (nor should we) in KotlinSymbolProvider. But we're still providing symbols and symbols can declare additional imports. We should be setting up those references before returning from the symbol provider.

This probably means a bit of a light refactor in the symbol provider since it's mostly slinging text strings around and wrapping it into a symbol right before returning. But we probably need better awareness of non-textual symbol info in places like getDefaultValue.

Copy link

Affected Artifacts

Changed in size
Artifact Pull Request (bytes) Latest Release (bytes) Delta (bytes) Delta (percentage)
runtime-core-jvm.jar 818,816 818,677 139 0.02%

@lauzadis lauzadis merged commit 8b33693 into main Jan 23, 2025
16 checks passed
xinsong-cui added a commit that referenced this pull request Jan 31, 2025
* fix: add 0.9.x aws-crt-kotlin transform (#1220)

* fix: Ensure `Host` header is included when signing auth tokens (#1222)

* chore: release 1.4.1

* chore: bump snapshot version to 1.4.2-SNAPSHOT

* fix: address various failing protocol tests (#1223)

* misc: re-enable `kotlinWarningsAsErrors=true` (#1224)

* fix: ignore hop-by-hop headers when signing requests (#1227)

* chore: release 1.4.2

* chore: bump snapshot version to 1.4.3-SNAPSHOT

* misc: add telemetry configuration to DefaultAwsSigner (#1226)

* add telemetry provider configuration

* lint

* address pr reviews

* add changelog

---------

Co-authored-by: Matas <[email protected]>
Co-authored-by: aws-sdk-kotlin-ci <[email protected]>
Co-authored-by: Ian Botsford <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-changelog Indicates that a changelog entry isn't required for a pull request. Use sparingly.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants