codegen

Generate code from a single Vexil schema file.

Usage

vexilc codegen <file.vexil> [--target <target>] [--output <path>]

Options

OptionDefaultDescription
--target <target>rustCode generation target: rust, typescript, go, or python
--output <path>stdoutWrite output to a file instead of stdout

Examples

# Generate Rust to stdout
vexilc codegen sensor.vexil

# Generate TypeScript to a file
vexilc codegen sensor.vexil --target typescript --output sensor.ts

# Generate Go
vexilc codegen sensor.vexil --target go --output sensor.go

# Generate Python
vexilc codegen sensor.vexil --target python --output sensor.py

Notes

  • For schemas with imports, use build instead
  • The generated code depends on the corresponding runtime library (vexil-runtime for Rust, @vexil-lang/runtime for TypeScript, vexil-runtime Go module, or vexil_runtime Python module)
  • Schema errors are reported before code generation begins
  • Traits and the portable impl-function body subset are generated in every target; unsupported calls, assignments, types, and target-name collisions are reported before output