Previous similar articles:
C# client with generics support using NSwag
C# client from multiple API versions using NSwag
What if we do not want to open our OpenAPI schema to the world? We can choose some paths:
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.
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
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.
First of all, we need our App with API versioning (NSwag wiki API versioning).
Startup class with changes:
Add some versions to controllers:
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
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).
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 …