File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed
tests/compile/src/test/kotlin/software/amazon/smithy/kotlin/codegen Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -224,6 +224,45 @@ class SmithySdkTest {
224224
225225 assertEquals(KotlinCompilation .ExitCode .OK , compilationResult.exitCode, compileOutputStream.toString())
226226 }
227+
228+ // https://github.com/smithy-lang/smithy-kotlin/issues/1129
229+ @Test
230+ fun `it compiles models with unions with members that have the same name as the union` () {
231+ val model = """
232+ namespace aws.sdk.kotlin.test
233+
234+ use aws.protocols#awsJson1_0
235+ use smithy.rules#operationContextParams
236+ use smithy.rules#endpointRuleSet
237+ use aws.api#service
238+
239+ @awsJson1_0
240+ @service(sdkId: "UnionOperationTest")
241+ service TestService {
242+ operations: [UnionOperation],
243+ version: "1"
244+ }
245+
246+ operation UnionOperation {
247+ input: UnionOperationRequest
248+ }
249+
250+ structure UnionOperationRequest {
251+ Union: Foo
252+ }
253+
254+ union Foo {
255+ foo: Boolean
256+ }
257+
258+ """ .asSmithy()
259+
260+ val compileOutputStream = ByteArrayOutputStream ()
261+ val compilationResult = compileSdkAndTest(model = model, outputSink = compileOutputStream, emitSourcesToTmp = Debug .emitSourcesToTemp)
262+ compileOutputStream.flush()
263+
264+ assertEquals(KotlinCompilation .ExitCode .OK , compilationResult.exitCode, compileOutputStream.toString())
265+ }
227266}
228267
229268/* *
You can’t perform that action at this time.
0 commit comments