48 lines
2.1 KiB
JSON
48 lines
2.1 KiB
JSON
{
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$id": "https://recipes.uuard.com/schemas/v2/purchase-item.schema.json",
|
|
"title": "Purchasing item and price observations",
|
|
"type": "object",
|
|
"required": ["schema_version", "id", "ingredient_id", "name", "package", "prices", "status"],
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"schema_version": { "$ref": "common.schema.json#/$defs/schemaVersion" },
|
|
"id": { "$ref": "common.schema.json#/$defs/id" },
|
|
"ingredient_id": { "$ref": "common.schema.json#/$defs/id" },
|
|
"name": { "$ref": "common.schema.json#/$defs/nonEmptyString" },
|
|
"brand": { "type": "string" },
|
|
"supplier_id": { "$ref": "common.schema.json#/$defs/id" },
|
|
"supplier_sku": { "type": "string" },
|
|
"gtin_upc": { "type": "string" },
|
|
"status": { "type": "string", "enum": ["active", "discontinued", "unavailable"] },
|
|
"package": {
|
|
"type": "object",
|
|
"required": ["quantity", "unit_id"],
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"quantity": { "$ref": "common.schema.json#/$defs/positiveDecimal" },
|
|
"unit_id": { "$ref": "common.schema.json#/$defs/id" },
|
|
"units_per_case": { "type": "integer", "minimum": 1 },
|
|
"usable_yield_factor": { "type": "number", "exclusiveMinimum": 0, "maximum": 1 }
|
|
}
|
|
},
|
|
"prices": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"required": ["amount", "currency", "effective_at", "source"],
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"amount": { "$ref": "common.schema.json#/$defs/decimal" },
|
|
"currency": { "type": "string", "pattern": "^[A-Z]{3}$" },
|
|
"effective_at": { "$ref": "common.schema.json#/$defs/date" },
|
|
"expires_at": { "$ref": "common.schema.json#/$defs/date" },
|
|
"source": { "$ref": "common.schema.json#/$defs/sourceReference" }
|
|
}
|
|
}
|
|
},
|
|
"nutrition_mapping_ids": { "type": "array", "items": { "$ref": "common.schema.json#/$defs/id" }, "uniqueItems": true },
|
|
"allergen_mapping_ids": { "type": "array", "items": { "$ref": "common.schema.json#/$defs/id" }, "uniqueItems": true }
|
|
}
|
|
}
|