OpenAPI (Swagger) Connected Service is a Visual Studio extension to generate C#
HttpClient
code for OpenAPI
(formerly Swagger API
) web service with NSwag
Simply put, it is like Add Service Reference
for WCF
or Add Web Reference
for WSDL
, but for JSON
API
.
Install from Tools -> Extensions and Updates
menu inside Visual Studio or download as VSIX
package from Visual Studio Marketplace
- How to open *.nswag files with NSwagStudio from Solution Explorer
- How to add generated HttpClient to ASP.NET Core dependency injection (DI)
If your project target framework is net461
you might need to add the following packages via NuGet Package Manager
:
- If generated code corrupted, try to open
.nswag
file inNSwagStudio
(Windows GUI for editing .*nswag files). - If it doesn't open, try to create new
.nswag
file inNSwagStudio
for the same API service link and check the differences. - If you found bug, please report it here. Thank you in advance!
See the changelog for the further development plans and version history.
Please feel free to request a feature or report a bug.
Just consider buying me a coffee. Thank you for your support!