Expand description
ZAP Schema Compiler
Inspired by Cap’n Proto’s zero-copy serialization approach, the ZAP Schema Compiler provides a unified schema language with two supported syntaxes:
.zap(default) - Whitespace-significant, clean minimal syntax.capnp(compatible) - Backwards-compatible with existing Cap’n Proto schemas
The .zap syntax is the recommended format for all new schemas, offering
cleaner, more readable definitions where ordering determines field ordinals.
§ZAP Syntax Example (Recommended)
# ZAP Schema - clean and minimal
# Colons and semicolons are auto-inserted by the compiler
struct Person
name Text
age UInt32
email Text
address Address
struct Address
street Text
city Text
zip Text
enum Status
pending
active
completed
interface Greeter
sayHello (name Text) -> (greeting Text)
sayGoodbye (name Text) -> ()§Cap’n Proto Compatibility
For migration purposes, the compiler also accepts .capnp files with
standard Cap’n Proto syntax including explicit ordinals (@0, @1, etc.)
and brace-delimited blocks. This allows gradual migration from existing
Cap’n Proto schemas to the cleaner ZAP format.
Structs§
- ZapSchema
- ZAP schema compiler
Enums§
- Schema
Format - Schema format type
Functions§
- capnp_
to_ zap - Convert .capnp source to .zap whitespace format
- compile_
to_ rust - Compile .zap source to Rust code
- migrate_
capnp_ to_ zap - Convert a .capnp file to .zap file
- transpile
- Compile a .zap file
- transpile_
str - Compile .zap source string