FoodPlanCreateRequest food.plan-create-request@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-create-request.v1.json
food.plan-create-request@1: POST /api/v1/plans on OpenVibe.Food. people 1-12, days 1-14, budget (US dollars for the whole plan) optional, title optional.
Fields
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
people | integer | yes |
| |
days | integer | yes |
| |
budget | number | null |
| ||
title | string | null |
|
Examples
From the contract's own test fixtures: valid ones validate, rejected ones must fail.
Valid: full
{
"people": 4,
"days": 7,
"budget": 120,
"title": "Family week"
}Valid: minimal
{
"people": 1,
"days": 3
}Rejected: extra-field
{
"people": 2,
"days": 2,
"owner": "someone"
}Rejected: no-days
{
"people": 2
}Rejected: too-many-people
{
"people": 40,
"days": 3
}Validate
const contracts = require('openvibe-contracts');
contracts.validate('food.plan-create-request@1', value); // { valid, errors: [{ path, message }] }