Skip to content

Commit af13695

Browse files
authored
Merge pull request #9 from nimblehq/fix/8-unable-to-access-jsonapierror-source-paramater
2 parents 54776be + c14ca0e commit af13695

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

Sources/JSONAPIMapper/Models/JSONAPIError.swift

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@ import Foundation
99
public struct JSONAPIError: Error, Decodable, Equatable {
1010

1111
public struct Source: Decodable, Equatable {
12-
let parameter: String?
12+
13+
public let parameter: String?
14+
15+
public init(parameter: String? = nil) {
16+
self.parameter = parameter
17+
}
1318
}
1419

1520
public let id: String?
@@ -20,6 +25,22 @@ public struct JSONAPIError: Error, Decodable, Equatable {
2025
public let status: String?
2126
/// application-specific error code
2227
public let code: String?
28+
29+
public init(
30+
id: String? = nil,
31+
title: String? = nil,
32+
detail: String? = nil,
33+
source: Source? = nil,
34+
status: String? = nil,
35+
code: String? = nil
36+
) {
37+
self.id = id
38+
self.title = title
39+
self.detail = detail
40+
self.source = source
41+
self.status = status
42+
self.code = code
43+
}
2344
}
2445

2546
/// JSON:API error object is sent as an array of errors.

0 commit comments

Comments
 (0)