Skip to content

Protocols

NSmithy binds modeled operations to the protocols below. For the separation between a contract and its wire representation, see Protocol bindings.

ProtocolGenerated APIsChoose it for
restJson1Client and serverGeneral REST APIs, broad tooling support, streaming, and AWS-compatible behavior
simpleRestJsonClient and serverAlloy and Smithy4s interoperability
rpcv2CborClient and serverCompact binary RPC with CBOR and event streaming
rpcv2JsonClient and serverSmithy RPC with JSON bodies and event streaming
grpcClient and serverStandard gRPC and protobuf interoperability
awsJson1_1ClientExisting AWS JSON RPC services
awsJson1_0ClientExisting AWS JSON 1.0 services
awsQueryClientExisting AWS Query services
ec2QueryClientExisting EC2 Query services
restXmlClientExisting AWS XML services such as S3

For most new HTTP APIs, start with restJson1. Use rpcv2Cbor for compact binary Smithy RPC between compatible peers, or rpcv2Json for the same RPC model with readable JSON bodies. Use gRPC when standard protobuf and gRPC interoperability matter. The AWS Query, AWS JSON, and restXml protocols are primarily for existing AWS services and emulators.

See Protocol Status for maturity and current conformance numbers.

A service can declare more than one supported protocol. Generated clients can select a non-default protocol through their configuration, and generated servers can map several protocols to the same handler.

See Hosting and Multiple Protocols for route mapping and Client Configuration for protocol selection.

A protocol that is not listed here can be added from a separate package, without changes to NSmithy. Generated clients and servers then use it like a built-in one. See Extending NSmithy.