Skip to main content

Flow

Struct Flow 

Source
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: String

Node id where execution begins.

§id: String

Opaque platform-assigned id (flow_…). Treated as a label; appears in traces.

§name: String

Human 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: i64

Document 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: u64

Platform-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

Source

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.

Source

pub fn to_yaml(&self) -> Result<String, Error>

Serialize back to YAML (lossless for the model; the opaque ui block round-trips).

Trait Implementations§

Source§

impl Clone for Flow

Source§

fn clone(&self) -> Flow

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Flow

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Flow

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<&Flow> for Flow

Source§

fn from(value: &Flow) -> Self

Converts to this type from the input type.
Source§

impl Serialize for Flow

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Flow

§

impl RefUnwindSafe for Flow

§

impl Send for Flow

§

impl Sync for Flow

§

impl Unpin for Flow

§

impl UnsafeUnpin for Flow

§

impl UnwindSafe for Flow

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.