Skip to content
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

[ProtocolTests] query sub object serialization refactor #3331

Merged
merged 3 commits into from
Mar 12, 2025

Conversation

SergeyRyabinin
Copy link
Contributor

@SergeyRyabinin SergeyRyabinin commented Mar 6, 2025

Issue #, if available:
Protocol tests implementation
Description of changes:
Refactor query sub-object serialization to avoid template duplication

It generates an ugly diff on base64 blob serialization, but it is expected:

  • base64 may contain + and / characters;
  • these characters are reserved per rfc3986 and must be %-encoded. This was done for few cases originally of base64-encodind, but not all, and since this PR unifies how elements are serialized - this effect occurs.

Also it generates an ugly diff on enum serialization, the issue is the same: sometimes we were rfc-encoding enums, sometimes not. While service model owners might be responsible for having their enums rfc-compliant, it is a safer bet for SDK to be compliant and consistent on enum encoding.

Check all that applies:

  • Did a review by yourself.
  • Added proper tests to cover this PR. (If tests are not applicable, explain.)
  • Checked if this PR is a breaking (APIs have been changed) change.
  • Checked if this PR will not introduce cross-platform inconsistent behavior.
  • Checked if this PR would require a ReadMe/Wiki update.

Check which platforms you have built SDK on to verify the correctness of this PR.

  • Linux
  • Windows
  • Android
  • MacOS
  • IOS
  • Other Platforms

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

SergeyRyabinin added a commit that referenced this pull request Mar 6, 2025
@SergeyRyabinin SergeyRyabinin force-pushed the sr/querySubObj branch 2 times, most recently from 9471917 to f874744 Compare March 6, 2025 20:57
SergeyRyabinin added a commit that referenced this pull request Mar 6, 2025
@SergeyRyabinin SergeyRyabinin marked this pull request as ready for review March 6, 2025 21:08
SergeyRyabinin added a commit that referenced this pull request Mar 6, 2025
@SergeyRyabinin SergeyRyabinin force-pushed the sr/querySubObj branch 3 times, most recently from 33434de to a7bd3e0 Compare March 7, 2025 22:41
SergeyRyabinin added a commit that referenced this pull request Mar 7, 2025
SergeyRyabinin added a commit that referenced this pull request Mar 10, 2025
SergeyRyabinin added a commit that referenced this pull request Mar 10, 2025
smithy::client::JsonOutcome,
Aws::Client::JsonProtocolErrorMarshaller>,
Aws::Client::ClientWithAsyncTemplateMethods<JsonProtocolClient>
class AWS_JSONPROTOCOL_API JsonProtocolClient : public Aws::Client::AWSJsonClient, public Aws::Client::ClientWithAsyncTemplateMethods<JsonProtocolClient>
Copy link
Contributor

Choose a reason for hiding this comment

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

looks like the smithy refactor rollback had unintended consequences here. how should the "protocol clients" handle this migrations/should they?

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'd say it was a miss when we did the revert.
Once tests are stable - they will be added to a regular regeneration and build-execution list.

SergeyRyabinin added a commit that referenced this pull request Mar 11, 2025
#elseif($metadata.findFirstSupportedProtocol() == "ec2")
#set($macro.listLocation = $location)
#elseif($member.shape.listMember.locationName)
#set($macro.listLocation = $location + "." + $member.shape.listMember.locationName)
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it handle nested structures?
Meaning if A has B has C has D, will it appropriately generate the accessor location?

Copy link
Contributor

@sbera87 sbera87 left a comment

Choose a reason for hiding this comment

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

One generic comment I have is to consider as food for thought if it's better to generate different classes following appropriate design pattern to handle 'ec2' vs rest cases. The different classes would come from smaller template files for ec2 vs rest cases. This can help maintainability (due to less branching in code) and readability.

@SergeyRyabinin SergeyRyabinin merged commit 87e263d into main Mar 12, 2025
3 of 4 checks passed
@SergeyRyabinin SergeyRyabinin deleted the sr/querySubObj branch March 12, 2025 16:43
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.

3 participants