Skip to content

Commit b28f2d2

Browse files
Update trait change enums to use enum shapes
1 parent b3c995b commit b28f2d2

File tree

6 files changed

+40
-55
lines changed

6 files changed

+40
-55
lines changed

smithy-model/src/main/resources/software/amazon/smithy/model/loader/prelude.smithy

Lines changed: 34 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -78,59 +78,42 @@ structure TraitDiffRule {
7878
}
7979

8080
@private
81-
@enum([
82-
{
83-
name: "UPDATE",
84-
value: "update",
85-
documentation: "Emit when a trait already existed, continues to exist, but it is modified."
86-
},
87-
{
88-
name: "ADD",
89-
value: "add",
90-
documentation: "Emit when a trait or value is added that previously did not exist."
91-
},
92-
{
93-
name: "REMOVE",
94-
value: "remove",
95-
documentation: "Emit when a trait or value is removed."
96-
},
97-
{
98-
name: "PRESENCE",
99-
value: "presence",
100-
documentation: "Emit when a trait is added or removed."
101-
},
102-
{
103-
name: "ANY",
104-
value: "any",
105-
documentation: "Emit when any change occurs."
106-
},
107-
])
108-
string TraitChangeType
81+
enum TraitChangeType {
82+
/// Emit when a trait already existed, continues to exist, but it is modified.
83+
@enumValue("update")
84+
UPDATE
85+
86+
/// Emit when a trait or value is added that previously did not exist
87+
@enumValue("add")
88+
ADD
89+
90+
/// Emit when a trait or value is removed.
91+
@enumValue("remove")
92+
REMOVE
93+
94+
/// Emit when a trait is added or removed.
95+
@enumValue("presence")
96+
PRESENCE
97+
98+
/// Emit when any change occurs.
99+
@enumValue("any")
100+
ANY
101+
}
109102

110103
@private
111-
@enum([
112-
{
113-
name: "NOTE",
114-
value: "NOTE",
115-
documentation: "A minor infraction occurred."
116-
},
117-
{
118-
name: "WARNING",
119-
value: "WARNING",
120-
documentation: "An infraction occurred that needs attention."
121-
},
122-
{
123-
name: "DANGER",
124-
value: "DANGER",
125-
documentation: "An infraction occurred that must be resolved."
126-
},
127-
{
128-
name: "ERROR",
129-
value: "ERROR",
130-
documentation: "An unrecoverable infraction occurred."
131-
},
132-
])
133-
string TraitChangeSeverity
104+
enum TraitChangeSeverity {
105+
/// A minor infraction occurred.
106+
NOTE
107+
108+
/// An infraction occurred that needs attention.
109+
WARNING
110+
111+
/// An infraction occurred that must be resolved.
112+
DANGER
113+
114+
/// An unrecoverable infraction occurred.
115+
ERROR
116+
}
134117

135118
@private
136119
enum StructurallyExclusive {

smithy-model/src/test/resources/software/amazon/smithy/model/errorfiles/validators/shape-recursion-required-trait.smithy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
$version: "2.0"
2+
13
namespace smithy.example
24

35
structure RecursiveShape1 {

smithy-model/src/test/resources/software/amazon/smithy/model/errorfiles/validators/trait-breaking-changes/allows-empty-paths.smithy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
$version: "1.0"
1+
$version: "2.0"
22

33
namespace smithy.example
44

smithy-model/src/test/resources/software/amazon/smithy/model/errorfiles/validators/trait-breaking-changes/invalid-member-of-collection.smithy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
$version: "1.0"
1+
$version: "2.0"
22

33
namespace smithy.example
44

smithy-model/src/test/resources/software/amazon/smithy/model/errorfiles/validators/trait-breaking-changes/invalid-named-members.smithy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
$version: "1.0"
1+
$version: "2.0"
22

33
namespace smithy.example
44

smithy-model/src/test/resources/software/amazon/smithy/model/errorfiles/validators/trait-breaking-changes/valid-for-nested.smithy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
$version: "1.0"
1+
$version: "2.0"
22

33
namespace smithy.example
44

0 commit comments

Comments
 (0)