Skip to content

Commit

Permalink
Merge pull request #44 from kvld/kvld-patch-1
Browse files Browse the repository at this point in the history
Make isTopLevelFailure property optional
  • Loading branch information
davidahouse authored Nov 6, 2022
2 parents 21ba268 + 241748a commit 3c82063
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
15 changes: 5 additions & 10 deletions Sources/XCResultKit/Schema/ActionTestExpectedFailure.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,10 @@ public struct ActionTestExpectedFailure: XCResultObject {
public let failureSummary: ActionTestFailureSummary?
public let isTopLevelFailure: Bool

public init?(_ json: [String: AnyObject]) {
do {
uuid = xcOptional(element: "uuid", from: json)
failureReason = xcOptional(element: "failureReason", from: json)
failureSummary = xcOptional(element: "failureSummary", from: json)
isTopLevelFailure = try xcRequired(element: "isTopLevelFailure", from: json)
} catch {
logError("Error parsing ActionTestExpectedFailure: \(error.localizedDescription)")
return nil
}
public init(_ json: [String: AnyObject]) {
uuid = xcOptional(element: "uuid", from: json)
failureReason = xcOptional(element: "failureReason", from: json)
failureSummary = xcOptional(element: "failureSummary", from: json)
isTopLevelFailure = xcOptional(element: "isTopLevelFailure", from: json) ?? false
}
}
2 changes: 1 addition & 1 deletion Sources/XCResultKit/Schema/ActionTestFailureSummary.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public struct ActionTestFailureSummary: XCResultObject {
associatedError = xcOptional(element: "associatedError", from: json)
sourceCodeContext = xcOptional(element: "sourceCodeContext", from: json)
timestamp = xcOptional(element: "timestamp", from: json)
isTopLevelFailure = try xcRequired(element: "isTopLevelFailure", from: json)
isTopLevelFailure = xcOptional(element: "isTopLevelFailure", from: json) ?? false
} catch {
logError("Error parsing ActionTestExpectedFailure: \(error.localizedDescription)")
return nil
Expand Down

0 comments on commit 3c82063

Please sign in to comment.