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

FieldTypeRequiredDescriptionConstraints
peopleintegeryes
  • minimum 1
  • maximum 12
daysintegeryes
  • minimum 1
  • maximum 14
budgetnumber | null
  • minimum 1
  • maximum 5000
titlestring | null
  • maxLength 120

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 }] }