|
|
|
@@ -6,8 +6,8 @@ public class Product: Codable, ObjectDebugger {
|
|
|
|
public var nutriments: Nutriments? = Nutriments()
|
|
|
|
public var nutriments: Nutriments? = Nutriments()
|
|
|
|
public var selectedImages: SelectedImages?
|
|
|
|
public var selectedImages: SelectedImages?
|
|
|
|
public var sources: [Source]? = []
|
|
|
|
public var sources: [Source]? = []
|
|
|
|
public var additivesN: Int?
|
|
|
|
public var additivesN: Float?
|
|
|
|
public var additivesOldN: Int?
|
|
|
|
public var additivesOldN: Float?
|
|
|
|
public var additivesOriginalTags: [String]?
|
|
|
|
public var additivesOriginalTags: [String]?
|
|
|
|
public var additivesOldTags: [String]?
|
|
|
|
public var additivesOldTags: [String]?
|
|
|
|
public var additivesPrevOriginalTags: [String]?
|
|
|
|
public var additivesPrevOriginalTags: [String]?
|
|
|
|
@@ -36,8 +36,8 @@ public class Product: Codable, ObjectDebugger {
|
|
|
|
public var code: String?
|
|
|
|
public var code: String?
|
|
|
|
public var codesTags: [String]?
|
|
|
|
public var codesTags: [String]?
|
|
|
|
public var comparedToCategory: String?
|
|
|
|
public var comparedToCategory: String?
|
|
|
|
public var complete: Int?
|
|
|
|
public var complete: Float?
|
|
|
|
public var completedT: Int?
|
|
|
|
public var completedT: Float?
|
|
|
|
public var completeness: Double?
|
|
|
|
public var completeness: Double?
|
|
|
|
public var conservationConditions: String?
|
|
|
|
public var conservationConditions: String?
|
|
|
|
public var countries: String?
|
|
|
|
public var countries: String?
|
|
|
|
@@ -46,7 +46,7 @@ public class Product: Codable, ObjectDebugger {
|
|
|
|
public var countriesDebugTags: [String]?
|
|
|
|
public var countriesDebugTags: [String]?
|
|
|
|
public var countriesTags: [String]?
|
|
|
|
public var countriesTags: [String]?
|
|
|
|
public var correctorsTags: [String]?
|
|
|
|
public var correctorsTags: [String]?
|
|
|
|
public var createdT: Int?
|
|
|
|
public var createdT: Float?
|
|
|
|
public var creator: String?
|
|
|
|
public var creator: String?
|
|
|
|
public var dataQualityBugsTags: [String]?
|
|
|
|
public var dataQualityBugsTags: [String]?
|
|
|
|
public var dataQualityErrorsTags: [String]?
|
|
|
|
public var dataQualityErrorsTags: [String]?
|
|
|
|
@@ -64,7 +64,7 @@ public class Product: Codable, ObjectDebugger {
|
|
|
|
public var entryDatesTags: [String]?
|
|
|
|
public var entryDatesTags: [String]?
|
|
|
|
public var expirationDate: String?
|
|
|
|
public var expirationDate: String?
|
|
|
|
public var expirationDateDebugTags: [String]?
|
|
|
|
public var expirationDateDebugTags: [String]?
|
|
|
|
public var fruitsVegetablesNuts100GEstimate: Int?
|
|
|
|
public var fruitsVegetablesNuts100GEstimate: Float?
|
|
|
|
public var genericName: String?
|
|
|
|
public var genericName: String?
|
|
|
|
public var id: String?
|
|
|
|
public var id: String?
|
|
|
|
public var imageFrontSmallUrl: String?
|
|
|
|
public var imageFrontSmallUrl: String?
|
|
|
|
@@ -82,24 +82,24 @@ public class Product: Codable, ObjectDebugger {
|
|
|
|
public var informersTags: [String]?
|
|
|
|
public var informersTags: [String]?
|
|
|
|
public var ingredientsAnalysisTags: [String]?
|
|
|
|
public var ingredientsAnalysisTags: [String]?
|
|
|
|
public var ingredientsDebug: [String?]?
|
|
|
|
public var ingredientsDebug: [String?]?
|
|
|
|
public var ingredientsFromOrThatMayBeFromPalmOilN: Int?
|
|
|
|
public var ingredientsFromOrThatMayBeFromPalmOilN: Float?
|
|
|
|
public var ingredientsFromPalmOilTags: [String]?
|
|
|
|
public var ingredientsFromPalmOilTags: [String]?
|
|
|
|
public var ingredientsFromPalmOilN: Int?
|
|
|
|
public var ingredientsFromPalmOilN: Float?
|
|
|
|
public var ingredientsHierarchy: [String]?
|
|
|
|
public var ingredientsHierarchy: [String]?
|
|
|
|
public var ingredientsIdsDebug: [String]?
|
|
|
|
public var ingredientsIdsDebug: [String]?
|
|
|
|
public var ingredientsN: Int?
|
|
|
|
public var ingredientsN: Float?
|
|
|
|
public var ingredientsNTags: [String]?
|
|
|
|
public var ingredientsNTags: [String]?
|
|
|
|
public var ingredientsOriginalTags: [String]?
|
|
|
|
public var ingredientsOriginalTags: [String]?
|
|
|
|
public var ingredientsTags: [String]?
|
|
|
|
public var ingredientsTags: [String]?
|
|
|
|
public var ingredientsText: String?
|
|
|
|
public var ingredientsText: String?
|
|
|
|
public var ingredientsTextDebug: String?
|
|
|
|
public var ingredientsTextDebug: String?
|
|
|
|
public var ingredientsTextWithAllergens: String?
|
|
|
|
public var ingredientsTextWithAllergens: String?
|
|
|
|
public var ingredientsThatMayBeFromPalmOilN: Int?
|
|
|
|
public var ingredientsThatMayBeFromPalmOilN: Float?
|
|
|
|
public var ingredientsThatMayBeFromPalmOilTags: [String]?
|
|
|
|
public var ingredientsThatMayBeFromPalmOilTags: [String]?
|
|
|
|
public var interfaceVersionCreated: String?
|
|
|
|
public var interfaceVersionCreated: String?
|
|
|
|
public var interfaceVersionModified: String?
|
|
|
|
public var interfaceVersionModified: String?
|
|
|
|
public var keywords: [String]?
|
|
|
|
public var keywords: [String]?
|
|
|
|
public var knownIngredientsN: Int?
|
|
|
|
public var knownIngredientsN: Float?
|
|
|
|
public var labels: String?
|
|
|
|
public var labels: String?
|
|
|
|
public var labelsHierarchy: [String]?
|
|
|
|
public var labelsHierarchy: [String]?
|
|
|
|
public var labelsLc: String?
|
|
|
|
public var labelsLc: String?
|
|
|
|
@@ -114,9 +114,9 @@ public class Product: Codable, ObjectDebugger {
|
|
|
|
public var lastEditDatesTags: [String]?
|
|
|
|
public var lastEditDatesTags: [String]?
|
|
|
|
public var lastEditor: String?
|
|
|
|
public var lastEditor: String?
|
|
|
|
public var lastImageDatesTags: [String]?
|
|
|
|
public var lastImageDatesTags: [String]?
|
|
|
|
public var lastImageT: Int?
|
|
|
|
public var lastImageT: Float?
|
|
|
|
public var lastModifiedBy: String?
|
|
|
|
public var lastModifiedBy: String?
|
|
|
|
public var lastModifiedT: Int?
|
|
|
|
public var lastModifiedT: Float?
|
|
|
|
public var lc: String?
|
|
|
|
public var lc: String?
|
|
|
|
public var link: String?
|
|
|
|
public var link: String?
|
|
|
|
public var linkDebugTags: [String]?
|
|
|
|
public var linkDebugTags: [String]?
|
|
|
|
@@ -130,9 +130,9 @@ public class Product: Codable, ObjectDebugger {
|
|
|
|
public var netWeightUnit: String?
|
|
|
|
public var netWeightUnit: String?
|
|
|
|
public var netWeightValue: String?
|
|
|
|
public var netWeightValue: String?
|
|
|
|
public var nutritionDataPer: String?
|
|
|
|
public var nutritionDataPer: String?
|
|
|
|
public var nutritionScoreWarningNoFruitsVegetablesNuts: Int?
|
|
|
|
public var nutritionScoreWarningNoFruitsVegetablesNuts: Float?
|
|
|
|
public var noNutritionData: String?
|
|
|
|
public var noNutritionData: String?
|
|
|
|
public var novaGroup: Int?
|
|
|
|
public var novaGroup: Float?
|
|
|
|
public var novaGroups: String?
|
|
|
|
public var novaGroups: String?
|
|
|
|
public var novaGroupDebug: String?
|
|
|
|
public var novaGroupDebug: String?
|
|
|
|
public var novaGroupTags: [String]?
|
|
|
|
public var novaGroupTags: [String]?
|
|
|
|
@@ -145,9 +145,9 @@ public class Product: Codable, ObjectDebugger {
|
|
|
|
public var nutritionDataPrepared: String?
|
|
|
|
public var nutritionDataPrepared: String?
|
|
|
|
public var nutritionDataPreparedPer: String?
|
|
|
|
public var nutritionDataPreparedPer: String?
|
|
|
|
public var nutritionGrades: String?
|
|
|
|
public var nutritionGrades: String?
|
|
|
|
public var nutritionScoreBeverage: Int?
|
|
|
|
public var nutritionScoreBeverage: Float?
|
|
|
|
public var nutritionScoreDebug: String?
|
|
|
|
public var nutritionScoreDebug: String?
|
|
|
|
public var nutritionScoreWarningNoFiber: Int?
|
|
|
|
public var nutritionScoreWarningNoFiber: Float?
|
|
|
|
public var nutritionGradesTags: [String]?
|
|
|
|
public var nutritionGradesTags: [String]?
|
|
|
|
public var origins: String?
|
|
|
|
public var origins: String?
|
|
|
|
public var originsDebugTags: [String]?
|
|
|
|
public var originsDebugTags: [String]?
|
|
|
|
@@ -162,7 +162,7 @@ public class Product: Codable, ObjectDebugger {
|
|
|
|
public var pnnsGroups2: String?
|
|
|
|
public var pnnsGroups2: String?
|
|
|
|
public var pnnsGroups1Tags: [String]?
|
|
|
|
public var pnnsGroups1Tags: [String]?
|
|
|
|
public var pnnsGroups2Tags: [String]?
|
|
|
|
public var pnnsGroups2Tags: [String]?
|
|
|
|
public var popularityKey: Int?
|
|
|
|
public var popularityKey: Float?
|
|
|
|
public var producerVersionId: String?
|
|
|
|
public var producerVersionId: String?
|
|
|
|
public var productName: String?
|
|
|
|
public var productName: String?
|
|
|
|
public var productQuantity: Float?
|
|
|
|
public var productQuantity: Float?
|
|
|
|
@@ -173,11 +173,11 @@ public class Product: Codable, ObjectDebugger {
|
|
|
|
public var quantity: String?
|
|
|
|
public var quantity: String?
|
|
|
|
public var quantityDebugTags: [String]?
|
|
|
|
public var quantityDebugTags: [String]?
|
|
|
|
public var recyclingInstructionsToDiscard: String?
|
|
|
|
public var recyclingInstructionsToDiscard: String?
|
|
|
|
public var rev: Int?
|
|
|
|
public var rev: Float?
|
|
|
|
public var servingQuantity: String?
|
|
|
|
public var servingQuantity: String?
|
|
|
|
public var servingSize: String?
|
|
|
|
public var servingSize: String?
|
|
|
|
public var servingSizeDebugTags: [String]?
|
|
|
|
public var servingSizeDebugTags: [String]?
|
|
|
|
public var sortkey: Int?
|
|
|
|
public var sortkey: Float?
|
|
|
|
public var states: String?
|
|
|
|
public var states: String?
|
|
|
|
public var statesHierarchy: [String]?
|
|
|
|
public var statesHierarchy: [String]?
|
|
|
|
public var statesTags: [String]?
|
|
|
|
public var statesTags: [String]?
|
|
|
|
@@ -191,7 +191,7 @@ public class Product: Codable, ObjectDebugger {
|
|
|
|
public var tracesFromUser: String?
|
|
|
|
public var tracesFromUser: String?
|
|
|
|
public var tracesLc: String?
|
|
|
|
public var tracesLc: String?
|
|
|
|
public var tracesTags: [String]?
|
|
|
|
public var tracesTags: [String]?
|
|
|
|
public var unknownIngredientsN: Int?
|
|
|
|
public var unknownIngredientsN: Float?
|
|
|
|
public var unknownNutrientsTags: [String]?
|
|
|
|
public var unknownNutrientsTags: [String]?
|
|
|
|
public var updateKey: String?
|
|
|
|
public var updateKey: String?
|
|
|
|
public var vitaminsPrevTags: [String]?
|
|
|
|
public var vitaminsPrevTags: [String]?
|
|
|
|
@@ -405,8 +405,8 @@ public class Product: Codable, ObjectDebugger {
|
|
|
|
nutriments = try container.decodeIfPresent(Nutriments.self, forKey: .nutriments) ?? Nutriments()
|
|
|
|
nutriments = try container.decodeIfPresent(Nutriments.self, forKey: .nutriments) ?? Nutriments()
|
|
|
|
selectedImages = try container.decodeIfPresent(SelectedImages.self, forKey: .selectedImages)
|
|
|
|
selectedImages = try container.decodeIfPresent(SelectedImages.self, forKey: .selectedImages)
|
|
|
|
sources = try container.decodeIfPresent([Source].self, forKey: .sources)
|
|
|
|
sources = try container.decodeIfPresent([Source].self, forKey: .sources)
|
|
|
|
additivesN = try container.decodeIfPresent(Int.self, forKey: .additivesN)
|
|
|
|
additivesN = try container.decodeIfPresent(Float.self, forKey: .additivesN)
|
|
|
|
additivesOldN = try container.decodeIfPresent(Int.self, forKey: .additivesOldN)
|
|
|
|
additivesOldN = try container.decodeIfPresent(Float.self, forKey: .additivesOldN)
|
|
|
|
additivesOriginalTags = try container.decodeIfPresent([String].self, forKey: .additivesOriginalTags)
|
|
|
|
additivesOriginalTags = try container.decodeIfPresent([String].self, forKey: .additivesOriginalTags)
|
|
|
|
additivesOldTags = try container.decodeIfPresent([String].self, forKey: .additivesOldTags)
|
|
|
|
additivesOldTags = try container.decodeIfPresent([String].self, forKey: .additivesOldTags)
|
|
|
|
additivesPrevOriginalTags = try container.decodeIfPresent([String].self, forKey: .additivesPrevOriginalTags)
|
|
|
|
additivesPrevOriginalTags = try container.decodeIfPresent([String].self, forKey: .additivesPrevOriginalTags)
|
|
|
|
@@ -435,8 +435,8 @@ public class Product: Codable, ObjectDebugger {
|
|
|
|
code = try container.decodeIfPresent(String.self, forKey: .code)
|
|
|
|
code = try container.decodeIfPresent(String.self, forKey: .code)
|
|
|
|
codesTags = try container.decodeIfPresent([String].self, forKey: .codesTags)
|
|
|
|
codesTags = try container.decodeIfPresent([String].self, forKey: .codesTags)
|
|
|
|
comparedToCategory = try container.decodeIfPresent(String.self, forKey: .comparedToCategory)
|
|
|
|
comparedToCategory = try container.decodeIfPresent(String.self, forKey: .comparedToCategory)
|
|
|
|
complete = try container.decodeIfPresent(Int.self, forKey: .complete)
|
|
|
|
complete = try container.decodeIfPresent(Float.self, forKey: .complete)
|
|
|
|
completedT = try container.decodeIfPresent(Int.self, forKey: .completedT)
|
|
|
|
completedT = try container.decodeIfPresent(Float.self, forKey: .completedT)
|
|
|
|
completeness = try container.decodeIfPresent(Double.self, forKey: .completeness)
|
|
|
|
completeness = try container.decodeIfPresent(Double.self, forKey: .completeness)
|
|
|
|
conservationConditions = try container.decodeIfPresent(String.self, forKey: .conservationConditions)
|
|
|
|
conservationConditions = try container.decodeIfPresent(String.self, forKey: .conservationConditions)
|
|
|
|
countries = try container.decodeIfPresent(String.self, forKey: .countries)
|
|
|
|
countries = try container.decodeIfPresent(String.self, forKey: .countries)
|
|
|
|
@@ -445,7 +445,7 @@ public class Product: Codable, ObjectDebugger {
|
|
|
|
countriesDebugTags = try container.decodeIfPresent([String].self, forKey: .countriesDebugTags)
|
|
|
|
countriesDebugTags = try container.decodeIfPresent([String].self, forKey: .countriesDebugTags)
|
|
|
|
countriesTags = try container.decodeIfPresent([String].self, forKey: .countriesTags)
|
|
|
|
countriesTags = try container.decodeIfPresent([String].self, forKey: .countriesTags)
|
|
|
|
correctorsTags = try container.decodeIfPresent([String].self, forKey: .correctorsTags)
|
|
|
|
correctorsTags = try container.decodeIfPresent([String].self, forKey: .correctorsTags)
|
|
|
|
createdT = try container.decodeIfPresent(Int.self, forKey: .createdT)
|
|
|
|
createdT = try container.decodeIfPresent(Float.self, forKey: .createdT)
|
|
|
|
creator = try container.decodeIfPresent(String.self, forKey: .creator)
|
|
|
|
creator = try container.decodeIfPresent(String.self, forKey: .creator)
|
|
|
|
dataQualityBugsTags = try container.decodeIfPresent([String].self, forKey: .dataQualityBugsTags)
|
|
|
|
dataQualityBugsTags = try container.decodeIfPresent([String].self, forKey: .dataQualityBugsTags)
|
|
|
|
dataQualityErrorsTags = try container.decodeIfPresent([String].self, forKey: .dataQualityErrorsTags)
|
|
|
|
dataQualityErrorsTags = try container.decodeIfPresent([String].self, forKey: .dataQualityErrorsTags)
|
|
|
|
@@ -463,7 +463,7 @@ public class Product: Codable, ObjectDebugger {
|
|
|
|
entryDatesTags = try container.decodeIfPresent([String].self, forKey: .entryDatesTags)
|
|
|
|
entryDatesTags = try container.decodeIfPresent([String].self, forKey: .entryDatesTags)
|
|
|
|
expirationDate = try container.decodeIfPresent(String.self, forKey: .expirationDate)
|
|
|
|
expirationDate = try container.decodeIfPresent(String.self, forKey: .expirationDate)
|
|
|
|
expirationDateDebugTags = try container.decodeIfPresent([String].self, forKey: .expirationDateDebugTags)
|
|
|
|
expirationDateDebugTags = try container.decodeIfPresent([String].self, forKey: .expirationDateDebugTags)
|
|
|
|
fruitsVegetablesNuts100GEstimate = try container.decodeIfPresent(Int.self, forKey: .fruitsVegetablesNuts100GEstimate)
|
|
|
|
fruitsVegetablesNuts100GEstimate = try container.decodeIfPresent(Float.self, forKey: .fruitsVegetablesNuts100GEstimate)
|
|
|
|
genericName = try container.decodeIfPresent(String.self, forKey: .genericName)
|
|
|
|
genericName = try container.decodeIfPresent(String.self, forKey: .genericName)
|
|
|
|
id = try container.decodeIfPresent(String.self, forKey: .id)
|
|
|
|
id = try container.decodeIfPresent(String.self, forKey: .id)
|
|
|
|
imageFrontSmallUrl = try container.decodeIfPresent(String.self, forKey: .imageFrontSmallUrl)
|
|
|
|
imageFrontSmallUrl = try container.decodeIfPresent(String.self, forKey: .imageFrontSmallUrl)
|
|
|
|
@@ -481,21 +481,21 @@ public class Product: Codable, ObjectDebugger {
|
|
|
|
informersTags = try container.decodeIfPresent([String].self, forKey: .informersTags)
|
|
|
|
informersTags = try container.decodeIfPresent([String].self, forKey: .informersTags)
|
|
|
|
ingredientsAnalysisTags = try container.decodeIfPresent([String].self, forKey: .ingredientsAnalysisTags)
|
|
|
|
ingredientsAnalysisTags = try container.decodeIfPresent([String].self, forKey: .ingredientsAnalysisTags)
|
|
|
|
ingredientsDebug = try container.decodeIfPresent([String?].self, forKey: .ingredientsDebug)
|
|
|
|
ingredientsDebug = try container.decodeIfPresent([String?].self, forKey: .ingredientsDebug)
|
|
|
|
ingredientsFromOrThatMayBeFromPalmOilN = try container.decodeIfPresent(Int.self, forKey: .ingredientsFromOrThatMayBeFromPalmOilN)
|
|
|
|
ingredientsFromOrThatMayBeFromPalmOilN = try container.decodeIfPresent(Float.self, forKey: .ingredientsFromOrThatMayBeFromPalmOilN)
|
|
|
|
ingredientsFromPalmOilTags = try container.decodeIfPresent([String].self, forKey: .ingredientsFromPalmOilTags)
|
|
|
|
ingredientsFromPalmOilTags = try container.decodeIfPresent([String].self, forKey: .ingredientsFromPalmOilTags)
|
|
|
|
ingredientsFromPalmOilN = try container.decodeIfPresent(Int.self, forKey: .ingredientsFromPalmOilN)
|
|
|
|
ingredientsFromPalmOilN = try container.decodeIfPresent(Float.self, forKey: .ingredientsFromPalmOilN)
|
|
|
|
ingredientsHierarchy = try container.decodeIfPresent([String].self, forKey: .ingredientsHierarchy)
|
|
|
|
ingredientsHierarchy = try container.decodeIfPresent([String].self, forKey: .ingredientsHierarchy)
|
|
|
|
ingredientsIdsDebug = try container.decodeIfPresent([String].self, forKey: .ingredientsIdsDebug)
|
|
|
|
ingredientsIdsDebug = try container.decodeIfPresent([String].self, forKey: .ingredientsIdsDebug)
|
|
|
|
if container.contains(.ingredientsN) {
|
|
|
|
if container.contains(.ingredientsN) {
|
|
|
|
if try container.decodeNil(forKey: .ingredientsN) {
|
|
|
|
if try container.decodeNil(forKey: .ingredientsN) {
|
|
|
|
ingredientsN = nil
|
|
|
|
ingredientsN = nil
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if let intValue = try? container.decode(Int.self, forKey: .ingredientsN) {
|
|
|
|
if let intValue = try? container.decode(Float.self, forKey: .ingredientsN) {
|
|
|
|
ingredientsN = intValue
|
|
|
|
ingredientsN = intValue
|
|
|
|
} else if let stringValue = try? container.decode(String.self, forKey: .ingredientsN) {
|
|
|
|
} else if let stringValue = try? container.decode(String.self, forKey: .ingredientsN) {
|
|
|
|
ingredientsN = Int(stringValue)
|
|
|
|
ingredientsN = Float(stringValue)
|
|
|
|
}else {
|
|
|
|
}else {
|
|
|
|
// If decoding as both Int and String fails, handle the error accordingly
|
|
|
|
// If decoding as both Float and String fails, handle the error accordingly
|
|
|
|
throw DecodingError.dataCorruptedError(
|
|
|
|
throw DecodingError.dataCorruptedError(
|
|
|
|
forKey: .ingredientsN,
|
|
|
|
forKey: .ingredientsN,
|
|
|
|
in: container,
|
|
|
|
in: container,
|
|
|
|
@@ -513,12 +513,12 @@ public class Product: Codable, ObjectDebugger {
|
|
|
|
ingredientsText = try container.decodeIfPresent(String.self, forKey: .ingredientsText)
|
|
|
|
ingredientsText = try container.decodeIfPresent(String.self, forKey: .ingredientsText)
|
|
|
|
ingredientsTextDebug = try container.decodeIfPresent(String.self, forKey: .ingredientsTextDebug)
|
|
|
|
ingredientsTextDebug = try container.decodeIfPresent(String.self, forKey: .ingredientsTextDebug)
|
|
|
|
ingredientsTextWithAllergens = try container.decodeIfPresent(String.self, forKey: .ingredientsTextWithAllergens)
|
|
|
|
ingredientsTextWithAllergens = try container.decodeIfPresent(String.self, forKey: .ingredientsTextWithAllergens)
|
|
|
|
ingredientsThatMayBeFromPalmOilN = try container.decodeIfPresent(Int.self, forKey: .ingredientsThatMayBeFromPalmOilN)
|
|
|
|
ingredientsThatMayBeFromPalmOilN = try container.decodeIfPresent(Float.self, forKey: .ingredientsThatMayBeFromPalmOilN)
|
|
|
|
ingredientsThatMayBeFromPalmOilTags = try container.decodeIfPresent([String].self, forKey: .ingredientsThatMayBeFromPalmOilTags)
|
|
|
|
ingredientsThatMayBeFromPalmOilTags = try container.decodeIfPresent([String].self, forKey: .ingredientsThatMayBeFromPalmOilTags)
|
|
|
|
interfaceVersionCreated = try container.decodeIfPresent(String.self, forKey: .interfaceVersionCreated)
|
|
|
|
interfaceVersionCreated = try container.decodeIfPresent(String.self, forKey: .interfaceVersionCreated)
|
|
|
|
interfaceVersionModified = try container.decodeIfPresent(String.self, forKey: .interfaceVersionModified)
|
|
|
|
interfaceVersionModified = try container.decodeIfPresent(String.self, forKey: .interfaceVersionModified)
|
|
|
|
keywords = try container.decodeIfPresent([String].self, forKey: .keywords)
|
|
|
|
keywords = try container.decodeIfPresent([String].self, forKey: .keywords)
|
|
|
|
knownIngredientsN = try container.decodeIfPresent(Int.self, forKey: .knownIngredientsN)
|
|
|
|
knownIngredientsN = try container.decodeIfPresent(Float.self, forKey: .knownIngredientsN)
|
|
|
|
labels = try container.decodeIfPresent(String.self, forKey: .labels)
|
|
|
|
labels = try container.decodeIfPresent(String.self, forKey: .labels)
|
|
|
|
labelsHierarchy = try container.decodeIfPresent([String].self, forKey: .labelsHierarchy)
|
|
|
|
labelsHierarchy = try container.decodeIfPresent([String].self, forKey: .labelsHierarchy)
|
|
|
|
labelsLc = try container.decodeIfPresent(String.self, forKey: .labelsLc)
|
|
|
|
labelsLc = try container.decodeIfPresent(String.self, forKey: .labelsLc)
|
|
|
|
@@ -533,25 +533,45 @@ public class Product: Codable, ObjectDebugger {
|
|
|
|
lastEditDatesTags = try container.decodeIfPresent([String].self, forKey: .lastEditDatesTags)
|
|
|
|
lastEditDatesTags = try container.decodeIfPresent([String].self, forKey: .lastEditDatesTags)
|
|
|
|
lastEditor = try container.decodeIfPresent(String.self, forKey: .lastEditor)
|
|
|
|
lastEditor = try container.decodeIfPresent(String.self, forKey: .lastEditor)
|
|
|
|
lastImageDatesTags = try container.decodeIfPresent([String].self, forKey: .lastImageDatesTags)
|
|
|
|
lastImageDatesTags = try container.decodeIfPresent([String].self, forKey: .lastImageDatesTags)
|
|
|
|
lastImageT = try container.decodeIfPresent(Int.self, forKey: .lastImageT)
|
|
|
|
lastImageT = try container.decodeIfPresent(Float.self, forKey: .lastImageT)
|
|
|
|
lastModifiedBy = try container.decodeIfPresent(String.self, forKey: .lastModifiedBy)
|
|
|
|
lastModifiedBy = try container.decodeIfPresent(String.self, forKey: .lastModifiedBy)
|
|
|
|
lastModifiedT = try container.decodeIfPresent(Int.self, forKey: .lastModifiedT)
|
|
|
|
lastModifiedT = try container.decodeIfPresent(Float.self, forKey: .lastModifiedT)
|
|
|
|
lc = try container.decodeIfPresent(String.self, forKey: .lc)
|
|
|
|
lc = try container.decodeIfPresent(String.self, forKey: .lc)
|
|
|
|
link = try container.decodeIfPresent(String.self, forKey: .link)
|
|
|
|
link = try container.decodeIfPresent(String.self, forKey: .link)
|
|
|
|
linkDebugTags = try container.decodeIfPresent([String].self, forKey: .linkDebugTags)
|
|
|
|
linkDebugTags = try container.decodeIfPresent([String].self, forKey: .linkDebugTags)
|
|
|
|
manufacturingPlaces = try container.decodeIfPresent(String.self, forKey: .manufacturingPlaces)
|
|
|
|
manufacturingPlaces = try container.decodeIfPresent(String.self, forKey: .manufacturingPlaces)
|
|
|
|
manufacturingPlacesDebugTags = try container.decodeIfPresent([String].self, forKey: .manufacturingPlacesDebugTags)
|
|
|
|
manufacturingPlacesDebugTags = try container.decodeIfPresent([String].self, forKey: .manufacturingPlacesDebugTags)
|
|
|
|
manufacturingPlacesTags = try container.decodeIfPresent([String].self, forKey: .manufacturingPlacesTags)
|
|
|
|
manufacturingPlacesTags = try container.decodeIfPresent([String].self, forKey: .manufacturingPlacesTags)
|
|
|
|
maxImgid = try container.decodeIfPresent(String.self, forKey: .maxImgid)
|
|
|
|
if container.contains(.maxImgid) {
|
|
|
|
|
|
|
|
if try container.decodeNil(forKey: .maxImgid) {
|
|
|
|
|
|
|
|
maxImgid = nil
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if let floatValue = try? container.decode(Float.self, forKey: .maxImgid) {
|
|
|
|
|
|
|
|
maxImgid = "\(floatValue)"
|
|
|
|
|
|
|
|
} else if let stringValue = try? container.decode(String.self, forKey: .maxImgid) {
|
|
|
|
|
|
|
|
maxImgid = stringValue
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
// If decoding as both Float and String fails, handle the error accordingly
|
|
|
|
|
|
|
|
throw DecodingError.dataCorruptedError(
|
|
|
|
|
|
|
|
forKey: .maxImgid,
|
|
|
|
|
|
|
|
in: container,
|
|
|
|
|
|
|
|
debugDescription: "Unable to decode maxImgid"
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
maxImgid = nil
|
|
|
|
|
|
|
|
}
|
|
|
|
mineralsPrevTags = try container.decodeIfPresent([String].self, forKey: .mineralsPrevTags)
|
|
|
|
mineralsPrevTags = try container.decodeIfPresent([String].self, forKey: .mineralsPrevTags)
|
|
|
|
mineralsTags = try container.decodeIfPresent([String].self, forKey: .mineralsTags)
|
|
|
|
mineralsTags = try container.decodeIfPresent([String].self, forKey: .mineralsTags)
|
|
|
|
miscTags = try container.decodeIfPresent([String].self, forKey: .miscTags)
|
|
|
|
miscTags = try container.decodeIfPresent([String].self, forKey: .miscTags)
|
|
|
|
netWeightUnit = try container.decodeIfPresent(String.self, forKey: .netWeightUnit)
|
|
|
|
netWeightUnit = try container.decodeIfPresent(String.self, forKey: .netWeightUnit)
|
|
|
|
netWeightValue = try container.decodeIfPresent(String.self, forKey: .netWeightValue)
|
|
|
|
netWeightValue = try container.decodeIfPresent(String.self, forKey: .netWeightValue)
|
|
|
|
nutritionDataPer = try container.decodeIfPresent(String.self, forKey: .nutritionDataPer)
|
|
|
|
nutritionDataPer = try container.decodeIfPresent(String.self, forKey: .nutritionDataPer)
|
|
|
|
nutritionScoreWarningNoFruitsVegetablesNuts = try container.decodeIfPresent(Int.self, forKey: .nutritionScoreWarningNoFruitsVegetablesNuts)
|
|
|
|
nutritionScoreWarningNoFruitsVegetablesNuts = try container.decodeIfPresent(Float.self, forKey: .nutritionScoreWarningNoFruitsVegetablesNuts)
|
|
|
|
noNutritionData = try container.decodeIfPresent(String.self, forKey: .noNutritionData)
|
|
|
|
noNutritionData = try container.decodeIfPresent(String.self, forKey: .noNutritionData)
|
|
|
|
novaGroup = try container.decodeIfPresent(Int.self, forKey: .novaGroup)
|
|
|
|
novaGroup = try container.decodeIfPresent(Float.self, forKey: .novaGroup)
|
|
|
|
novaGroups = try container.decodeIfPresent(String.self, forKey: .novaGroups)
|
|
|
|
novaGroups = try container.decodeIfPresent(String.self, forKey: .novaGroups)
|
|
|
|
novaGroupDebug = try container.decodeIfPresent(String.self, forKey: .novaGroupDebug)
|
|
|
|
novaGroupDebug = try container.decodeIfPresent(String.self, forKey: .novaGroupDebug)
|
|
|
|
novaGroupTags = try container.decodeIfPresent([String].self, forKey: .novaGroupTags)
|
|
|
|
novaGroupTags = try container.decodeIfPresent([String].self, forKey: .novaGroupTags)
|
|
|
|
@@ -563,9 +583,9 @@ public class Product: Codable, ObjectDebugger {
|
|
|
|
nutritionDataPrepared = try container.decodeIfPresent(String.self, forKey: .nutritionDataPrepared)
|
|
|
|
nutritionDataPrepared = try container.decodeIfPresent(String.self, forKey: .nutritionDataPrepared)
|
|
|
|
nutritionDataPreparedPer = try container.decodeIfPresent(String.self, forKey: .nutritionDataPreparedPer)
|
|
|
|
nutritionDataPreparedPer = try container.decodeIfPresent(String.self, forKey: .nutritionDataPreparedPer)
|
|
|
|
nutritionGrades = try container.decodeIfPresent(String.self, forKey: .nutritionGrades)
|
|
|
|
nutritionGrades = try container.decodeIfPresent(String.self, forKey: .nutritionGrades)
|
|
|
|
nutritionScoreBeverage = try container.decodeIfPresent(Int.self, forKey: .nutritionScoreBeverage)
|
|
|
|
nutritionScoreBeverage = try container.decodeIfPresent(Float.self, forKey: .nutritionScoreBeverage)
|
|
|
|
nutritionScoreDebug = try container.decodeIfPresent(String.self, forKey: .nutritionScoreDebug)
|
|
|
|
nutritionScoreDebug = try container.decodeIfPresent(String.self, forKey: .nutritionScoreDebug)
|
|
|
|
nutritionScoreWarningNoFiber = try container.decodeIfPresent(Int.self, forKey: .nutritionScoreWarningNoFiber)
|
|
|
|
nutritionScoreWarningNoFiber = try container.decodeIfPresent(Float.self, forKey: .nutritionScoreWarningNoFiber)
|
|
|
|
nutritionGradesTags = try container.decodeIfPresent([String].self, forKey: .nutritionGradesTags)
|
|
|
|
nutritionGradesTags = try container.decodeIfPresent([String].self, forKey: .nutritionGradesTags)
|
|
|
|
origins = try container.decodeIfPresent(String.self, forKey: .origins)
|
|
|
|
origins = try container.decodeIfPresent(String.self, forKey: .origins)
|
|
|
|
originsDebugTags = try container.decodeIfPresent([String].self, forKey: .originsDebugTags)
|
|
|
|
originsDebugTags = try container.decodeIfPresent([String].self, forKey: .originsDebugTags)
|
|
|
|
@@ -580,7 +600,7 @@ public class Product: Codable, ObjectDebugger {
|
|
|
|
pnnsGroups2 = try container.decodeIfPresent(String.self, forKey: .pnnsGroups2)
|
|
|
|
pnnsGroups2 = try container.decodeIfPresent(String.self, forKey: .pnnsGroups2)
|
|
|
|
pnnsGroups1Tags = try container.decodeIfPresent([String].self, forKey: .pnnsGroups1Tags)
|
|
|
|
pnnsGroups1Tags = try container.decodeIfPresent([String].self, forKey: .pnnsGroups1Tags)
|
|
|
|
pnnsGroups2Tags = try container.decodeIfPresent([String].self, forKey: .pnnsGroups2Tags)
|
|
|
|
pnnsGroups2Tags = try container.decodeIfPresent([String].self, forKey: .pnnsGroups2Tags)
|
|
|
|
popularityKey = try container.decodeIfPresent(Int.self, forKey: .popularityKey)
|
|
|
|
popularityKey = try container.decodeIfPresent(Float.self, forKey: .popularityKey)
|
|
|
|
producerVersionId = try container.decodeIfPresent(String.self, forKey: .producerVersionId)
|
|
|
|
producerVersionId = try container.decodeIfPresent(String.self, forKey: .producerVersionId)
|
|
|
|
productName = try container.decodeIfPresent(String.self, forKey: .productName)
|
|
|
|
productName = try container.decodeIfPresent(String.self, forKey: .productName)
|
|
|
|
purchasePlaces = try container.decodeIfPresent(String.self, forKey: .purchasePlaces)
|
|
|
|
purchasePlaces = try container.decodeIfPresent(String.self, forKey: .purchasePlaces)
|
|
|
|
@@ -590,7 +610,7 @@ public class Product: Codable, ObjectDebugger {
|
|
|
|
quantity = try container.decodeIfPresent(String.self, forKey: .quantity)
|
|
|
|
quantity = try container.decodeIfPresent(String.self, forKey: .quantity)
|
|
|
|
quantityDebugTags = try container.decodeIfPresent([String].self, forKey: .quantityDebugTags)
|
|
|
|
quantityDebugTags = try container.decodeIfPresent([String].self, forKey: .quantityDebugTags)
|
|
|
|
recyclingInstructionsToDiscard = try container.decodeIfPresent(String.self, forKey: .recyclingInstructionsToDiscard)
|
|
|
|
recyclingInstructionsToDiscard = try container.decodeIfPresent(String.self, forKey: .recyclingInstructionsToDiscard)
|
|
|
|
rev = try container.decodeIfPresent(Int.self, forKey: .rev)
|
|
|
|
rev = try container.decodeIfPresent(Float.self, forKey: .rev)
|
|
|
|
if container.contains(.servingQuantity) {
|
|
|
|
if container.contains(.servingQuantity) {
|
|
|
|
if try container.decodeNil(forKey: .servingQuantity) {
|
|
|
|
if try container.decodeNil(forKey: .servingQuantity) {
|
|
|
|
servingQuantity = nil
|
|
|
|
servingQuantity = nil
|
|
|
|
@@ -600,7 +620,7 @@ public class Product: Codable, ObjectDebugger {
|
|
|
|
} else if let stringValue = try? container.decode(String.self, forKey: .servingQuantity) {
|
|
|
|
} else if let stringValue = try? container.decode(String.self, forKey: .servingQuantity) {
|
|
|
|
servingQuantity = stringValue
|
|
|
|
servingQuantity = stringValue
|
|
|
|
}else {
|
|
|
|
}else {
|
|
|
|
// If decoding as both Int and String fails, handle the error accordingly
|
|
|
|
// If decoding as both Float and String fails, handle the error accordingly
|
|
|
|
throw DecodingError.dataCorruptedError(
|
|
|
|
throw DecodingError.dataCorruptedError(
|
|
|
|
forKey: .servingQuantity,
|
|
|
|
forKey: .servingQuantity,
|
|
|
|
in: container,
|
|
|
|
in: container,
|
|
|
|
@@ -614,7 +634,7 @@ public class Product: Codable, ObjectDebugger {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
servingSize = try container.decodeIfPresent(String.self, forKey: .servingSize)
|
|
|
|
servingSize = try container.decodeIfPresent(String.self, forKey: .servingSize)
|
|
|
|
servingSizeDebugTags = try container.decodeIfPresent([String].self, forKey: .servingSizeDebugTags)
|
|
|
|
servingSizeDebugTags = try container.decodeIfPresent([String].self, forKey: .servingSizeDebugTags)
|
|
|
|
sortkey = try container.decodeIfPresent(Int.self, forKey: .sortkey)
|
|
|
|
sortkey = try container.decodeIfPresent(Float.self, forKey: .sortkey)
|
|
|
|
states = try container.decodeIfPresent(String.self, forKey: .states)
|
|
|
|
states = try container.decodeIfPresent(String.self, forKey: .states)
|
|
|
|
statesHierarchy = try container.decodeIfPresent([String].self, forKey: .statesHierarchy)
|
|
|
|
statesHierarchy = try container.decodeIfPresent([String].self, forKey: .statesHierarchy)
|
|
|
|
statesTags = try container.decodeIfPresent([String].self, forKey: .statesTags)
|
|
|
|
statesTags = try container.decodeIfPresent([String].self, forKey: .statesTags)
|
|
|
|
@@ -632,12 +652,12 @@ public class Product: Codable, ObjectDebugger {
|
|
|
|
if try container.decodeNil(forKey: .unknownIngredientsN) {
|
|
|
|
if try container.decodeNil(forKey: .unknownIngredientsN) {
|
|
|
|
unknownIngredientsN = nil
|
|
|
|
unknownIngredientsN = nil
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if let intValue = try? container.decode(Int.self, forKey: .unknownIngredientsN) {
|
|
|
|
if let intValue = try? container.decode(Float.self, forKey: .unknownIngredientsN) {
|
|
|
|
unknownIngredientsN = intValue
|
|
|
|
unknownIngredientsN = intValue
|
|
|
|
} else if let stringValue = try? container.decode(String.self, forKey: .unknownIngredientsN) {
|
|
|
|
} else if let stringValue = try? container.decode(String.self, forKey: .unknownIngredientsN) {
|
|
|
|
unknownIngredientsN = Int(stringValue)
|
|
|
|
unknownIngredientsN = Float(stringValue)
|
|
|
|
}else {
|
|
|
|
}else {
|
|
|
|
// If decoding as both Int and String fails, handle the error accordingly
|
|
|
|
// If decoding as both Float and String fails, handle the error accordingly
|
|
|
|
throw DecodingError.dataCorruptedError(
|
|
|
|
throw DecodingError.dataCorruptedError(
|
|
|
|
forKey: .unknownIngredientsN,
|
|
|
|
forKey: .unknownIngredientsN,
|
|
|
|
in: container,
|
|
|
|
in: container,
|
|
|
|
@@ -659,14 +679,14 @@ public class Product: Codable, ObjectDebugger {
|
|
|
|
if try container.decodeNil(forKey: .productQuantity) {
|
|
|
|
if try container.decodeNil(forKey: .productQuantity) {
|
|
|
|
productQuantity = nil
|
|
|
|
productQuantity = nil
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
// Try to decode as Int
|
|
|
|
// Try to decode as Float
|
|
|
|
if let floatValue = try? container.decode(Float.self, forKey: .productQuantity) {
|
|
|
|
if let floatValue = try? container.decode(Float.self, forKey: .productQuantity) {
|
|
|
|
productQuantity = floatValue
|
|
|
|
productQuantity = floatValue
|
|
|
|
} else if let stringValue = try? container.decode(String.self, forKey: .productQuantity) {
|
|
|
|
} else if let stringValue = try? container.decode(String.self, forKey: .productQuantity) {
|
|
|
|
// If decoding as Int fails, try to decode as String
|
|
|
|
// If decoding as Float fails, try to decode as String
|
|
|
|
productQuantity = Float(stringValue)
|
|
|
|
productQuantity = Float(stringValue)
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
// If decoding as both Int and String fails, handle the error accordingly
|
|
|
|
// If decoding as both Float and String fails, handle the error accordingly
|
|
|
|
throw DecodingError.dataCorruptedError(
|
|
|
|
throw DecodingError.dataCorruptedError(
|
|
|
|
forKey: .productQuantity,
|
|
|
|
forKey: .productQuantity,
|
|
|
|
in: container,
|
|
|
|
in: container,
|
|
|
|
|