1.0 KiB
1.0 KiB
summary, read_when
| summary | read_when | |
|---|---|---|
| TypeBox schemas as the single source of truth for the gateway protocol |
|
TypeBox as protocol source of truth
Last updated: 2026-01-08
TypeBox schemas define the Gateway control plane (connect/req/res/event frames and payloads). All generated artifacts must come from these schemas.
Current pipeline
pnpm protocol:gen- writes the JSON Schema output (draft‑07)
pnpm protocol:gen:swift- generates Swift gateway models
pnpm protocol:check- runs both generators and verifies the output is committed
Swift codegen behavior
The Swift generator emits:
GatewayFrameenum withreq,res,event, andunknowncases- Strongly typed payload structs/enums
ErrorCodevalues andGATEWAY_PROTOCOL_VERSION
Unknown frame types are preserved as raw payloads for forward compatibility.
When you change schemas
- Update the TypeBox schemas.
- Run
pnpm protocol:check. - Commit the regenerated schema + Swift models.