59 lines
2.4 KiB
JSON
59 lines
2.4 KiB
JSON
{
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$id": "https://recipes.uuard.com/schemas/v2/derived-recipe.schema.json",
|
|
"title": "Disposable derived recipe values",
|
|
"description": "Calculated output. This document is never canonical culinary or purchasing input.",
|
|
"type": "object",
|
|
"required": ["schema_version", "recipe_id", "recipe_revision", "calculation_version", "calculated_at", "input_fingerprint"],
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"schema_version": { "$ref": "common.schema.json#/$defs/schemaVersion" },
|
|
"recipe_id": { "$ref": "common.schema.json#/$defs/id" },
|
|
"recipe_revision": { "$ref": "common.schema.json#/$defs/revision" },
|
|
"calculation_version": { "type": "integer", "minimum": 1 },
|
|
"calculated_at": { "$ref": "common.schema.json#/$defs/dateTime" },
|
|
"input_fingerprint": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
|
|
"cost": {
|
|
"type": "object",
|
|
"required": ["currency", "batch"],
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"currency": { "type": "string", "pattern": "^[A-Z]{3}$" },
|
|
"batch": { "$ref": "common.schema.json#/$defs/decimal" },
|
|
"per_serving": { "$ref": "common.schema.json#/$defs/decimal" },
|
|
"per_100g": { "$ref": "common.schema.json#/$defs/decimal" }
|
|
}
|
|
},
|
|
"nutrition": {
|
|
"type": "object",
|
|
"properties": {
|
|
"batch": { "type": "object", "additionalProperties": { "type": "number" } },
|
|
"per_serving": { "type": "object", "additionalProperties": { "type": "number" } },
|
|
"per_100g": { "type": "object", "additionalProperties": { "type": "number" } }
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"allergens": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"required": ["allergen_id", "presence"],
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"allergen_id": { "$ref": "common.schema.json#/$defs/id" },
|
|
"presence": { "type": "string", "enum": ["contains", "may_contain", "unknown"] }
|
|
}
|
|
}
|
|
},
|
|
"completeness": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"nutrition_weight_fraction": { "type": "number", "minimum": 0, "maximum": 1 },
|
|
"cost_weight_fraction": { "type": "number", "minimum": 0, "maximum": 1 }
|
|
}
|
|
},
|
|
"warnings": { "type": "array", "items": { "type": "string" } }
|
|
}
|
|
}
|