Skip to content

Fix matchers to align with waiters SEP #3242

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

Open
wants to merge 8 commits into
base: version-3
Choose a base branch
from

Conversation

richardwang1124
Copy link
Contributor

@richardwang1124 richardwang1124 commented May 5, 2025

Add support for matching expected value type of object for waiters.


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

  1. To make sure we include your contribution in the release notes, please make sure to add description entry for your changes in the "unreleased changes" section of the CHANGELOG.md file (at corresponding gem). For the description entry, please make sure it lives in one line and starts with Feature or Issue in the correct format.

  2. For generated code changes, please checkout below instructions first:
    https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md

Thank you for your contribution!

@aws aws deleted a comment from github-actions bot May 5, 2025
@aws aws deleted a comment from github-actions bot May 5, 2025
@aws aws deleted a comment from github-actions bot May 5, 2025
Copy link
Contributor

@jterapin jterapin left a comment

Choose a reason for hiding this comment

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

Lookin' good! Thank you for picking up on this work.

Copy link
Contributor

@jterapin jterapin left a comment

Choose a reason for hiding this comment

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

Looks great!

Comment on lines +380 to +381
client.stub_responses(:waiter_operation,
table_list: [{ table_status: 'ACTIVE' }, { table_status: 'ACTIVE' }])
Copy link
Contributor

Choose a reason for hiding this comment

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

Could fix the alignment like so - I think rubocop will ok with the below:

Suggested change
client.stub_responses(:waiter_operation,
table_list: [{ table_status: 'ACTIVE' }, { table_status: 'ACTIVE' }])
client.stub_responses(
:waiter_operation,
table_list: [ { table_status: 'ACTIVE' }, { table_status: 'ACTIVE' }]
)

Comment on lines +281 to +297
object = {
object_member: {
string_member: 'string'
},
string_member: 'string',
number_member: 1,
boolean_member: true,
array_member: [1, 2, 3],
object_array_member: [
{
object_member: {
string_member: 'string'
},
string_member: 'string'
}
]
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: could reduce the number of lines here like so - I think. If you do decide to reformat, you might as well do it for others as well

Suggested change
object = {
object_member: {
string_member: 'string'
},
string_member: 'string',
number_member: 1,
boolean_member: true,
array_member: [1, 2, 3],
object_array_member: [
{
object_member: {
string_member: 'string'
},
string_member: 'string'
}
]
}
object = {
object_member: { string_member: 'string' },
string_member: 'string',
number_member: 1,
boolean_member: true,
array_member: [1, 2, 3],
object_array_member: [
{
object_member: { string_member: 'string' },
string_member: 'string'
}
]
}

Comment on lines +468 to +469
client.stub_responses(:waiter_operation,
table_list: [{ table_status: 'FAILED' }, { table_status: 'ACTIVE' }])
Copy link
Contributor

Choose a reason for hiding this comment

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

Alignment here as well

@@ -1,6 +1,8 @@
Unreleased Changes
------------------

* Issue - Fix waiter matchers to cover object expected value type.
Copy link
Contributor

Choose a reason for hiding this comment

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

I didn't see any changes in the lib - so we won't need this changelog. Also - was there any diffs when you rake build all the service gems?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, no changelog is needed here.

@jterapin jterapin self-requested a review May 10, 2025 04:10
Copy link
Contributor

@mullermp mullermp left a comment

Choose a reason for hiding this comment

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

Seems fine. Feel free to do the suggested cleanups.

@@ -82,6 +82,12 @@ def acceptors(acceptors)
acceptor['argument']
)
end
case acceptor['expected']
Copy link
Contributor

Choose a reason for hiding this comment

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

You can simplify this by calling your convert_value method.

Comment on lines +102 to +103
converted_key = convert_key(key)
result[converted_key] = convert_value(value)
Copy link
Contributor

Choose a reason for hiding this comment

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

You can single line this.

# Convert keys for every object in array
def convert_array(array)
array.map do |elem|
elem.is_a?(Hash) ? convert_keys(elem) : elem
Copy link
Contributor

Choose a reason for hiding this comment

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

You can just call convert_value here right? I would do array.collect { |e| convert_value(e) }

@@ -1,6 +1,8 @@
Unreleased Changes
------------------

* Issue - Fix waiter matchers to cover object expected value type.
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, no changelog is needed here.

@@ -27,7 +27,13 @@
"type":"structure",
"members":{
"Table":{"shape":"TableDescription"},
"TableList":{"shape":"TableList"}
Copy link
Contributor

Choose a reason for hiding this comment

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

This example was pretty much retrofitted by dynamodb. If it's not too much trouble, we should probably slightly rewrite this - maybe we can do away with the "Table" concepts, make the operation just called operation, etc. Isn't TableList just the same as ObjectList pretty much?

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