Skip to content

Commit bd9ceb4

Browse files
committed
misc: move model to unit test
1 parent 30002d0 commit bd9ceb4

File tree

2 files changed

+29
-8
lines changed

2 files changed

+29
-8
lines changed

tests/compile/src/test/kotlin/software/amazon/smithy/kotlin/codegen/SmithySdkTest.kt

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,34 @@ class SmithySdkTest {
227227

228228
@Test
229229
fun `it compiles models with unions with members that have the same name as the union`() {
230-
val model = javaClass.getResource("/kitchen-sink-model.smithy")!!.asSmithy()
230+
val model = """
231+
namespace aws.sdk.kotlin.test
232+
233+
use aws.protocols#awsJson1_0
234+
use smithy.rules#operationContextParams
235+
use smithy.rules#endpointRuleSet
236+
use aws.api#service
237+
238+
@awsJson1_0
239+
@service(sdkId: "UnionOperationTest")
240+
service TestService {
241+
operations: [UnionOperation],
242+
version: "1"
243+
}
244+
245+
operation UnionOperation {
246+
input: UnionOperationRequest
247+
}
248+
249+
structure UnionOperationRequest {
250+
Union: Foo
251+
}
252+
253+
union Foo {
254+
foo: Boolean
255+
}
256+
257+
""".asSmithy()
231258

232259
val compileOutputStream = ByteArrayOutputStream()
233260
val compilationResult = compileSdkAndTest(model = model, outputSink = compileOutputStream, emitSourcesToTmp = Debug.emitSourcesToTemp)

tests/compile/src/test/resources/kitchen-sink-model.smithy

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,7 @@ structure SmokeTestRequest {
5959

6060
payload1: String,
6161
payload2: Integer,
62-
payload3: Nested,
63-
64-
nestedUnion: NestedUnion
65-
}
66-
67-
union NestedUnion {
68-
nestedUnion: Boolean
62+
payload3: Nested
6963
}
7064

7165
structure Nested {

0 commit comments

Comments
 (0)