FoodPlanResult food.plan-result@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-result.v1.json

food.plan-result@1: answers of the plan routes on OpenVibe.Food: GET /api/v1/plans → { plans }; GET /api/v1/plans/:id and POST /api/v1/plans (201) → the plan itself (food.plan@1).

Fields

This schema has no named fields.

Examples

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

Valid: empty-list
{
  "plans": []
}
Valid: list
{
  "plans": [
    {
      "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
        }
      }
    }
  ]
}
Valid: one
{
  "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: plans-not-array
{
  "plans": {
    "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
      }
    }
  }
}

Validate

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