Imports
Vexil supports multi-file schemas with explicit imports. This allows you to split large schemas into reusable modules.
Basic imports
import common.types
namespace myapp.protocol
message Request {
id @0 : common.types.RequestId
action @1 : string
}
The imported namespace must be resolvable via the include paths passed to vexilc build.
Project compilation
When using imports, use vexilc build instead of vexilc codegen:
vexilc build root.vexil --include ./schemas --output ./generated --target rust
The compiler:
- Parses the root file and discovers imports
- Resolves each import against the include directories
- Compiles all schemas in topological order (dependencies first)
- Generates code for each schema with proper cross-file references
Diamond dependencies
If A imports B and C, and both B and C import D, the compiler deduplicates D. Each type is compiled exactly once, and generated code references the canonical location.
Generated imports
Each target language handles cross-file references idiomatically:
- Rust:
usestatements referencing sibling modules - TypeScript: relative
importstatements with barrelindex.tsfiles - Go: standard package imports
See the language specification for the full normative reference.