pub struct Flow {
pub entry: String,
pub id: String,
pub name: String,
pub nodes: HashMap<String, Node>,
pub schema_version: i64,
pub ui: Option<Value>,
pub version: u64,
}Expand description
The WaveKat call-flow (“Receptionist”) document, schema_version 1. This file is the single source of truth for the document SHAPE: every consumer (the @wavekat/flow-schema npm package, the wavekat-flow Rust crate) generates its model types from this file. Semantic rules that a JSON Schema cannot express (graph reachability, exit-set exactness, hours/timezone math, DTMF digit validity, prompt length) are NOT encoded here — they live in each language’s validator and are pinned by the shared conformance corpus. Unknown fields are permitted structurally, matching both implementations (Rust serde ignores them; the TS parser surfaces a non-blocking warning).
JSON schema
{
"$id": "https://schema.wavekat.com/flow/v1.json",
"title": "Flow",
"description": "The WaveKat call-flow (\"Receptionist\") document, schema_version 1. This file is the single source of truth for the document SHAPE: every consumer (the @wavekat/flow-schema npm package, the wavekat-flow Rust crate) generates its model types from this file. Semantic rules that a JSON Schema cannot express (graph reachability, exit-set exactness, hours/timezone math, DTMF digit validity, prompt length) are NOT encoded here — they live in each language's validator and are pinned by the shared conformance corpus. Unknown fields are permitted structurally, matching both implementations (Rust serde ignores them; the TS parser surfaces a non-blocking warning).",
"type": "object",
"required": [
"entry",
"id",
"name",
"nodes",
"schema_version"
],
"properties": {
"entry": {
"description": "Node id where execution begins.",
"type": "string"
},
"id": {
"description": "Opaque platform-assigned id (flow_…). Treated as a label; appears in traces.",
"type": "string"
},
"name": {
"description": "Human name shown in the editor and the read-only viewer.",
"type": "string"
},
"nodes": {
"description": "The flat node set, keyed by human-meaningful node id and string-referenced by exits. Order is irrelevant to execution.",
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/Node"
}
},
"schema_version": {
"description": "Document format version. This file describes version 1 only; a document declaring another version validates against that version's schema file, not this one.",
"type": "integer",
"const": 1
},
"ui": {
"description": "Presentation metadata (canvas positions, annotations). Preserved on round-trip, never read by the engine. Opaque by design so a canvas editor can add layout fields without a schema bump."
},
"version": {
"description": "Platform-assigned publish counter, bumped on publish. Defaults to 1 for a hand-written or generated pre-publish document. Distinct from schema_version.",
"default": 1,
"type": "integer",
"minimum": 0.0
}
}
}Fields§
§entry: StringNode id where execution begins.
id: StringOpaque platform-assigned id (flow_…). Treated as a label; appears in traces.
name: StringHuman name shown in the editor and the read-only viewer.
nodes: HashMap<String, Node>The flat node set, keyed by human-meaningful node id and string-referenced by exits. Order is irrelevant to execution.
schema_version: i64Document format version. This file describes version 1 only; a document declaring another version validates against that version’s schema file, not this one.
ui: Option<Value>Presentation metadata (canvas positions, annotations). Preserved on round-trip, never read by the engine. Opaque by design so a canvas editor can add layout fields without a schema bump.
version: u64Platform-assigned publish counter, bumped on publish. Defaults to 1 for a hand-written or generated pre-publish document. Distinct from schema_version.
Implementations§
Source§impl Flow
impl Flow
Sourcepub fn from_yaml(src: &str) -> Result<Flow, Error>
pub fn from_yaml(src: &str) -> Result<Flow, Error>
Parse a flow document from YAML text. This is the only surface-syntax
entry point; everything downstream works on the typed tree. Parsing
does not validate semantics (reachability, exit wiring, …) — call
crate::validate::validate on the result.
Routes through serde_yaml_ng::Value first, on purpose: the
duplicate-key check lives in that crate’s Mapping deserializer, not
on the direct-into-struct path — a HashMap field would otherwise
silently take last-wins. Routing through Value rejects a duplicate
key at any nesting level, the footgun doc 48 fences off.