Skip to content

fix: Don't unwrap unneeded value during event marshal #839

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

Merged
merged 5 commits into from
Oct 16, 2024

Conversation

jbelkins
Copy link
Contributor

Description of changes

Quiets a warning that occurs when an event to be marshalled is unwrapped but not accessed.

Also adds some comments to help clear up what's going on in the marshal generated code.

Scope

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

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

@@ -27,7 +27,6 @@ class MessageMarshallableGenerator(
) {
internal fun render(streamShape: UnionShape) {
val streamSymbol: Symbol = ctx.symbolProvider.toSymbol(streamShape)
val rootNamespace = ctx.settings.moduleName
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unused var

@@ -50,10 +49,12 @@ class MessageMarshallableGenerator(
write("switch self {")
streamShape.eventStreamEvents(ctx.model).forEach { member ->
val memberName = ctx.symbolProvider.toMemberName(member)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The code below is largely just reordered to find all the bindings, then render the right Swift enum case (with or without value unwrapped), then actually render the bindings.

The if-else is really the only new code.

@jbelkins jbelkins marked this pull request as ready for review October 15, 2024 21:26
@jbelkins jbelkins requested a review from sichanyoo October 16, 2024 14:55
@sichanyoo sichanyoo self-requested a review October 16, 2024 16:26
@jbelkins jbelkins merged commit bf680c3 into main Oct 16, 2024
27 checks passed
@jbelkins jbelkins deleted the jbe/marshal_warning_fix branch October 16, 2024 16:41
jbelkins added a commit that referenced this pull request Oct 29, 2024
author Josh Elkins <jbelkins@amazon.com> 1725075023 -0500
committer Josh Elkins <jbelkins@amazon.com> 1730244524 -0500

parent 0de1791
author Josh Elkins <jbelkins@amazon.com> 1725075023 -0500
committer Josh Elkins <jbelkins@amazon.com> 1730244464 -0500

parent 0de1791
author Josh Elkins <jbelkins@amazon.com> 1725075023 -0500
committer Josh Elkins <jbelkins@amazon.com> 1730244451 -0500

parent 0de1791
author Josh Elkins <jbelkins@amazon.com> 1725075023 -0500
committer Josh Elkins <jbelkins@amazon.com> 1730244433 -0500

parent 0de1791
author Josh Elkins <jbelkins@amazon.com> 1725075023 -0500
committer Josh Elkins <jbelkins@amazon.com> 1730244416 -0500

parent 0de1791
author Josh Elkins <jbelkins@amazon.com> 1725075023 -0500
committer Josh Elkins <jbelkins@amazon.com> 1730244397 -0500

parent 0de1791
author Josh Elkins <jbelkins@amazon.com> 1725075023 -0500
committer Josh Elkins <jbelkins@amazon.com> 1730244381 -0500

parent 0de1791
author Josh Elkins <jbelkins@amazon.com> 1725075023 -0500
committer Josh Elkins <jbelkins@amazon.com> 1730244297 -0500

parent 0de1791
author Josh Elkins <jbelkins@amazon.com> 1725075023 -0500
committer Josh Elkins <jbelkins@amazon.com> 1730244277 -0500

WIP

chore: Organize codegen tests & Kotlin unit tests (#830)

* Organize codegen tests & refactor setup tests for XML codegen tests to reduce duplicate code.

* ktlint

---------

Co-authored-by: Sichan Yoo <chanyoo@amazon.com>

feat: Make models Sendable (#829)

chore: Specify Xcode_16 application name same as on Github runner (#831)

chore: Move HTTP status code test out of SmithyTestUtil (#836)

chore: Protocol tests set their own AWS credentials (#837)

Don't import Darwin on Windows. (#835)

chore: Run macOS 15 with Xcode 16 on CI (#838)

fix: Don't unwrap unneeded value during event marshal (#839)

fix: Don't supply a default value when reading a non-optional value (#840)

feat: Enable sigv4a for SESv2 service (#842)

feat!: Bump CRT version to 0.37.0 & add CRC64NVME checksum algorithm wrapper (#845)

* Bump CRT version to 0.37.0 and add wrapper for new checksum algorithm.

* Add doc comment re: checksum algorithms may expand in future.

---------

Co-authored-by: Sichan Yoo <chanyoo@amazon.com>

chore: Use Smithy 1.52.1 (#846)

feat: Smoke Tests V2 (#841)

* Basic scaffold.

* Add SmokeTestGenerator for generic Smithy spec, with customization points via open functions.

* Refactor both codegen logic and generated code to fix runtime / compile errors in generated code.

* Generate test runner only if there's >=1 test case(s) for the service. Narrow down imports to specific class used.

* Add manual ignore lists for disabling codegen for smoke tests by their test ID or their test tag.

* Add generic codegen for smoke tests

* Rename variables to be more specific.

---------

Co-authored-by: Sichan Yoo <chanyoo@amazon.com>

chore: Updates version to 0.86.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants