Skip to content

RPC v2 CBOR

smithy.protocols#rpcv2Cbor is Smithy’s binary protocol. Messages are encoded as CBOR and carried over HTTP/2 POST requests on a fixed path derived from the service and operation names. Status: Early preview, client-only.

No extra Maven dependency beyond the codegen plugin — smithy.protocols shapes are bundled with the Smithy CLI.

<PackageReference Include="NSmithy.Codecs.Cbor" Version="0.1.0-preview.15" />

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.hello
use smithy.protocols#rpcv2Cbor
@rpcv2Cbor
service HelloService {
version: "2026-01-01"
operations: [SayHello]
}
operation SayHello {
input := {
@required
name: String
}
output := {
@required
message: String
}
errors: [InvalidName]
}
@error("client")
structure InvalidName {
message: String
}

The CBOR codec is wired up automatically by the generated client — no manual configuration is required:

using Example.Hello;
using NSmithy.Client;
var client = new HelloServiceClient(
new HttpClient(),
new SmithyClientOptions { Endpoint = new Uri("https://api.example.com") }
);
try
{
var response = await client.SayHelloAsync(new SayHelloInput("world"));
Console.WriteLine(response.Message);
}
catch (InvalidNameException ex)
{
Console.WriteLine($"Error: {ex.Message}");
}