Schemas
Schemas define the structure and type of data passed between nodes. Think of them as blueprints that describe what data looks like—similar to astruct in C/Rust, a class in Python, or a type in TypeScript. Schemas are how the editor enforces type-safe wiring: nodes can only connect when data types are compatible.
What is a Schema?
A schema is a definition that describes:- Field names - What data is called (e.g.,
temperature,timestamp) - Field types - What kind of data it is (e.g.,
float32,uint64,string) - Field descriptions - What the data means (optional but recommended)
Schemas are similar to database schemas, API request/response types, or message formats in other systems. They provide structure and type safety.
Why Use Schemas?
Type Safety
Prevent runtime errors by catching type mismatches at design time. The editor won’t let you connect incompatible types.
Documentation
Schemas document what data looks like. Field descriptions explain what each field means.
Code Generation
Schemas automatically generate type definitions in Rust, Python, and C++. Write once, use everywhere.
Validation
The framework validates data against schemas, catching errors before they cause problems.
Schema File Format
Schemas are stored as.yaml files in the schemas/ directory of your project. A schema file can contain one or more schema definitions.
Basic Schema Structure
Example Schema
Supported Field Types
Schemas support these primitive types:Numeric Types
int8,int16,int32,int64- Signed integersuint8,uint16,uint32,uint64- Unsigned integersfloat32,float64- Floating point numbersbool- Boolean values
Text Types
string- Variable-length textbytes- Raw binary data
Collection Types
array<type>- Fixed or variable-length arraysmap<key_type, value_type>- Key-value mappings
For complex nested structures, you can reference other schemas as field types. This allows you to build complex data structures from simpler ones.
Schema Examples
Simple Sensor Data
Complex Nested Structure
Array and Map Types
Where Schemas Live
Schemas are stored in your project’sschemas/ directory:
You can organize schemas across multiple files. The editor loads all
.yaml files in the schemas/ directory.Schema Validation
The editor validates schemas when you:- Save a schema file - Checks for syntax errors
- Connect nodes - Ensures port types match
- Generate code - Validates all schemas are correct
Common Validation Errors
- Missing fields - Referenced schema doesn’t exist
- Type mismatch - Field type is invalid
- Circular references - Schemas reference each other in a loop
- Syntax errors - Invalid YAML syntax
Schema Best Practices
Descriptive Names
Use clear, descriptive schema names. “TemperatureReading” is better than “Data” or “Schema1”.
Add Descriptions
Document what schemas and fields mean. Future you (and your team) will thank you.
Reuse Schemas
Define common schemas once and reuse them. Don’t duplicate definitions.
Organize by Domain
Group related schemas in the same file. Keep schemas organized by purpose.
Schema Evolution
Over time, you may need to change schemas. Here are some guidelines:Safe Changes (Backward Compatible)
- Adding optional fields - New fields with default values
- Renaming fields - If you update all nodes simultaneously
- Adding to arrays - Extending array length
Breaking Changes (Require Updates)
- Removing fields - Nodes expecting these fields will break
- Changing field types - Type mismatches will occur
- Renaming schemas - All references must be updated
Code Generation from Schemas
Schemas automatically generate type definitions in multiple languages:Rust
Python
C++
The framework generates these types automatically when you build your project. You don’t need to write them manually.