Annotations

Annotations modify the behavior of types, fields, and declarations. They are prefixed with @.

Encoding annotations

These change how a field is encoded on the wire:

AnnotationApplies toEffect
@varintunsigned integersLEB128 variable-length encoding
@zigzagsigned integersZigZag encoding (small magnitudes use fewer bytes)
@deltanumeric fields in arraysDelta encoding (store differences, not absolute values)
message Packet {
    sequence @0 : u32 @varint
    offset   @1 : i32 @zigzag
}

Declaration annotations

AnnotationApplies toEffect
@non_exhaustiveenum, unionAllows adding variants without breaking decoders
@deprecatedfields, variantsMarks as deprecated in generated code
@removed(ordinal, reason: "...")message fieldsTyped tombstone for removed fields
@non_exhaustive
enum Status : u8 {
    Active     @0
    @deprecated
    Legacy     @1
    Suspended  @2
}

Removed fields

When evolving a schema, use @removed to leave a typed tombstone. This allows decoders to skip the correct number of bytes for the removed field:

message Config {
    name       @0 : string
    @removed(1, reason: "migrated to timeout_ms") : u32
    timeout_ms @2 : u64
}

See the language specification for the full normative reference.