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

This package is source generator for great nswag tool. Inspired by H.NSwag.Generator

Install

Install-Package ST.NSwag.ServerSourceGenerator

Usage

  1. Put openapi specification in project dir and add AdditionalFiles tag to project
<ItemGroup>
        <AdditionalFiles Include="example.openapi.yaml" />
</ItemGroup>

or link specification outside project dir

<ItemGroup>        
        <AdditionalFiles Include="..\specs\linkedExample.openapi.yaml" Link="linkedExample.openapi.yaml" />
</ItemGroup>
  1. Add .nswag settings file in project dir with exact same name.
    Example: example.openapi.yaml -> example.openapi.yaml.nswag

Faq

  • How to generate or edit .nswag file?

Use NSwagStudio