Skip to content

CSharpControllerGenerator

Rico Suter edited this page Jun 6, 2019 · 1 revision

Generates Web API/ASP.NET Core controllers from a Swagger/OpenAPI specification.

ASP.NET Core

To generate ASP.NET Core controllers set:

  • AspNetNamespace = "Microsoft.AspNetCore.Mvc"
  • ControllerBaseClass = "Microsoft.AspNetCore.Mvc.Controller"

CLI example

dotnet "/.../dotnet-nswag.dll" openapi2cscontroller /input:https://somewhere.com/swagger.yaml /classname:MyResource /namespace:Com.Example.MyResource /output:Controllers/ResourceController.cs /UseLiquidTemplates:true /AspNetNamespace:"Microsoft.AspNetCore.Mvc" /ControllerBaseClass:"Microsoft.AspNetCore.Mvc.Controller"
You can’t perform that action at this time.