-
Notifications
You must be signed in to change notification settings - Fork 916
Add logic to handle number acceptors #5813
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
Conversation
4fb548f
to
cd55716
Compare
...es-test/src/test/java/software/amazon/awssdk/services/waiters/WaitersSyncFunctionalTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add tests in codegen
for generated waiters that use numbers?
...gen/src/main/java/software/amazon/awssdk/codegen/poet/waiters/JmesPathAcceptorGenerator.java
Outdated
Show resolved
Hide resolved
codegen/src/main/java/software/amazon/awssdk/codegen/jmespath/component/Literal.java
Outdated
Show resolved
Hide resolved
.changes/next-release/feature-AWSSDKforJavav2waiters-0c835d2.json
Outdated
Show resolved
Hide resolved
codegen/src/main/java/software/amazon/awssdk/codegen/internal/Jackson.java
Show resolved
Hide resolved
codegen/src/main/java/software/amazon/awssdk/codegen/poet/waiters/BaseWaiterClassSpec.java
Outdated
Show resolved
Hide resolved
...gen/src/main/resources/software/amazon/awssdk/codegen/jmespath/JmesPathRuntime.java.resource
Show resolved
Hide resolved
test/codegen-generated-classes-test/src/main/resources/codegen-resources/waiters/service-2.json
Outdated
Show resolved
Hide resolved
...st/src/test/java/software/amazon/awssdk/services/retry/RetryStrategySetupUsingRetryMode.java
Outdated
Show resolved
Hide resolved
CodeBlock.Builder builder = CodeBlock.builder() | ||
.add("response -> {") | ||
.add("$1T input = new $1T(response);", poetExtensions.jmesPathRuntimeClass().nestedClass("Value")) | ||
.add("$T<$T> resultValues = ", List.class, Object.class) | ||
.add(jmesPathAcceptorGenerator.interpret(acceptor.getArgument(), "input")) | ||
.add(".values();") | ||
.add("return !resultValues.isEmpty() &&" | ||
+ " resultValues.stream().anyMatch(v " + "-> $T.equals" | ||
+ "(v, ", Objects.class); | ||
|
||
if (isNumber) { | ||
builder.add("new $T($S)", BigDecimal.class, expected); | ||
} else if (isString) { | ||
builder.add("$S", expected); | ||
} else { | ||
builder.add("$L", expected); | ||
} | ||
|
||
builder.add("));") | ||
.add("}"); | ||
|
||
return builder.build(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make the same change as in pathAcceptorBody
to make it more readable?
<dependency> | ||
<groupId>backport-util-concurrent</groupId> | ||
<artifactId>backport-util-concurrent</artifactId> | ||
<version>3.1</version> | ||
<scope>test</scope> | ||
</dependency> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's this dependency for?
Can we merge in master and run integ tests again? |
02d1597
to
f0e7e22
Compare
f0e7e22
to
6d859e2
Compare
|
Motivation and Context
Currently the Java SDK waiter matcher acceptor only support Integers. According to the cross SDK spec waiter matcher acceptor must support all number types.
Modifications
Testing