-
Notifications
You must be signed in to change notification settings - Fork 1
Getting Started
This tutorial demonstrates how to auto-generate a C# client SDK using the OpenAPI v3 specification. Open source and commercial tools for client/server SDK generation are available for the most popular programming languages. A list of recognized tools is available here: https://openapi.tools.
The following example uses NSwag CLI to generate a C# client library and ASP.NET controller stubs.
Read more https://www.npmjs.com/get-npm
Open your terminal and enter the following command to install NSwag on your system globally.
npm install nswag -g
Open your terminal and enter the following command to generate the client code in the current directory. The command will generate one C# class file with the specified class and filename.
nswag swagger2csclient /input:https://stanlab-api.test.miljoeportal.dk/openapi/v1/swagger.json /classname:StanlabClient /output:StanlabClient.cs
nswag swagger2cscontroller /input:https://stanlab-api.test.miljoeportal.dk/openapi/v1/swagger.json /classname:ControllerBase /output:ControllerBase.cs
For more configuration, see the NSwag command line interface documentation.
https://github.com/RSuter/NSwag/wiki/CommandLine
Open the project in Visual Studio and run the example code.