File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
Sources/Testing/ABI/v0/Encoded Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -197,10 +197,20 @@ sufficient information to display the event in a human-readable format.
197
197
"runEnded" ; additional event kinds may be added in the future
198
198
199
199
<issue> ::= {
200
+ <!--
201
+ TODO: Publicize the severity field.
202
+ "severity" ::= <issue-severity>, ; the severity of the issue
203
+ -->
200
204
"isKnown": <bool>, ; is this a known issue or not?
201
205
["sourceLocation": <source-location>,] ; where the issue occurred, if known
202
206
}
203
207
208
+ <!--
209
+ TODO: Publicize the severity field.
210
+ <issue-severity> ::= "warning" | "error" ; additional severity levels may be
211
+ ; added in the future
212
+ -->
213
+
204
214
<message> ::= {
205
215
"symbol": <message-symbol>,
206
216
"text": <string>, ; the human-readable text of this message
Original file line number Diff line number Diff line change @@ -16,6 +16,19 @@ extension ABIv0 {
16
16
/// assists in converting values to JSON; clients that consume this JSON are
17
17
/// expected to write their own decoders.
18
18
struct EncodedIssue : Sendable {
19
+ /// An enumeration representing the level of severity of a recorded issue.
20
+ ///
21
+ /// For descriptions of individual cases, see ``Issue/Severity-swift.enum``.
22
+ enum Severity : String {
23
+ case warning
24
+ case error
25
+ }
26
+
27
+ /// The severity of this issue.
28
+ ///
29
+ /// - Warning: Severity is not yet part of the JSON schema.
30
+ var _severity : Severity
31
+
19
32
/// Whether or not this issue is known to occur.
20
33
var isKnown : Bool
21
34
@@ -33,6 +46,11 @@ extension ABIv0 {
33
46
var _error : EncodedError ?
34
47
35
48
init ( encoding issue: borrowing Issue , in eventContext: borrowing Event . Context ) {
49
+ _severity = switch issue. severity {
50
+ case . warning: . warning
51
+ case . error: . error
52
+ }
53
+
36
54
isKnown = issue. isKnown
37
55
sourceLocation = issue. sourceLocation
38
56
if let backtrace = issue. sourceContext. backtrace {
@@ -48,3 +66,4 @@ extension ABIv0 {
48
66
// MARK: - Codable
49
67
50
68
extension ABIv0 . EncodedIssue : Codable { }
69
+ extension ABIv0 . EncodedIssue . Severity : Codable { }
You can’t perform that action at this time.
0 commit comments