smithy-lang / smithy-rs

Code generation for the AWS SDK for Rust, as well as server and generic smithy client generation.
Apache License 2.0
507 stars 190 forks source link

fix: update test operation generator to find any operation in the service closure #3922

Open mcmasn-amzn opened 22 hours ago

mcmasn-amzn commented 22 hours ago

Motivation and Context

When using operations nested under resources, the current search will raise "NoSuchElementException". This fixes the search to include all operations within the service closure

Description

The error is visible in client generates like this:

Projection rust-client failed: java.util.NoSuchElementException: Collection contains no element matching the predicate.
java.util.NoSuchElementException: Collection contains no element matching the predicate.
        at software.amazon.smithy.rustsdk.endpoints.OperationInputTestGeneratorKt.operationId(OperationInputTestGenerator.kt:242)
        at software.amazon.smithy.rustsdk.endpoints.OperationInputTestGenerator$operationInvocation$1.invoke(OperationInputTestGenerator.kt:183)
        at software.amazon.smithy.rustsdk.endpoints.OperationInputTestGenerator$operationInvocation$1.invoke(OperationInputTestGenerator.kt:180)

Testing

gradle :aws:sdk-codegen:check

Checklist


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