diff --git a/Sources/KituraContracts/Contracts.swift b/Sources/KituraContracts/Contracts.swift index fd0b12d..067fce4 100644 --- a/Sources/KituraContracts/Contracts.swift +++ b/Sources/KituraContracts/Contracts.swift @@ -1242,6 +1242,15 @@ public struct GreaterThan: Operation { private var value: I private let `operator`: Operator = .greaterThan + private enum CodingKeys: CodingKey { + case value + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + value = try container.decode(I.self, forKey: .value) + } + /// Creates a GreaterThan instance from a given Identifier value public init(value: I) { self.value = value @@ -1289,6 +1298,15 @@ public struct GreaterThanOrEqual: Operation { private var value: I private let `operator`: Operator = .greaterThanOrEqual + private enum CodingKeys: CodingKey { + case value + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + value = try container.decode(I.self, forKey: .value) + } + /// Creates a GreaterThanOrEqual instance from a given Identifier value public init(value: I) { self.value = value @@ -1337,6 +1355,15 @@ public struct LowerThan: Operation { private var value: I private let `operator`: Operator = .lowerThan + private enum CodingKeys: CodingKey { + case value + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + value = try container.decode(I.self, forKey: .value) + } + /// Creates a LowerThan instance from a given Identifier value public init(value: I) { self.value = value @@ -1384,6 +1411,15 @@ public struct LowerThanOrEqual: Operation { private var value: I private let `operator`: Operator = .lowerThanOrEqual + private enum CodingKeys: CodingKey { + case value + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + value = try container.decode(I.self, forKey: .value) + } + /// Creates a LowerThan instance from a given Identifier value public init(value: I) { self.value = value @@ -1432,6 +1468,17 @@ public struct InclusiveRange: Operation { private var end: I private let `operator`: Operator = .inclusiveRange + private enum CodingKeys: CodingKey { + case start + case end + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + start = try container.decode(I.self, forKey: .start) + end = try container.decode(I.self, forKey: .end) + } + /// Creates a InclusiveRange instance from given start and end values public init(start: I, end: I) { self.start = start @@ -1486,6 +1533,17 @@ public struct ExclusiveRange: Operation { private var end: I private let `operator`: Operator = .exclusiveRange + private enum CodingKeys: CodingKey { + case start + case end + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + start = try container.decode(I.self, forKey: .start) + end = try container.decode(I.self, forKey: .end) + } + /// Creates a ExclusiveRange instance from given start and end values public init(start: I, end: I) { self.start = start