RPC v2 CBOR
smithy.protocols#rpcv2Cbor is Smithy’s binary protocol. Messages are encoded
as CBOR and carried over HTTP POST requests on a fixed
path derived from the service and operation names. Status: Preview.
See Protocol Status for current conformance numbers.
Maven Dependency
Section titled “Maven Dependency”No extra Maven dependency beyond the codegen plugin — smithy.protocols shapes
are bundled with the Smithy CLI.
NuGet Packages
Section titled “NuGet Packages”| Purpose | Packages |
|---|---|
| Client | NSmithy.Client, NSmithy.Codecs.Cbor, NSmithy.Protocols.RpcV2Cbor |
| Server (ASP.NET Core) | NSmithy.Server.AspNetCore, NSmithy.Codecs.Cbor, NSmithy.Protocols.RpcV2Cbor |
Modeling
Section titled “Modeling”Apply @rpcv2Cbor to the service. Operations do not carry @http traits —
the protocol maps each operation to a fixed
POST /service/{Service}/operation/{Operation} path automatically:
$version: "2"
namespace example.weather
use smithy.protocols#rpcv2Cbor
@rpcv2Cborservice Weather { version: "2026-01-01" operations: [GetCity]}
operation GetCity { input := { @required cityId: String } output := { @required name: String } errors: [NoSuchResource]}
@error("client")structure NoSuchResource { @required resourceType: String}On the Wire
Section titled “On the Wire”rpcv2Cbor is RPC-style over a fixed path with a CBOR body. The bodies below are shown in CBOR diagnostic notation; on the wire they are binary CBOR (structures are encoded as indefinite-length maps):
POST /service/Weather/operation/GetCity HTTP/1.1Host: api.example.comSmithy-Protocol: rpc-v2-cborContent-Type: application/cborAccept: application/cbor
{"cityId": "123"} # CBOR, diagnostic notation
HTTP/1.1 200 OKSmithy-Protocol: rpc-v2-cborContent-Type: application/cbor
{"name": "Seattle"} # CBOR, diagnostic notationThe path is always /service/{Service}/operation/{Operation} — operations carry
no @http traits. Errors carry a __type discriminator in the CBOR body.
The generated handler and client are identical to every other HTTP-JSON/CBOR
protocol — see Client & Server Usage. The CBOR
codec is wired up automatically; the only thing specific to this protocol is the
@rpcv2Cbor trait and the binary wire format on the fixed operation path.
Example
Section titled “Example”A complete working server+client example is available in
examples/rpcv2cbor.