From a8c1349f5f1131d6a2b86a684e575ccac52a7afc Mon Sep 17 00:00:00 2001 From: MarkG Date: Tue, 10 May 2022 10:27:37 +0700 Subject: [PATCH 1/5] [#8] Fix: Unable to access JSONAPIError.source.paramater --- Sources/JSONAPIMapper/Models/JSONAPIError.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/JSONAPIMapper/Models/JSONAPIError.swift b/Sources/JSONAPIMapper/Models/JSONAPIError.swift index 666e9e1..59c943f 100644 --- a/Sources/JSONAPIMapper/Models/JSONAPIError.swift +++ b/Sources/JSONAPIMapper/Models/JSONAPIError.swift @@ -9,7 +9,7 @@ import Foundation public struct JSONAPIError: Error, Decodable, Equatable { public struct Source: Decodable, Equatable { - let parameter: String? + public let parameter: String? } public let id: String? From 7aba8ef840be251c1935aad20441ce7a08d466aa Mon Sep 17 00:00:00 2001 From: MarkG Date: Tue, 10 May 2022 13:54:38 +0700 Subject: [PATCH 2/5] [#8] Add public constructors --- .../JSONAPIMapper/Models/JSONAPIError.swift | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Sources/JSONAPIMapper/Models/JSONAPIError.swift b/Sources/JSONAPIMapper/Models/JSONAPIError.swift index 59c943f..03d8dc8 100644 --- a/Sources/JSONAPIMapper/Models/JSONAPIError.swift +++ b/Sources/JSONAPIMapper/Models/JSONAPIError.swift @@ -10,6 +10,10 @@ public struct JSONAPIError: Error, Decodable, Equatable { public struct Source: Decodable, Equatable { public let parameter: String? + + public init(parameter: String? = nil) { + self.parameter = parameter + } } public let id: String? @@ -20,6 +24,22 @@ public struct JSONAPIError: Error, Decodable, Equatable { public let status: String? /// application-specific error code public let code: String? + + public init( + id: String? = nil, + title: String? = nil, + detail: String? = nil, + source: Source, + status: String? = nil, + code: String? = nil + ) { + self.id = id + self.title = title + self.detail = detail + self.source = source + self.status = status + self.code = code + } } /// JSON:API error object is sent as an array of errors. From 7a93550d5c4b63f4345c42986a851bf07f7d4db7 Mon Sep 17 00:00:00 2001 From: MarkG Date: Tue, 10 May 2022 14:17:43 +0700 Subject: [PATCH 3/5] [#8] Change `source` to optional --- Sources/JSONAPIMapper/Models/JSONAPIError.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/JSONAPIMapper/Models/JSONAPIError.swift b/Sources/JSONAPIMapper/Models/JSONAPIError.swift index 03d8dc8..d6017da 100644 --- a/Sources/JSONAPIMapper/Models/JSONAPIError.swift +++ b/Sources/JSONAPIMapper/Models/JSONAPIError.swift @@ -29,7 +29,7 @@ public struct JSONAPIError: Error, Decodable, Equatable { id: String? = nil, title: String? = nil, detail: String? = nil, - source: Source, + source: Source? = nil, status: String? = nil, code: String? = nil ) { From c14ca0e3d6598230d9ffacd3d71d535422ca96a1 Mon Sep 17 00:00:00 2001 From: MarkG Date: Wed, 11 May 2022 10:16:41 +0700 Subject: [PATCH 4/5] [#8] Add break line --- Sources/JSONAPIMapper/Models/JSONAPIError.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Sources/JSONAPIMapper/Models/JSONAPIError.swift b/Sources/JSONAPIMapper/Models/JSONAPIError.swift index d6017da..28fbae0 100644 --- a/Sources/JSONAPIMapper/Models/JSONAPIError.swift +++ b/Sources/JSONAPIMapper/Models/JSONAPIError.swift @@ -9,6 +9,7 @@ import Foundation public struct JSONAPIError: Error, Decodable, Equatable { public struct Source: Decodable, Equatable { + public let parameter: String? public init(parameter: String? = nil) { From dc25e2091289af2ba7ac8bf5a5f5cdc5a9fdb31c Mon Sep 17 00:00:00 2001 From: Su Ho Date: Thu, 12 May 2022 10:58:27 +0700 Subject: [PATCH 5/5] [#10] Bump version to 1.1.1 for bugfix --- JSONAPIMapper.podspec | 2 +- README.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/JSONAPIMapper.podspec b/JSONAPIMapper.podspec index 42073b2..5c2d653 100644 --- a/JSONAPIMapper.podspec +++ b/JSONAPIMapper.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |spec| spec.name = 'JSONAPIMapper' spec.summary = 'A Swift library for mapping JSON data' - spec.version = '1.1.0' + spec.version = '1.1.1' spec.license = { :type => 'MIT' } spec.homepage = 'https://github.com/nimblehq/JSONMapper' spec.authors = { 'Nimble' => 'dev@nimblehq.co' } diff --git a/README.md b/README.md index 49a2e15..7a46f51 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Once you have your Swift package set up, adding Alamofire as a dependency is as ```swift dependencies: [ - .package(url: "https://github.com/nimblehq/JSONMapper.git", .upToNextMajor(from: "1.1.0")) + .package(url: "https://github.com/nimblehq/JSONMapper.git", from: "1.1.1") ] ``` @@ -21,7 +21,7 @@ dependencies: [ JSONAPIMapper can be added to your project using CocoaPods 0.36 or later by adding the following line to your Podfile: ```ruby -pod 'JSONAPIMapper', '~> 1.1' (check releases to make sure this is the latest version) +pod 'JSONAPIMapper', '1.1.1' ``` ## License