Skip to content

neuronesb/NSwag

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NSwag: The Swagger API toolchain for .NET and TypeScript

NuGet Version Build status CI: Build status

NSwag is a Swagger 2.0 API toolchain for .NET, TypeScript and other platforms, written in C#. The Swagger specification uses JSON and JSON Schema to describe a RESTful web API. The project provides tools to automatically generate client code from these Swagger specifications and integrate this generation into existing processes.

The NSwag project heavily uses NJsonSchema for .NET for JSON Schema handling and C#/TypeScript class/interface generation.

Ways to use the toolchain:

Swagger Generators:

Code Generators:

Downloads

Usage in C#

The following code shows how to read a Swagger specification and generate C# client classes to call the described web services:

var service = SwaggerService.FromJson("...");

var settings = new SwaggerToCSharpClientGeneratorSettings 
{
    ClassName = "MyClass",
    Namespace = "MyNamespace"
};

var generator = new SwaggerToCSharpClientGenerator(service, settings);
var code = generator.GenerateFile();

Check out the project Wiki for more information.

NSwagStudio

The generators can be used in a comfortable and simple Windows GUI called NSwagStudio:

About

NSwag: The Swagger API toolchain for .NET

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 89.9%
  • JavaScript 5.3%
  • TypeScript 4.7%
  • Other 0.1%