From the course: Building and Securing RESTful APIs in ASP.NET Core

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Add NSwag to the project

Add NSwag to the project - ASP.NET Core Tutorial

From the course: Building and Securing RESTful APIs in ASP.NET Core

Start my 1-month free trial

Add NSwag to the project

- [Instructor] There are a couple of tools that you can use to add the Open API capabilities to an ASP.net core project, with Swashbuckle and Nswag currently being the most popular. In this video, I'll show you how to add Nswag to your project. First, we'll start in the NuGet package manager. I need to search for 'Nswag dot ASP net core' and install this package. Then, in Startup.cs, we can add Swagger UI to the configure method. I'm gonna add it only when the application is running in development mode. I'll do 'app dot use swagger UI' 'three with API explorer'. Import this name space, Nswag dot ASP net core. I can pass some options to it. I'll do 'options dot generator settings' 'dot default property name handling' and tell it that I want 'N Json Schema' 'dot property name handling dot camel case properties'. Alright, let's run this project. I'll open up a browser and browse to slash swagger. Let me get the port once again. I'll open up a browser. Go to local host, my ports slash…

Contents