Skip to main content

arora_websocket/
key.rs

1//! Key metadata types for the WebSocket messages.
2
3use arora_types::value::{Type, Value};
4use serde::{Deserialize, Serialize};
5
6/// Metadata describing a key exposed by the runtime's data layer.
7///
8/// A key is a hierarchical path into the store (see `arora_types::data::Key`);
9/// its value is an `arora_types::value::Value`. Keys represent controllable
10/// parameters or observable outputs, with optional type/constraint information.
11#[derive(Debug, Clone, Serialize, Deserialize)]
12pub struct KeyInfo {
13    /// Hierarchical path identifier (e.g., "face/mouth/open", "body/arm/left/rotation")
14    pub path: String,
15
16    /// Key kind/category (e.g., "input", "output", "computed")
17    #[serde(skip_serializing_if = "Option::is_none")]
18    pub kind: Option<String>,
19
20    /// The arora Type of the values this key accepts/produces
21    #[serde(skip_serializing_if = "Option::is_none")]
22    pub value_type: Option<Type>,
23
24    /// Minimum value constraint (for numeric types)
25    #[serde(skip_serializing_if = "Option::is_none")]
26    pub min: Option<f64>,
27
28    /// Maximum value constraint (for numeric types)
29    #[serde(skip_serializing_if = "Option::is_none")]
30    pub max: Option<f64>,
31
32    /// Default value
33    #[serde(skip_serializing_if = "Option::is_none", default)]
34    pub default_value: Option<Value>,
35
36    /// Human-readable description
37    #[serde(skip_serializing_if = "Option::is_none")]
38    pub description: Option<String>,
39}