Skip to main content

A clean way to add Swagger to ASP.NET Core application

Swagger needs no introduction. It is one of the best methods to test your WEB APIs. Adding swagger to your ASP.NET Core application is very easy and straightforward. I already have a couple of posts on my blog on Swagger. Swagger comes with many options and customization to help you prepare better API documentation. The ASP.NET Core Startup.cs is the place to add Swagger or any middleware that you would like to use in your ASP.NET Core application. The Startup.cs file will become lengthy when we use more swagger customization. So in this post, we’ll see a clean way to add Swagger to ASP.NET Core application using C# extension methods. Read More

Create Petstore like Swagger UI for ASP.NET Core WEB API

Swagger doesn’t need an introduction as it is the world’s largest framework of API developer tools for the OpenAPI Specification(OAS), enabling development across the entire API life-cycle, from design and documentation, to test and deployment. Swagger is an UI representation of your RESTful API. It allows anyone — be it your development team or your end consumers — to visualize and interact with the API’s resources having none of the implementation logic in place. The Petstore (created by the swagger team) is a demonstration of the beautiful Swagger UI. You can easily integrate the Swagger in your application, but the sad part is you will get a different UI, not same as available @ Petstore. In this post, let’s find out how to create Petstore like Swagger UI for ASP.NET Core WEB API.
Read More

Add Swagger to ASP.NET Core 2.0 Web API

Testing WEB APIs is a challenge, and it has a dependency on various third-party tools for proper and efficient testing. But swagger can make it easy. Swagger is an UI representation of your RESTful API. Swagger UI allows anyone — be it your development team or your end consumers — to visualize and interact with the API’s resources having none of the implementation logic in place. It’s automatically generated from your Swagger specification, with the visual documentation, making it easy for back-end implementation and client-side consumption. Earlier, I posted about adding swagger with ASP.NET Core but it no longer works with ASP.NET Core 2.0 due to new changes with ASP.NET Core 2.0. In this post, we’ll see how to add Swagger to ASP.NET Core 2.0 Web API. Read More

Support multiple versions of ASP.NET Core Web API

Versioning helps in rolling out features on a timely basis, without breaking the existing system. It can also help to provide additional functionalities to selected customers. API versioning can be done in different ways like appending the version in the URL or as a query string parameter, via custom header and via Accept-Header. In this post, let’s find how to support multiple version ASP.NET Core Web API. Read More

upload file via Swagger in ASP.NET Core Web API

How to upload file via Swagger in ASP.NET Core Web API

Swagger is a simple, clean and powerful representation of your RESTful API. Once integrated with WEB API, it provides a UI which helps in testing the API with ease. In my earlier post, I explained about how to integrate swagger with the ASP.NET Core Web API. And it works great with all HTTP verbs and input parameters. But uploading a file via Swagger is not straightforward. In this post, let’s find out how to upload file via Swagger in ASP.NET Core Web API. Read More

How to enable gzip compression in ASP.NET Core

ASP.NET Core 1.1 has an inbuilt middleware for Response compression, which by default uses gzip compression. All modern browsers support response compression, and you should take advantage of it. Instead of sending response from the server as it is, it’s better to compress it and then send it, as this will reduce the response size and provides better speed. So in this post, let’s see how to enable gzip compression in ASP.NET Core. Read More