Schema YAML Reference
Complete reference for the schema YAML format used in Cerulion Graph Editor. Schemas define the structure of data that flows through topics.File Structure
Schema files are YAML files stored in theschemas/ directory. A file can contain one or more schema definitions.
Basic Structure
Schema Definition
Schema Name
- Format: PascalCase (e.g.,
TemperatureReading,SensorData) - Uniqueness: Must be unique within a project
- Characters: Letters, numbers, underscores
- Case sensitive:
TemperatureReading≠temperatureReading
Description
Optional human-readable description:Field Types
Primitive Types
Numeric Types
int8- 8-bit signed integer (-128 to 127)int16- 16-bit signed integer (-32,768 to 32,767)int32- 32-bit signed integer (-2,147,483,648 to 2,147,483,647)int64- 64-bit signed integeruint8- 8-bit unsigned integer (0 to 255)uint16- 16-bit unsigned integer (0 to 65,535)uint32- 32-bit unsigned integer (0 to 4,294,967,295)uint64- 64-bit unsigned integerfloat32- 32-bit floating point numberfloat64- 64-bit floating point number
Other Primitives
bool- Boolean value (true/false)string- Variable-length text stringbytes- Raw binary data
Collection Types
Arrays
Fixed or variable-length arrays:- Syntax:
array<element_type> - Length: Optional fixed length, or variable if omitted
- Element type: Any primitive or schema type
Maps
Key-value mappings:- Syntax:
map<key_type, value_type> - Key types:
string,int32,int64,uint32,uint64 - Value type: Any primitive or schema type
Schema References
Reference other schemas as field types:Field Definition
Basic Field
Field with Description
Field Examples
Complete Examples
Simple Schema
Complex Schema
Array and Map Examples
Validation Rules
Schema Validation
- Name uniqueness - Schema names must be unique
- Field uniqueness - Field names must be unique within a schema
- Type validity - Field types must be valid
- Reference validity - Referenced schemas must exist
- No circular references - Schemas cannot reference themselves directly or indirectly
Field Validation
- Name format - Field names should be valid identifiers
- Type compatibility - Types must be compatible with language targets
- Array length - Fixed-length arrays must have positive length
- Map key types - Only specific types allowed as map keys
Code Generation
Schemas automatically generate type definitions in multiple languages:Rust
Python
C++
Best Practices
Descriptive Names
Use clear, descriptive schema and field names. “TemperatureReading” is better than “Data”.
Add Descriptions
Document schemas and fields. Future you 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.
Common Patterns
Timestamp Pattern
Most schemas include a timestamp:ID Pattern
Include identifiers for tracking:Metadata Pattern
Use maps for flexible metadata:Troubleshooting
Schema validation errors
Schema validation errors
Problem: Schema fails validation.Solutions:
- Check for syntax errors (YAML formatting)
- Verify schema names are unique
- Check field types are valid
- Ensure referenced schemas exist
- Look for circular references
Type generation errors
Type generation errors
Problem: Code generation fails for a schema.Solutions:
- Check that field types are supported in target languages
- Verify array/map syntax is correct
- Ensure nested schemas are valid
- Check for reserved keywords in field names
Schema not found
Schema not found
Problem: Referenced schema doesn’t exist.Solutions:
- Verify schema file exists in schemas/ directory
- Check schema name matches exactly (case-sensitive)
- Ensure schema file is valid YAML
- Reload project to refresh schema cache