Skip to content

About

Smithy code generation for .NET. Typed clients, ASP.NET Core servers, and models, generated during dotnet build.

Topics

Resources

Contributing

Stars

14 stars

Watchers

0 watching

Forks

Latest commit

 

History

290 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NSmithy

CI Docs NuGet .NET 10 License Smithy CLI

Preview: NSmithy is in preview; expect some API changes before 1.0.


Docs · Examples · Design Docs · smithy.io

NSmithy is a community-maintained Smithy code generator for C# and .NET. Smithy is a protocol-agnostic interface definition language: a model describes a service's operations, data types, and errors once, independent of programming language. AWS defines its entire API surface in Smithy and generates its SDKs from it. Larger organizations also use it for API governance, since models can be linted, validated, and checked for breaking changes before any code exists.

Smithy has code generators for Java, TypeScript, Go, Rust, Python, Kotlin, and Scala, so a .NET service and clients in those languages can share one model. NSmithy generates typed clients, ASP.NET Core server stubs, and model types from a Smithy model during dotnet build, with no separate codegen step. A client and a server generated from the same model agree on routes, serialization, and errors. It supports restJson1, rpcv2Cbor, gRPC, and the AWS protocols; see protocol status.

Quick start

With the .NET 10 SDK and the Smithy CLI installed:

dotnet new install NSmithy.Templates
dotnet new nsmithy-contracts -n HelloWorld.Contracts
dotnet new nsmithy-server -n HelloWorld.Server --contracts-project HelloWorld.Contracts
dotnet run --project HelloWorld.Server

Pass --smithy-cli-package to the templates to get the Smithy CLI from NuGet instead. The quick start adds a client and walks through the generated code.

Contributing

See CONTRIBUTING.md for the development environment and build recipes.

Related Projects

  • Smithy, the IDL NSmithy is built on.
  • smithy4s, the main inspiration for NSmithy.
  • alloy, used for simpleRestJson and gRPC.
  • smithy-go and smithy-typescript, the official generators for Go and TypeScript.
  • TypeSpec, Microsoft's alternative with first-party .NET emitters.

About

Smithy code generation for .NET. Typed clients, ASP.NET Core servers, and models, generated during dotnet build.

Topics

Resources

Contributing

Stars

14 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages