Skip to content

Commit 39f66de

Browse files
committed
Move custom traits to shared file, changed traits namespace, misc pr feedback
1 parent 4e58bbd commit 39f66de

File tree

3 files changed

+12
-17
lines changed

3 files changed

+12
-17
lines changed

codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/model/traits/FailedResponseTrait.kt

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,20 @@ import software.amazon.smithy.model.node.ObjectNode
44
import software.amazon.smithy.model.shapes.ShapeId
55
import software.amazon.smithy.model.traits.AnnotationTrait
66

7+
/**
8+
* Indicates the annotated service should always return a failed response.
9+
*/
10+
class FailedResponseTrait(node: ObjectNode) : AnnotationTrait(ID, node) {
11+
companion object {
12+
val ID: ShapeId = ShapeId.from("smithy.kotlin.traits#failedResponseTrait")
13+
}
14+
}
15+
716
/**
817
* Indicates the annotated service should always return a success response.
918
*/
1019
class SuccessResponseTrait(node: ObjectNode) : AnnotationTrait(ID, node) {
1120
companion object {
12-
val ID: ShapeId = ShapeId.from("com.test#successResponseTrait")
21+
val ID: ShapeId = ShapeId.from("smithy.kotlin.traits#successResponseTrait")
1322
}
1423
}

codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/rendering/smoketests/SmokeTestsRunnerGenerator.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ class SmokeTestsRunnerGenerator(
3939
private val operations = ctx.model.operations(ctx.settings.service).filter { it.hasTrait<SmokeTestsTrait>() }
4040

4141
// Test config
42-
private val hasSuccessResponseTrait = ctx.model.expectShape<ServiceShape>(ctx.settings.service).hasTrait(SuccessResponseTrait.ID)
43-
private val hasFailedResponseTrait = ctx.model.expectShape<ServiceShape>(ctx.settings.service).hasTrait(FailedResponseTrait.ID)
42+
private val hasSuccessResponseTrait = model.expectShape<ServiceShape>(ctx.settings.service).hasTrait(SuccessResponseTrait.ID)
43+
private val hasFailedResponseTrait = model.expectShape<ServiceShape>(ctx.settings.service).hasTrait(FailedResponseTrait.ID)
4444
init {
4545
check(!(hasSuccessResponseTrait && hasFailedResponseTrait)) {
4646
"A service can't have both the success response trait and the failed response trait."

0 commit comments

Comments
 (0)