{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "title": {
      "type": "string",
      "minLength": 1
    },
    "summary": {
      "type": "string"
    },
    "ingredients": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_.:-]{1,64}$"
          },
          "raw": {
            "type": "string",
            "minLength": 1
          },
          "item": {
            "type": "string",
            "minLength": 1
          },
          "qty": {
            "type": "object",
            "properties": {
              "value": {
                "type": "string",
                "pattern": "^\\d+(?:\\.\\d+)?$"
              },
              "max": {
                "type": "string",
                "pattern": "^\\d+(?:\\.\\d+)?$"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "created_at": {
                    "type": ["string", "null"]
                  },
                  "updated_at": {
                    "type": ["string", "null"]
                  },
                  "deleted_at": {
                    "type": ["string", "null"]
                  },
                  "legacy_ref": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "table": {
                            "type": "string"
                          },
                          "key": {
                            "type": ["string", "number"]
                          },
                          "row": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": ["table", "key", "row"],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "dataset": {
                    "type": "string"
                  }
                },
                "additionalProperties": false
              }
            },
            "required": ["value"],
            "additionalProperties": false
          },
          "unit": {
            "type": "object",
            "properties": {
              "label": {
                "type": "string",
                "minLength": 1
              },
              "code": {
                "type": "string",
                "minLength": 1
              },
              "system": {
                "type": "string",
                "enum": ["metric", "us", "imperial"]
              },
              "meta": {
                "type": "object",
                "properties": {
                  "created_at": {
                    "type": ["string", "null"]
                  },
                  "updated_at": {
                    "type": ["string", "null"]
                  },
                  "deleted_at": {
                    "type": ["string", "null"]
                  },
                  "legacy_ref": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "table": {
                            "type": "string"
                          },
                          "key": {
                            "type": ["string", "number"]
                          },
                          "row": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": ["table", "key", "row"],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "dataset": {
                    "type": "string"
                  }
                },
                "additionalProperties": false
              }
            },
            "required": ["label"],
            "additionalProperties": false
          },
          "prep": {
            "type": "string",
            "minLength": 1
          },
          "group": {
            "type": "string",
            "minLength": 1
          },
          "optional": {
            "type": "boolean"
          },
          "note": {
            "type": "string",
            "minLength": 1
          },
          "meta": {
            "type": "object",
            "properties": {
              "created_at": {
                "type": ["string", "null"]
              },
              "updated_at": {
                "type": ["string", "null"]
              },
              "deleted_at": {
                "type": ["string", "null"]
              },
              "legacy_ref": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "table": {
                        "type": "string"
                      },
                      "key": {
                        "type": ["string", "number"]
                      },
                      "row": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": ["table", "key", "row"],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "dataset": {
                "type": "string"
              }
            },
            "additionalProperties": false
          }
        },
        "required": ["id", "raw", "item"],
        "additionalProperties": false
      }
    },
    "steps": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_.:-]{1,64}$"
          },
          "text": {
            "type": "string",
            "minLength": 1
          },
          "group": {
            "type": "string",
            "minLength": 1
          },
          "ingredient_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "timer_seconds": {
            "type": "number",
            "minimum": 0
          },
          "temperature": {
            "type": "object",
            "properties": {
              "value": {
                "type": "number"
              },
              "unit": {
                "type": "string",
                "enum": ["C", "F"]
              },
              "meta": {
                "type": "object",
                "properties": {
                  "created_at": {
                    "type": ["string", "null"]
                  },
                  "updated_at": {
                    "type": ["string", "null"]
                  },
                  "deleted_at": {
                    "type": ["string", "null"]
                  },
                  "legacy_ref": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "table": {
                            "type": "string"
                          },
                          "key": {
                            "type": ["string", "number"]
                          },
                          "row": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": ["table", "key", "row"],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "dataset": {
                    "type": "string"
                  }
                },
                "additionalProperties": false
              }
            },
            "required": ["value", "unit"],
            "additionalProperties": false
          },
          "meta": {
            "type": "object",
            "properties": {
              "created_at": {
                "type": ["string", "null"]
              },
              "updated_at": {
                "type": ["string", "null"]
              },
              "deleted_at": {
                "type": ["string", "null"]
              },
              "legacy_ref": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "table": {
                        "type": "string"
                      },
                      "key": {
                        "type": ["string", "number"]
                      },
                      "row": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": ["table", "key", "row"],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "dataset": {
                "type": "string"
              }
            },
            "additionalProperties": false
          }
        },
        "required": ["id", "text"],
        "additionalProperties": false
      }
    },
    "yield": {
      "type": "object",
      "properties": {
        "text": {
          "type": "string",
          "minLength": 1
        },
        "servings": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "quantity": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "unit": {
          "type": "string",
          "minLength": 1
        },
        "meta": {
          "type": "object",
          "properties": {
            "created_at": {
              "type": ["string", "null"]
            },
            "updated_at": {
              "type": ["string", "null"]
            },
            "deleted_at": {
              "type": ["string", "null"]
            },
            "legacy_ref": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "table": {
                      "type": "string"
                    },
                    "key": {
                      "type": ["string", "number"]
                    },
                    "row": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": ["table", "key", "row"],
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "dataset": {
              "type": "string"
            }
          },
          "additionalProperties": false
        }
      },
      "required": ["text"],
      "additionalProperties": false
    },
    "prep_seconds": {
      "type": "number",
      "minimum": 0
    },
    "cook_seconds": {
      "type": "number",
      "minimum": 0
    },
    "total_seconds": {
      "type": "number",
      "minimum": 0
    },
    "equipment": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      }
    },
    "cuisine": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      }
    },
    "course": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      }
    },
    "diet": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      }
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      }
    },
    "nutrition": {
      "type": "object",
      "properties": {
        "basis": {
          "type": "string",
          "enum": ["perServing", "per100g", "wholeRecipe", "unspecified"]
        },
        "serving_size": {
          "type": "string",
          "minLength": 1
        },
        "energy_kcal": {
          "type": "number",
          "minimum": 0
        },
        "protein_g": {
          "type": "number",
          "minimum": 0
        },
        "carbohydrate_g": {
          "type": "number",
          "minimum": 0
        },
        "fat_g": {
          "type": "number",
          "minimum": 0
        },
        "fiber_g": {
          "type": "number",
          "minimum": 0
        },
        "sodium_mg": {
          "type": "number",
          "minimum": 0
        },
        "raw": {
          "type": "string",
          "minLength": 1
        },
        "meta": {
          "type": "object",
          "properties": {
            "created_at": {
              "type": ["string", "null"]
            },
            "updated_at": {
              "type": ["string", "null"]
            },
            "deleted_at": {
              "type": ["string", "null"]
            },
            "legacy_ref": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "table": {
                      "type": "string"
                    },
                    "key": {
                      "type": ["string", "number"]
                    },
                    "row": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": ["table", "key", "row"],
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "dataset": {
              "type": "string"
            }
          },
          "additionalProperties": false
        }
      },
      "required": ["basis"],
      "additionalProperties": false
    },
    "source": {
      "type": "object",
      "properties": {
        "url": {
          "type": "string",
          "format": "uri"
        },
        "creator": {
          "type": "string",
          "minLength": 1
        },
        "attribution": {
          "type": "string",
          "minLength": 1
        },
        "meta": {
          "type": "object",
          "properties": {
            "created_at": {
              "type": ["string", "null"]
            },
            "updated_at": {
              "type": ["string", "null"]
            },
            "deleted_at": {
              "type": ["string", "null"]
            },
            "legacy_ref": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "table": {
                      "type": "string"
                    },
                    "key": {
                      "type": ["string", "number"]
                    },
                    "row": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": ["table", "key", "row"],
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "dataset": {
              "type": "string"
            }
          },
          "additionalProperties": false
        }
      },
      "additionalProperties": false
    },
    "notes": {
      "type": "string"
    },
    "completeness": {
      "type": "object",
      "properties": {
        "missing": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "warnings": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "inferred": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "meta": {
          "type": "object",
          "properties": {
            "created_at": {
              "type": ["string", "null"]
            },
            "updated_at": {
              "type": ["string", "null"]
            },
            "deleted_at": {
              "type": ["string", "null"]
            },
            "legacy_ref": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "table": {
                      "type": "string"
                    },
                    "key": {
                      "type": ["string", "number"]
                    },
                    "row": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": ["table", "key", "row"],
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "dataset": {
              "type": "string"
            }
          },
          "additionalProperties": false
        }
      },
      "required": ["missing", "warnings", "inferred"],
      "additionalProperties": false
    },
    "meta": {
      "type": "object",
      "properties": {
        "created_at": {
          "type": ["string", "null"]
        },
        "updated_at": {
          "type": ["string", "null"]
        },
        "deleted_at": {
          "type": ["string", "null"]
        },
        "legacy_ref": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "table": {
                  "type": "string"
                },
                "key": {
                  "type": ["string", "number"]
                },
                "row": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                }
              },
              "required": ["table", "key", "row"],
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ]
        },
        "dataset": {
          "type": "string"
        }
      },
      "additionalProperties": false
    }
  },
  "required": [
    "title",
    "ingredients",
    "steps",
    "equipment",
    "cuisine",
    "course",
    "diet",
    "tags",
    "source",
    "completeness"
  ],
  "additionalProperties": false,
  "$id": "https://sendtopigeon.com/schemas/recipe@1.schema.json",
  "title": "Pigeon Open Data: recipe@1",
  "$comment": "Apache-2.0. Structural schema; use Zod/parseRecord for semantic invariants. This published schema URL is immutable.",
  "examples": [
    {
      "title": "demo",
      "ingredients": [],
      "steps": [],
      "equipment": [],
      "cuisine": [],
      "course": [],
      "diet": [],
      "tags": [],
      "source": {},
      "completeness": {
        "missing": [],
        "warnings": [],
        "inferred": []
      }
    }
  ]
}
