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, or go
--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

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)
  • Schema errors are reported before code generation begins