reactiveui / refit

The automatic type-safe REST library for .NET Core, Xamarin and .NET. Heavily inspired by Square's Retrofit library, Refit turns your REST API into a live interface.
https://reactiveui.github.io/refit/
MIT License
8.54k stars 748 forks source link

Interface and model generation from swagger #380

Open tibitoth opened 6 years ago

tibitoth commented 6 years ago

Hi, Is there any plan to support interface (and model) generation from swagger to refit?

jjwilliams42 commented 6 years ago

Not sure if you were aware, but there is a project for generating client libraries for a swagger api.

https://github.com/swagger-api/swagger-codegen

tibitoth commented 6 years ago

I know this but maybe we can create a generator for refit too.

0xced commented 5 years ago

I haven't used it, but I found https://github.com/itofinity/swagger-csharp-refit which seems to produce interfaces and models from a swagger definition.

GitHub
itofinity/swagger-csharp-refit
Contribute to itofinity/swagger-csharp-refit development by creating an account on GitHub.
RobJohnston commented 3 years ago

See also https://github.com/OpenAPITools/openapi-generator/issues/3581

Dreamescaper commented 3 years ago

Some time ago I've created small dotnet tool to generate Refit interfaces from ASP.NET Core projects. It doesn't support swagger, and it doesn't generate DTO models (as the intention is to reuse same requests/responses), but maybe it would be useful to someone. https://github.com/Dreamescaper/GenerateAspNetCoreClient

GitHub
Dreamescaper/GenerateAspNetCoreClient
DotNet tool to generate HTTP client classes from ASP.NET Core api controllers. - Dreamescaper/GenerateAspNetCoreClient
christianhelle commented 1 year ago

I have only recently discovered Refit and also created a small dotnet CLI tool to generate a Refit interface and contracts from OpenAPI (Swagger) specifications.

I hope it's useful to someone.

https://github.com/christianhelle/refitter

GitHub
GitHub - christianhelle/refitter: Refit Client SDK Generator for OpenAPI
Refit Client SDK Generator for OpenAPI. Contribute to christianhelle/refitter development by creating an account on GitHub.