Skip to content

Manifest

A JSON document:

{
"pavia": 1,
"name": "example-app",
"services": [
{
"name": "chat",
"server_methods": [
{
"name": "history",
"kind": "call",
"shape": "server_stream",
"params": [{"name": "room", "type": {"ref": "RoomId"}}],
"yields": {"ref": "Message"}
},
{
"name": "send",
"kind": "call",
"shape": "unary",
"params": [
{"name": "room", "type": {"ref": "RoomId"}},
{"name": "text", "type": "string"}
],
"returns": {"ref": "MessageId"},
"error": {"ref": "SendError"}
},
{
"name": "typing",
"kind": "notify",
"params": [{"name": "room", "type": {"ref": "RoomId"}}]
},
{
"name": "upload",
"kind": "call",
"shape": "client_stream",
"accepts": "bytes",
"returns": "u64"
}
],
"client_methods": [
{
"name": "confirm",
"kind": "call",
"shape": "unary",
"params": [{"name": "prompt", "type": "string"}],
"returns": "bool"
},
{
"name": "systemNotice",
"kind": "notify",
"params": [{"name": "text", "type": "string"}]
}
]
}
],
"channels": [
{
"namespace": "room",
"publication": {"ref": "Message"},
"presence_info": {"ref": "Member"},
"subscribe": {"ref": "RoomOptions"},
"history": true
}
],
"datagrams": [
{
"topic": "cursor",
"direction": "both",
"mode": "latest",
"payload": {"ref": "CursorPos"}
}
],
"types": {
"RoomId": {"alias": "string"},
"MessageId": {"alias": "uuid"},
"Message": {"struct": {"fields": [
{"name": "id", "type": {"ref": "MessageId"}},
{"name": "author", "type": "string"},
{"name": "text", "type": "string"},
{"name": "sent_at", "type": "timestamp"}
]}},
"SendError": {"enum": {"variants": [
{"name": "RoomNotFound"},
{"name": "TooLong", "type": {"struct": {"fields": [{"name": "max", "type": "u32"}]}}}
]}},
"Member": {"struct": {"fields": [{"name": "display_name", "type": "string"}]}},
"RoomOptions": {"struct": {"fields": [
{"name": "lang", "type": {"option": "string"}, "optional": true}
]}},
"CursorPos": {"struct": {"fields": [
{"name": "x", "type": "f32"},
{"name": "y", "type": "f32"}
]}}
}
}

Field rules:

  • Order: arrays of named entries, whose elements carry a name and whose position carries no meaning, are sorted by that name in byte order: services, server_methods and client_methods by name, channels by namespace, datagrams by topic, and any later array of the same kind by its name field. types is an object, whose keys JSON Canonicalization already orders (§12.5). params, struct fields and enum variants keep declaration order, because position matters for encoding: arguments are encoded in params order (§8.2), and the packed codec of §18 encodes structs in field order. Exporters sort; canonicalization rejects unsorted input (§12.5).
  • docs: any object in the manifest MAY carry a docs string (documentation for generators). It is excluded from the fingerprint (§12.5).
  • Optional fields (docs, params, presence_info, snapshot, subscribe, error, accepts, yields, returns, idempotent, open, history) are omitted when they have no value and MUST NOT be written as null. Defaults: returns = unit, idempotent = false, open = false, history = false; the others default to none. An optional field whose value equals its default MUST be omitted. An empty params list equals the default (no parameters) and MUST be omitted.
  • Names: service, method, param, type, field, variant and datagram topic names match [A-Za-z_][A-Za-z0-9_]* and are 1 to 255 bytes; channel namespaces use the characters of §10.1 except :. A violation is a manifest validation error.
  • snapshot (channels): optional type carried in SUBSCRIBED’s data section (§10.2).
  • subscribe (channels): optional type of the SUBSCRIBE data section, the subscription parameters (§10.2). Usually a struct, so adding an optional field later is compatible (§12.7).
  • kind: call or notify. Notifications have no shape, returns, yields, accepts or error.
  • shape: unary, server_stream, client_stream, bidi (wire values 0-3).
  • accepts: item type the caller streams (shapes client_stream, bidi).
  • yields: item type the callee streams (shapes server_stream, bidi).
  • returns: result type (shapes unary, client_stream); defaults to unit.
  • error: optional typed error detail (§8.4).
  • idempotent: executing the call more than once has the same effect as executing it once. Clients may retry it automatically after a failure whose outcome is unknown (§8.4), on the same session or a new one; which failures they retry is client policy (by default UNAVAILABLE and transport loss).
  • direction for datagrams: to_server, to_client, both.
  • Limits: a manifest’s text is at most 4 MiB: 4,194,304 bytes of UTF-8 as written or received (after any content decoding), whitespace included. Its types nest at most 32 deep, counted form by form: a primitive such as "u8" and a ref are 1 deep; an option, list or map is 1 deeper than its inner type; a tuple is 2 deeper than its deepest item, and an inline struct 4 deeper than its deepest field type (the JSON levels between them, {"tuple": [t]} and {"struct": {"fields": [{"type": t}]}}); a tuple with no items and a struct with no fields are 1 deep. Each type the manifest names starts at depth 1: a params type, accepts, yields, returns, error, a channel’s publication, presence_info, snapshot and subscribe, a datagram topic’s payload, an alias, and the field and variant types of a named struct or enum. Names are at most 255 bytes (see Names above), so a name a reader repeats per entry, in an error or in generated code, costs a bounded amount. Exporters MUST NOT write text past the size limit, a type past the depth limit or a name past the length limit. Readers MUST refuse all three, checking the size before parsing and the type depth while descending, so a hostile manifest cannot make a reader recurse or allocate without bound. A manifest within these limits nests at most 41 JSON levels, counted as §5.4.1 counts depth (objects and arrays; the outermost object is level 1); a reader MAY refuse a document nested deeper than 64 levels while parsing, with any error. The size counts formatting, so a reader may take compact text that its own exporter, writing with indentation, could not write; the fingerprint (§12.5) does not depend on formatting. This depth is a property of the contract and separate from the depth limit of data sections (§12.3), which counts arrays and maps in encoded values. The three limits are fixed protocol values (§16).

The fingerprint is SHA-256 over the manifest serialized with JSON Canonicalization Scheme (RFC 8785) after removing every docs field and the top-level name. Only normative content (services, methods, channels, datagram topics, types) affects it, so editing documentation never invalidates generated clients. It identifies an exact contract version; it says nothing about compatibility. The canonicalization step MUST reject a manifest that contains null or a default value for an optional field, including an empty params list, or an array of named entries that is not sorted by name (§12.2). Sorting makes the fingerprint independent of the order in which the source declares services, methods, channels and datagram topics.

Servers MAY serve the manifest at GET {path}/.well-known/pavia/contract (JSON, with the fingerprint in an ETag). The ETag is the fingerprint in lowercase hex as a strong entity tag (in double quotes). Servers SHOULD allow disabling this in production; when publication is disabled the server answers 404 Not Found on every HTTP version.

Change Compatible?
Add a service, method, channel namespace or datagram topic Yes
Add an optional struct field Yes
Add a required struct field No (old senders omit it)
Remove or rename anything No
Add a variant to an open enum Yes
Add a variant to a closed enum No
Change a type, shape or kind No
Add a method parameter No
Edit only docs or the top-level name (outside the fingerprint, §12.5) Yes
Closed enum to open enum Yes
Open enum to closed enum No
idempotent false to true Yes
idempotent true to false No
Enable history on a channel namespace Yes
Change a datagram topic’s mode or direction No
Add snapshot, presence_info, subscribe or error (old peers expect an empty data section) No
Any change not listed above No

From the specification: §12.2, §12.5, §12.6, §12.7.