diff --git a/Sources/OpenFoodFacts/Schemas/Product.swift b/Sources/OpenFoodFacts/Schemas/Product.swift index dcbe5fe..fed998a 100644 --- a/Sources/OpenFoodFacts/Schemas/Product.swift +++ b/Sources/OpenFoodFacts/Schemas/Product.swift @@ -176,6 +176,7 @@ public class Product: Codable, ObjectDebugger { public var recyclingInstructionsToDiscard: String? public var rev: Float? public var servingQuantity: String? + public var servingQuantityUnit: String? public var servingSize: String? public var servingSizeDebugTags: [String]? public var sortkey: Float? @@ -385,6 +386,7 @@ public class Product: Codable, ObjectDebugger { "recycling_instructions_to_discard" case rev case servingQuantity = "serving_quantity" + case servingQuantityUnit = "serving_quantity_unit" case servingSize = "serving_size" case servingSizeDebugTags = "serving_size_debug_tags" case sortkey @@ -838,6 +840,10 @@ public class Product: Codable, ObjectDebugger { } else { servingQuantity = nil } + servingQuantityUnit = try container.decodeIfPresent( + String.self, + forKey: + .servingQuantityUnit) servingSize = try container.decodeIfPresent( String.self, forKey: .servingSize) servingSizeDebugTags = try container.decodeIfPresent(