Skip to content

AssemblyTypeToSwaggerGenerator

Rico Suter edited this page May 14, 2016 · 9 revisions

Package: NSwag.AssemblyLoader

The following code generates a Swagger specification for the given type and no operations. The intention is to generate DTO classes for other programming platforms from via a Swagger specification.

var settings = new AssemblyTypeToSwaggerGenerator
{
	AssemblyPath = "path/to/assembly.dll"
};

var generator = new AssemblyTypeToSwaggerGenerator(settings);
var service = generator.Generate(new string[] { "FullTypeName" });

var swaggerSpecification = service.ToJson();

The external assembly is loaded in a seperate AppDomain so that there are no type collisions and the assembly can be correctly unloaded.

Settings

More information: AssemblyTypeToSwaggerGeneratorSettings.cs

Clone this wiki locally