Examples
Questi contenuti non sono ancora disponibili nella tua lingua.
Two complete, valid ORDER 0.1 documents — copy either one as a starting point. Both live in the reference implementation’s test fixtures (packages/order-spec/fixtures/valid/ in the monorepo), so they are validated on every CI run; if either one stopped validating, the build would fail.
Minimal
Section titled “Minimal”The smallest document the schema accepts — the four required top-level properties, and nothing else.
{ "order_version": "0.1", "modules": ["core"], "generator": { "name": "eighty-six", "exported_at": "2026-07-15T09:00:00Z" }, "restaurant": { "ref": "trattoria-da-mario", "name": "Trattoria da Mario", "timezone": "Europe/Rome", "currency": "EUR", "default_language": "it", "supported_languages": ["it"] }}With a menu
Section titled “With a menu”A fuller restaurant profile — description, contact, address, branding — plus a menu with a category, a dish carrying an allergen and a label, and an English translation of both the menu and the dish.
{ "order_version": "0.1", "modules": ["core"], "generator": { "name": "eighty-six", "exported_at": "2026-07-15T09:00:00Z" }, "restaurant": { "ref": "trattoria-da-mario", "name": "Trattoria da Mario", "description": "Cucina romana tradizionale nel cuore di Trastevere, dal 1962.", "timezone": "Europe/Rome", "currency": "EUR", "default_language": "it", "supported_languages": ["it", "en"], "contact": { "phone": "+39 06 5812345", "email": "info@trattoriadamario.it", "website": "https://trattoriadamario.it" }, "address": { "street": "Via del Moro 14", "city": "Roma", "region": "Lazio", "postal_code": "00153", "country": "IT", "coordinates": { "lat": 41.8896, "lng": 12.4699 } }, "branding": { "logo": { "url": "https://cdn.example.com/trattoria-da-mario/logo.png" }, "colors": { "primary": "#7a1f1f", "secondary": "#f5e6c8", "text": "#1a1a1a" }, "font_family": "Playfair Display", "social_links": { "instagram": "https://instagram.com/trattoriadamario", "facebook": "https://facebook.com/trattoriadamario" } } }, "labels": [ { "ref": "vegan", "name": "Vegano", "color": "#22c55e", "icon": "leaf", "translations": { "en": { "name": "Vegan" } } } ], "menus": [ { "ref": "main", "name": "Menù", "translations": { "en": { "name": "Menu" } }, "sections": [ { "ref": "antipasti", "name": "Antipasti", "sections": [], "items": [ { "ref": "bruschetta", "name": "Bruschetta", "description": "Pomodoro, aglio, basilico", "prices": [{ "label": null, "amount": "6.00" }], "allergens": ["gluten"], "label_refs": ["vegan"], "available": true, "frozen": false, "image": { "url": "https://cdn.example.com/bruschetta.jpg", "path": "media/items/bruschetta.jpg" }, "translations": { "en": { "name": "Bruschetta", "description": "Tomato, garlic, basil" } } } ] } ], "notes": [ { "ref": "frozen-note", "anchor": { "type": "menu", "ref": "main" }, "position": "footer", "kind": "info", "body": "Alcuni prodotti possono essere surgelati.", "color": "#6b7280" } ] } ]}Validating a document
Section titled “Validating a document”import { validate } from "order-spec" // the workspace package in packages/order-spec/
const result = validate(document)if (!result.valid) console.error(result.errors)for (const warning of result.warnings) console.warn(warning.code, warning.message)result.valid is false only when result.errors is non-empty — warnings never affect it. See Conformance for what each warning code means.
