Files
HamHam/public/examples/hamham.schema.json
T

386 lines
11 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"version": {
"type": "number",
"const": 1
},
"recipes": {
"minItems": 1,
"maxItems": 100,
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
},
"title": {
"type": "string",
"minLength": 2,
"maxLength": 180
},
"subtitle": {
"default": "",
"type": "string",
"maxLength": 200
},
"description": {
"default": "",
"type": "string",
"maxLength": 4000
},
"image": {
"default": "",
"anyOf": [
{
"anyOf": [
{
"type": "string",
"pattern": "^\\/(?:media\\/[a-f0-9-]+\\.webp|images\\/[a-z0-9-]+\\.(?:webp|jpg|svg))$"
},
{
"type": "string",
"maxLength": 2048,
"pattern": "^https:\\/\\/[^@\\s/\\\\]+(?:[/?#][^\\s\\\\]*)?$"
}
]
},
{
"type": "string",
"const": ""
}
]
},
"images": {
"default": [],
"maxItems": 20,
"type": "array",
"items": {
"anyOf": [
{
"type": "string",
"pattern": "^\\/(?:media\\/[a-f0-9-]+\\.webp|images\\/[a-z0-9-]+\\.(?:webp|jpg|svg))$"
},
{
"type": "string",
"maxLength": 2048,
"pattern": "^https:\\/\\/[^@\\s/\\\\]+(?:[/?#][^\\s\\\\]*)?$"
}
]
}
},
"categories": {
"default": [],
"maxItems": 20,
"type": "array",
"items": {
"type": "string",
"minLength": 1,
"maxLength": 60
}
},
"tags": {
"default": [],
"maxItems": 30,
"type": "array",
"items": {
"type": "string",
"minLength": 1,
"maxLength": 60
}
},
"cuisine": {
"default": "",
"type": "string",
"maxLength": 80
},
"difficulty": {
"default": "Einfach",
"type": "string",
"enum": [
"Einfach",
"Mittel",
"Anspruchsvoll"
]
},
"prepMinutes": {
"default": 0,
"type": "integer",
"minimum": 0,
"maximum": 10080
},
"cookMinutes": {
"default": 0,
"type": "integer",
"minimum": 0,
"maximum": 10080
},
"restMinutes": {
"default": 0,
"type": "integer",
"minimum": 0,
"maximum": 10080
},
"servings": {
"type": "number",
"exclusiveMinimum": 0,
"maximum": 10000
},
"ingredients": {
"minItems": 1,
"maxItems": 200,
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"pattern": "^[a-zA-Z0-9_-]{1,80}$"
},
"name": {
"type": "string",
"minLength": 1,
"maxLength": 160
},
"amount": {
"default": null,
"anyOf": [
{
"type": "number",
"exclusiveMinimum": 0,
"maximum": 1000000
},
{
"type": "null"
}
]
},
"unit": {
"default": "",
"type": "string",
"enum": [
"g",
"kg",
"ml",
"l",
"Stück",
"TL",
"EL",
"Prise",
"Bund",
""
]
},
"section": {
"default": "",
"type": "string",
"maxLength": 80
},
"note": {
"default": "",
"type": "string",
"maxLength": 200
},
"optional": {
"default": false,
"type": "boolean"
}
},
"required": [
"id",
"name",
"amount",
"unit",
"section",
"note",
"optional"
],
"additionalProperties": false
}
},
"steps": {
"minItems": 1,
"maxItems": 100,
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"pattern": "^[a-zA-Z0-9_-]{1,80}$"
},
"title": {
"default": "",
"type": "string",
"maxLength": 160
},
"text": {
"type": "string",
"minLength": 1,
"maxLength": 6000
},
"ingredients": {
"default": [],
"maxItems": 100,
"type": "array",
"items": {
"type": "string",
"pattern": "^[a-zA-Z0-9_-]{1,80}$"
}
},
"images": {
"default": [],
"maxItems": 10,
"type": "array",
"items": {
"anyOf": [
{
"type": "string",
"pattern": "^\\/(?:media\\/[a-f0-9-]+\\.webp|images\\/[a-z0-9-]+\\.(?:webp|jpg|svg))$"
},
{
"type": "string",
"maxLength": 2048,
"pattern": "^https:\\/\\/[^@\\s/\\\\]+(?:[/?#][^\\s\\\\]*)?$"
}
]
}
},
"timers": {
"default": [],
"maxItems": 10,
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"pattern": "^[a-zA-Z0-9_-]{1,80}$"
},
"label": {
"type": "string",
"minLength": 1,
"maxLength": 100
},
"seconds": {
"type": "integer",
"minimum": 1,
"maximum": 172800
}
},
"required": [
"id",
"label",
"seconds"
],
"additionalProperties": false
}
}
},
"required": [
"id",
"title",
"text",
"ingredients",
"images",
"timers"
],
"additionalProperties": false
}
},
"tips": {
"default": "",
"type": "string",
"maxLength": 6000
},
"storage": {
"default": "",
"type": "string",
"maxLength": 3000
},
"nutrition": {
"default": null,
"anyOf": [
{
"type": "object",
"properties": {
"kcal": {
"type": "number",
"minimum": 0
},
"protein": {
"type": "number",
"minimum": 0
},
"carbs": {
"type": "number",
"minimum": 0
},
"fat": {
"type": "number",
"minimum": 0
}
},
"required": [
"kcal",
"protein",
"carbs",
"fat"
],
"additionalProperties": false
},
{
"type": "null"
}
]
},
"published": {
"default": false,
"type": "boolean"
},
"createdAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
},
"updatedAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
}
},
"required": [
"title",
"subtitle",
"description",
"image",
"images",
"categories",
"tags",
"cuisine",
"difficulty",
"prepMinutes",
"cookMinutes",
"restMinutes",
"servings",
"ingredients",
"steps",
"tips",
"storage",
"nutrition",
"published"
],
"additionalProperties": false
}
}
},
"required": [
"version",
"recipes"
],
"additionalProperties": false
}