FoodPlan food.plan@1

Generated at from openvibe-contracts v0.127.0 and openvibe-sdk v0.37.0.

Version
1.0.0
Owner
food
Visibility
public
Status
active
Compatibility
backward
Schema
https://openvibe.network/contracts/food/plan.v1.json

food.plan@1: one saved plan on OpenVibe.Food.

Fields

FieldTypeRequiredDescriptionConstraints
idstringyes
  • pattern ^pln_[0-9A-HJKMNP-TV-Z]{26}$
titlestring | nullyes
  • maxLength 120
peopleintegeryes
  • minimum 1
daysintegeryes
  • minimum 1
budgetnumber | nullyes
  • minimum 0
created_atstringyes
  • format date-time
planobjectyesThe plan as Food worked it out: spec, items (the shopping list), by_store, menu (one entry a day: breakfast, lunch, dinner, snack), group_coverage and totals (cost, cost_per_person_day, kcal, protein). Food may add fields.
plan.specobjectyes
plan.spec.peopleintegeryes
plan.spec.daysintegeryes
plan.spec.budgetnumber | null
plan.itemsarray of objectyes
plan.menuarray of objectyes
plan.menu[].dayintegeryes
  • minimum 1
plan.totalsobjectyes
plan.totals.costnumberyes
  • minimum 0

Examples

From the contract's own test fixtures: valid ones validate, rejected ones must fail.

Valid: week
{
  "id": "pln_01JZ6Q4X8M2N3P4R5S6T7V8W9X",
  "title": "Week for two",
  "people": 2,
  "days": 7,
  "budget": 80,
  "created_at": "2026-10-08T20:00:00.000Z",
  "plan": {
    "spec": {
      "people": 2,
      "days": 7,
      "budget": 80
    },
    "items": [
      {
        "slug": "rice-long-grain-5lb",
        "name": "Long grain rice, 5 lb",
        "packs": 1
      }
    ],
    "menu": [
      {
        "day": 1,
        "breakfast": [
          "Oats"
        ],
        "lunch": [],
        "dinner": [
          "Rice"
        ],
        "snack": []
      }
    ],
    "totals": {
      "cost": 41.2,
      "kcal": 28000
    }
  }
}
Rejected: bad-id
{
  "id": "plan-1",
  "title": "Week for two",
  "people": 2,
  "days": 7,
  "budget": 80,
  "created_at": "2026-10-08T20:00:00.000Z",
  "plan": {
    "spec": {
      "people": 2,
      "days": 7,
      "budget": 80
    },
    "items": [
      {
        "slug": "rice-long-grain-5lb",
        "name": "Long grain rice, 5 lb",
        "packs": 1
      }
    ],
    "menu": [
      {
        "day": 1,
        "breakfast": [
          "Oats"
        ],
        "lunch": [],
        "dinner": [
          "Rice"
        ],
        "snack": []
      }
    ],
    "totals": {
      "cost": 41.2,
      "kcal": 28000
    }
  }
}
Rejected: no-plan
{
  "id": "pln_01JZ6Q4X8M2N3P4R5S6T7V8W9X",
  "title": "Week for two",
  "people": 2,
  "days": 7,
  "budget": 80,
  "created_at": "2026-10-08T20:00:00.000Z"
}

Validate

const contracts = require('openvibe-contracts');
contracts.validate('food.plan@1', value);   // { valid, errors: [{ path, message }] }