Skip to content

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

Schema Directory

Schema definitions live in schemas/:

  • schemas/metrics/ - metric JSON definitions, registries per domain, and JSON Schema validation files
  • schemas/assets/modbus/ - YAML device definitions for Modbus devices
  • schemas/standards/ocpp/ - OCPP 2.1 JSON schemas
  • schemas/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/. Run dotnet run --project tools/Voltimax.Iot.Tools -- generate to 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