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.
197197 "runEnded" ; additional event kinds may be added in the future
198198
199199<issue> ::= {
200+ <!--
201+ TODO: Publicize the severity field.
202+ "severity" ::= <issue-severity>, ; the severity of the issue
203+ -->
200204 "isKnown": <bool>, ; is this a known issue or not?
201205 ["sourceLocation": <source-location>,] ; where the issue occurred, if known
202206}
203207
208+ <!--
209+ TODO: Publicize the severity field.
210+ <issue-severity> ::= "warning" | "error" ; additional severity levels may be
211+ ; added in the future
212+ -->
213+
204214<message> ::= {
205215 "symbol": <message-symbol>,
206216 "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 {
1616 /// assists in converting values to JSON; clients that consume this JSON are
1717 /// expected to write their own decoders.
1818 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+
1932 /// Whether or not this issue is known to occur.
2033 var isKnown : Bool
2134
@@ -33,6 +46,11 @@ extension ABIv0 {
3346 var _error : EncodedError ?
3447
3548 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+
3654 isKnown = issue. isKnown
3755 sourceLocation = issue. sourceLocation
3856 if let backtrace = issue. sourceContext. backtrace {
@@ -48,3 +66,4 @@ extension ABIv0 {
4866// MARK: - Codable
4967
5068extension ABIv0 . EncodedIssue : Codable { }
69+ extension ABIv0 . EncodedIssue . Severity : Codable { }
You can’t perform that action at this time.
0 commit comments