Create a Schema
This guide walks you through creating your first schema. Schemas define the structure of data that flows between nodes, ensuring type safety and preventing runtime errors.Prerequisites
Before you begin, make sure you have:Project Created
A Cerulion project created and open in the Graph Editor.
Basic YAML Knowledge
Familiarity with YAML syntax (optional, but helpful). We’ll show examples.
Data Structure in Mind
An idea of what data structure you need (fields and types).
Graph Editor Open
Cerulion Graph Editor running and ready to use.
If you don’t have a project yet, see the Quickstart Guide to create one first.
What You’ll Create
You’ll create a schema file that defines a data structure. For this example, we’ll create aTemperatureReading schema with temperature, pressure, and timestamp fields.
Step-by-Step Guide
1
Open schema editor
In the Graph Editor, click Schema in the toolbar (or press
S key).The schema editor dialog should open, showing an empty schema form.
2
Enter schema name
In the schema name field, enter a descriptive name:
- Use PascalCase (e.g.,
TemperatureReading,SensorData) - Be descriptive and specific
- Avoid generic names like
DataorMessage
TemperatureReadingThe schema name should appear in the editor header.
3
Add description (optional)
In the description field, add a brief explanation of what this schema represents:
Descriptions are optional but highly recommended. They help you and others understand what the schema is for, especially when revisiting projects later.
4
Add fields
Click Add Field to add your first field. For each field:
-
Field name: Enter the field name (e.g.,
temperature)- Use camelCase or snake_case (e.g.,
temperature,sensor_value) - Be descriptive
- Use camelCase or snake_case (e.g.,
-
Field type: Select the type from the dropdown:
float32- 32-bit floating point numberfloat64- 64-bit floating point numberint8,int16,int32,int64- Signed integersuint8,uint16,uint32,uint64- Unsigned integersbool- Boolean valuestring- Text stringbytes- Binary data- Or reference another schema
- Field description (optional): Add a description of what this field represents
temperature: float32- “Temperature in Celsius”pressure: float32- “Pressure in hPa”timestamp: uint64- “Unix timestamp in nanoseconds”
You should see all three fields listed in the schema editor.
5
Review schema structure
Review your schema to ensure it’s correct:
- Name is descriptive and unique
- Fields have appropriate types
- Descriptions are clear (if added)
6
Save the schema
Click Save (or press
Ctrl+S / Cmd+S) to save the schema.The schema should appear in the schemas panel (left sidebar) with a checkmark indicating it’s valid.
The schema is automatically saved to a
.yaml file in your project’s schemas/ directory. You can edit it later by double-clicking it in the schemas panel.Understanding the Result
After saving, your schema is:- Available to all graphs in your project
- Ready to use as a port type on nodes
- Validated for syntax and type correctness
- Saved in
schemas/temperature_reading.yaml(or similar)
Using Your Schema
Now you can use this schema when:- Creating nodes - Set input/output port types to
TemperatureReading - Connecting nodes - Ports with matching schema types can connect
- Code generation - The framework generates type definitions automatically
Advanced: Editing Schemas
To edit an existing schema:- Double-click the schema in the schemas panel
- Make changes (add/remove fields, change types, etc.)
- Save the schema
Troubleshooting
Schema name already exists
Schema name already exists
Problem: Error saying schema name is already taken.Solution: Choose a different name. Schema names must be unique within your project.
Invalid field type
Invalid field type
Problem: Can’t select a field type or type is invalid.Solution:
- Check that the type is spelled correctly
- Ensure you’re using a supported type (see field types list above)
- If referencing another schema, make sure that schema exists
Schema not appearing in type dropdown
Schema not appearing in type dropdown
Problem: Created schema but can’t use it when creating nodes.Solution:
- Verify the schema was saved (check schemas panel)
- Check for validation errors (red X icon)
- Try refreshing the project (close and reopen)
- Ensure you’re in the same project where the schema was created