From 8647301ae2b9f32fbb3cd5c322977d8d2c290fec Mon Sep 17 00:00:00 2001 From: cdricms <36056008+cdricms@users.noreply.github.com> Date: Sat, 13 Sep 2025 18:59:04 +0200 Subject: [PATCH] Serving quantity unit --- Sources/OpenFoodFacts/Schemas/Product.swift | 6 ++++++ 1 file changed, 6 insertions(+) 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(