Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET - How to generate proxy classes from Swagger Restul API

In the past I've used Restsharp to consume restul API. RestSharp helps us get concrete type object for given operation. The problem with RestSharp is we need to manually create the POCO classes.

Wondering if we can consume the REST API similar to WCF proxy which generates all operations with signatures and also generates necessary POCO classes.

I tried using Azure API Client and having no luck i.e. not getting strongly typed objects from operation call.

When I directly query the swagger UI I get below:

......,"definitions":{"Object":{"type":"object","properties":{}}}}

I'm quiet new to this Swagger.

  1. Looking at JSON above, should the type and properties be of given type e.g. membership and it's properties?

  2. Am I doing the right tool i.e. azure api client?

Thanks.

like image 223
Nil Pun Avatar asked Mar 08 '16 11:03

Nil Pun


1 Answers

For Swagger proxy generation, I use Autorest. It's made by Microsoft and published as an OSS.

It's used internally to generate barebone SDK modules from Swagger endpoints in different languages.

like image 80
Matias Quaranta Avatar answered Nov 15 '22 04:11

Matias Quaranta