Raw schema
{
"type": "object",
"properties": {
"restrictions": {
"maxItems": 20,
"type": "array",
"items": {
"anyOf": [
{
"type": "string",
"minLength": 1,
"maxLength": 60
},
{
"type": "object",
"properties": {
"key": {
"type": "string",
"minLength": 1,
"maxLength": 60
},
"note": {
"type": "string",
"maxLength": 200
}
},
"required": [
"key"
]
}
]
},
"description": "Household restrictions. FDA-9 keys (\"peanut\", \"sesame\", \"milk\", …) as strings, or { key, note } when a note matters (e.g. { key: \"tree_nut\", note: \"cashew\" }). May be empty when thresholds carry the premise."
},
"items": {
"minItems": 1,
"maxItems": 25,
"type": "array",
"items": {
"type": "object",
"properties": {
"kind": {
"type": "string",
"enum": [
"upc",
"product_query",
"menu_item",
"ingredients"
],
"description": "upc: digits from a barcode · product_query: a product name · menu_item: a dish (needs venue) · ingredients: comma-separated ingredient text"
},
"value": {
"type": "string",
"minLength": 1,
"maxLength": 4000
},
"venue": {
"type": "string",
"maxLength": 200
}
},
"required": [
"kind",
"value"
]
}
},
"thresholds": {
"description": "Numeric premise (beta): per-serving nutrient bounds ruled against the product's typed panel. Unknown values refuse honestly, never zero. An empty array means no numeric limits.",
"maxItems": 10,
"type": "array",
"items": {
"type": "object",
"properties": {
"nutrient": {
"type": "string",
"minLength": 1,
"maxLength": 40,
"description": "e.g. \"sugar_g\", \"carbs\", \"sodium_mg\", \"calories\", \"protein\""
},
"max": {
"description": "Upper bound per serving",
"type": "number",
"minimum": 0
},
"min": {
"description": "Lower bound per serving",
"type": "number",
"minimum": 0
},
"unit": {
"description": "Unit the bound is stated in (\"g\", \"mg\", \"kcal\"). Defaults to the panel unit; exact conversions only.",
"type": "string",
"maxLength": 10
},
"basis": {
"description": "Only \"per_serving\" is ruleable in v1",
"type": "string",
"maxLength": 20
}
},
"required": [
"nutrient"
]
}
}
},
"required": [
"restrictions",
"items"
],
"$schema": "https://json-schema.org/draft/2020-12/schema"
}