Consolidate the application, culinary data model, read-only runtime, and registry-backed deployment.
79 lines
2.7 KiB
JSON
79 lines
2.7 KiB
JSON
{
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$id": "https://recipes.uuard.com/schemas/v2/common.schema.json",
|
|
"title": "Recipe Book common types",
|
|
"$defs": {
|
|
"id": {
|
|
"type": "string",
|
|
"pattern": "^[a-z0-9]+(?:_[a-z0-9]+)*$"
|
|
},
|
|
"nonEmptyString": { "type": "string", "minLength": 1 },
|
|
"schemaVersion": { "const": 2 },
|
|
"date": { "type": "string", "format": "date" },
|
|
"dateTime": { "type": "string", "format": "date-time" },
|
|
"decimal": { "type": "number", "minimum": 0 },
|
|
"positiveDecimal": { "type": "number", "exclusiveMinimum": 0 },
|
|
"localizedText": {
|
|
"type": "object",
|
|
"required": ["text"],
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"text": { "$ref": "#/$defs/nonEmptyString" },
|
|
"language": { "type": "string", "pattern": "^[a-z]{2,3}(?:-[A-Z]{2})?$" }
|
|
}
|
|
},
|
|
"amount": {
|
|
"type": "object",
|
|
"required": ["quantity", "unit_id"],
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"quantity": { "$ref": "#/$defs/decimal" },
|
|
"unit_id": { "$ref": "#/$defs/id" },
|
|
"quantity_max": { "$ref": "#/$defs/decimal" },
|
|
"display": { "$ref": "#/$defs/nonEmptyString" }
|
|
}
|
|
},
|
|
"sourceReference": {
|
|
"type": "object",
|
|
"required": ["source_type", "reviewed"],
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"source_type": {
|
|
"type": "string",
|
|
"enum": ["usda_fdc", "manufacturer", "supplier", "publication", "laboratory", "observation", "manual", "calculated"]
|
|
},
|
|
"external_id": { "$ref": "#/$defs/nonEmptyString" },
|
|
"url": { "type": "string", "format": "uri" },
|
|
"title": { "$ref": "#/$defs/nonEmptyString" },
|
|
"publisher": { "$ref": "#/$defs/nonEmptyString" },
|
|
"retrieved_at": { "$ref": "#/$defs/date" },
|
|
"effective_at": { "$ref": "#/$defs/date" },
|
|
"reviewed": { "type": "boolean" },
|
|
"reviewed_at": { "$ref": "#/$defs/date" },
|
|
"notes": { "type": "string" }
|
|
},
|
|
"allOf": [
|
|
{
|
|
"if": { "properties": { "source_type": { "const": "usda_fdc" } }, "required": ["source_type"] },
|
|
"then": {
|
|
"required": ["external_id", "title", "retrieved_at"],
|
|
"properties": { "external_id": { "pattern": "^[1-9][0-9]*$" } }
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"media": {
|
|
"type": "object",
|
|
"required": ["type", "uri"],
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"type": { "type": "string", "enum": ["image", "video", "audio", "document"] },
|
|
"uri": { "$ref": "#/$defs/nonEmptyString" },
|
|
"alt": { "type": "string" },
|
|
"caption": { "type": "string" },
|
|
"credit": { "type": "string" }
|
|
}
|
|
}
|
|
}
|
|
}
|