File tree Expand file tree Collapse file tree 3 files changed +13
-28
lines changed
codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols Expand file tree Collapse file tree 3 files changed +13
-28
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ import software.amazon.smithy.rust.codegen.core.testutil.asSmithyModel
1111
1212class AwsQueryTest {
1313 private val model =
14- """
14+ """
1515 namespace test
1616 use aws.protocols#awsQuery
1717
@@ -34,8 +34,8 @@ class AwsQueryTest {
3434 }
3535 """ .asSmithyModel()
3636
37- private val modelWithEmptyStruct =
38- """
37+ private val inputUnionWithEmptyStructure =
38+ """
3939 namespace test
4040 use aws.protocols#awsQuery
4141
@@ -47,18 +47,13 @@ class AwsQueryTest {
4747 }
4848
4949 operation TestOp {
50- input: TestInput,
51- output: TestOutput
50+ input: TestInput
5251 }
5352
5453 structure TestInput {
5554 testUnion: TestUnion
5655 }
5756
58- structure TestOutput {
59- testUnion: TestUnion
60- }
61-
6257 union TestUnion {
6358 // Empty struct - should generate _inner to avoid unused variable warning
6459 emptyStruct: EmptyStruct,
@@ -83,6 +78,6 @@ class AwsQueryTest {
8378 fun `union with empty struct generates warning-free code` () {
8479 // This test will fail with unused variable warnings if the fix is not applied
8580 // clientIntegrationTest enforces -D warnings via codegenIntegrationTest
86- clientIntegrationTest(modelWithEmptyStruct ) { _, _ -> }
81+ clientIntegrationTest(inputUnionWithEmptyStructure ) { _, _ -> }
8782 }
8883}
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ import software.amazon.smithy.rust.codegen.core.testutil.asSmithyModel
1111
1212internal class RestJsonTest {
1313 val model =
14- """
14+ """
1515 namespace test
1616 use aws.protocols#restJson1
1717 use aws.api#service
@@ -39,8 +39,8 @@ internal class RestJsonTest {
3939 }
4040 """ .asSmithyModel()
4141
42- private val modelWithEmptyStruct =
43- """
42+ private val inputUnionWithEmptyStructure =
43+ """
4444 namespace test
4545 use aws.protocols#restJson1
4646 use aws.api#service
@@ -54,18 +54,13 @@ internal class RestJsonTest {
5454
5555 @http(uri: "/test", method: "POST")
5656 operation TestOp {
57- input: TestInput,
58- output: TestOutput
57+ input: TestInput
5958 }
6059
6160 structure TestInput {
6261 testUnion: TestUnion
6362 }
6463
65- structure TestOutput {
66- testUnion: TestUnion
67- }
68-
6964 union TestUnion {
7065 // Empty struct - RestJson ALWAYS uses inner variable, no warning
7166 emptyStruct: EmptyStruct,
@@ -92,6 +87,6 @@ internal class RestJsonTest {
9287 // Unlike RestXml/AwsQuery, RestJson serializers always reference the inner variable
9388 // even for empty structs, so no underscore prefix is needed.
9489 // This test passes without any code changes, proving RestJson immunity.
95- clientIntegrationTest(modelWithEmptyStruct ) { _, _ -> }
90+ clientIntegrationTest(inputUnionWithEmptyStructure ) { _, _ -> }
9691 }
9792}
Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ internal class RestXmlTest {
8383
8484 """ .asSmithyModel()
8585
86- private val modelWithEmptyStruct =
86+ private val inputUnionWithEmptyStructure =
8787 """
8888 namespace test
8989 use aws.protocols#restXml
@@ -98,18 +98,13 @@ internal class RestXmlTest {
9898
9999 @http(uri: "/test", method: "POST")
100100 operation TestOp {
101- input: TestInput,
102- output: TestOutput
101+ input: TestInput
103102 }
104103
105104 structure TestInput {
106105 testUnion: TestUnion
107106 }
108107
109- structure TestOutput {
110- testUnion: TestUnion
111- }
112-
113108 union TestUnion {
114109 // Empty struct - should generate _inner to avoid unused variable warning
115110 emptyStruct: EmptyStruct,
@@ -133,6 +128,6 @@ internal class RestXmlTest {
133128 fun `union with empty struct generates warning-free code` () {
134129 // This test will fail with unused variable warnings if the fix is not applied
135130 // clientIntegrationTest enforces -D warnings via codegenIntegrationTest
136- clientIntegrationTest(modelWithEmptyStruct ) { _, _ -> }
131+ clientIntegrationTest(inputUnionWithEmptyStructure ) { _, _ -> }
137132 }
138133}
You can’t perform that action at this time.
0 commit comments