RESTly 0.9.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package RESTly --version 0.9.0                
NuGet\Install-Package RESTly -Version 0.9.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="RESTly" Version="0.9.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RESTly --version 0.9.0                
#r "nuget: RESTly, 0.9.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install RESTly as a Cake Addin
#addin nuget:?package=RESTly&version=0.9.0

// Install RESTly as a Cake Tool
#tool nuget:?package=RESTly&version=0.9.0                

RESTly

A (experimental, WIP) C# source generator for generating REST clients out of OpenApi specifications. Currently, supports .NET 8 SDK. Generated code can target as low as netstandard2.0, but with additional polyfills needed.

Getting Started

  • Add NuGet package RESTly to your project
  • Add a OpenApi specification as AdditionalFiles to your project
  • Add assembly attribute RestlyClient into your code with the name of the OpenApi specification file and the name of the api client to generate
  • The generated API client is located in the Restly namespace

Native AOT

This source generator generates AOT compatible code from version 0.7 onwards. For using AOT there is the need to add a client library project additionally to the application itself. In the application project the JSON serialization context for the generated API models must be defined. The split into projects is necessary as RESTly and JSON serialization context need source generators and those can not be chained.

Target older framework versions

Building RESTly client libraries makes a new .NET SDK version necessary. Target is to support at least the latest LTS version (but no guarantee).

With RESTly it is possible to build REST clients for older .NET versions netstandard 2.0 and onwards compatible (, see https://learn.microsoft.com/en-us/dotnet/standard/net-standard). When building for older .NET versions, additional dependencies might become necessary. This can be seen in the ClientLibrary example project.

File uploads

There is one possible issue with file upload. When using minimal APIs with the .WithOpenApi() extension method and call parameters of type IFormFile the generated schema contains no names for the form field names. This makes the automated generation of client code hardly possible. For using such endpoints the correct names must be given in the Name field of the body parameter.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.12.0 0 12/2/2024
0.11.0 109 11/4/2024
0.10.0 108 10/9/2024
0.9.0 134 9/11/2024
0.8.0 94 7/23/2024
0.7.0 106 6/23/2024
0.6.0 125 5/26/2024
0.5.0 109 5/16/2024
0.4.0 83 5/2/2024
0.3.0 181 3/27/2024
0.2.0 178 3/10/2024
0.1.0 134 2/25/2024