Previous similar articles:
C# client with generics support using NSwag
C# client from multiple API versions using NSwag

Image for post
Image for post

What if we do not want to open our OpenAPI schema to the world? We can choose some paths:

  • basic authorization
  • OpenId Connect authorization using identity server

In this article, I am going to show the second path.

First of all, I tried to configure OAuth 2 authorization with integrated tools of swagger UI:

But it has some disadvantages.

  • if an access token expired then you cannot do anything, just logout login again — badly uncomfortable
  • API methods protected but swagger UI page is opened for all…


An Asking Brain

Image for post
Image for post
An Asking Brain

All of us come to blogging our paths. Somebody because of the perspective to go out from a job and make money on blogging, another to find self in letters or to give the public a taste of one’s quality. There are plenty of reasons. Everybody can share their narrative of how it happened, moreover many of us will put the same lines. However, stories will be still different; you know as a plagiary platform says per cent of unique text in your graduation work. Definitely, my sharing won’t be something unique.

It was long months of Covid-19 at home. I am a programmer, and I have an excellent opportunity to work remotely; unfortunately, many of us cannot afford it to self. Day by day, week by week, month by month. And of course, I didn’t start writing at that time, procrastination you know. …


Other similar articles:
C# client with generics support using NSwag
C# protecting Swagger endpoints

Image for post
Image for post

Previously I shared a solution about generics support in C# client generation from OpenAPI specification. In this article, I am going to show how to arrange API versioning and support it in C# client.

Before starting this article, I highly recommend visiting the previous one.

.ΝΕΤ versioning

First of all, we need our App with API versioning (NSwag wiki API versioning).

Startup class with changes:

Startup.cs with changes

Add some versions to controllers:

WeatherForecastController V1
WeatherForecastController V2

Here is an updated swagger UI as a result of the previous…


Other similar articles:
C# client from multiple API versions using NSwag
C# protecting Swagger endpoints

Image for post
Image for post

Recently I experienced difficulties with generics support in C# client generation using NSwag. I did some researches and tried to find workarounds. So, in this article, I will share with you own solution how to tune C# client code generation using NSwag.

I use the default Web API project for the starting point (instruction for creating can be found here).

Generating of a schema

First of all, we need a schema. There is a documentation of how to add nswag generation of OpenAPI 3.0 specification from C# ASP.NET …

Renat Sungatullin

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store