You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: modules/protocol-tests/test/src/smithy4s/api/validation/AdtTraitValidatorSpec.scala
+35
Original file line number
Diff line number
Diff line change
@@ -24,6 +24,41 @@ import ModelUtils._
24
24
25
25
objectAdtTraitValidatorSpecextendsFunSuite {
26
26
27
+
test("AdtTrait - not allowed on mixins") {
28
+
29
+
valevents= eventsWithoutLocations(
30
+
assembleModel(
31
+
"""$version: "2"
32
+
|namespace test
33
+
|
34
+
|use smithy4s.meta#adt
35
+
|
36
+
|structure struct {
37
+
| testing: String
38
+
|}
39
+
|
40
+
|@adt
41
+
|@mixin
42
+
|union MyUnion {
43
+
| unionMember: struct
44
+
|}
45
+
|""".stripMargin
46
+
)
47
+
)
48
+
49
+
valexpected=ValidationEvent
50
+
.builder()
51
+
.id("TraitTarget")
52
+
.shapeId(ShapeId.fromParts("test", "MyUnion"))
53
+
.severity(Severity.ERROR)
54
+
.message(
55
+
"Trait `smithy4s.meta#adt` cannot be applied to `test#MyUnion`. This trait may only be applied to shapes that match the following selector: :test(union :not([trait|mixin]))"
56
+
)
57
+
.build()
58
+
59
+
assert(events.contains(expected))
60
+
}
61
+
27
62
test("AdtTrait - return no error when union targets the structure") {
0 commit comments