Schema
The Voltimax IoT Platform uses schema-driven code generation to maintain consistency between definitions and implementations. Schema files are the single source of truth for metrics, device assets, and protocol models.
Quick Navigation
- Data Model - metric and telemetry data structures
- Metrics - metric schema format and conventions
- Metrics Generator - generator internals
- Assets - Modbus device YAML definitions
- Troubleshooting - common schema issues
Schema Directory
Schema definitions live in schemas/:
schemas/metrics/- metric JSON definitions, registries per domain, and JSON Schema validation filesschemas/assets/modbus/- YAML device definitions for Modbus devicesschemas/standards/ocpp/- OCPP 2.1 JSON schemasschemas/standards/sunspec/- SMDX model files
Generators
Code generation runs in two ways depending on the schema type:
- Metrics and assets: Generated by CLI tools in
tools/Voltimax.Iot.Tools/. Rundotnet run --project tools/Voltimax.Iot.Tools -- generateto regenerate. See Metrics and Assets. - OCPP, SunSpec, Modbus protocols: Generated by Roslyn source generators at compile time - no CLI step required. See Analyzers.
Why Schema-Driven?
- Single source of truth - definitions live in one place
- Type safety - generated code is always correct
- Consistency - all outputs stay synchronized
- Documentation - reference docs are always up-to-date
- Validation - schemas validate input data