Devlooped.Azure.Functions.OpenApi 0.3.1

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
dotnet add package Devlooped.Azure.Functions.OpenApi --version 0.3.1
NuGet\Install-Package Devlooped.Azure.Functions.OpenApi -Version 0.3.1
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="Devlooped.Azure.Functions.OpenApi" Version="0.3.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Devlooped.Azure.Functions.OpenApi --version 0.3.1
#r "nuget: Devlooped.Azure.Functions.OpenApi, 0.3.1"
#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 Devlooped.Azure.Functions.OpenApi as a Cake Addin
#addin nuget:?package=Devlooped.Azure.Functions.OpenApi&version=0.3.1

// Install Devlooped.Azure.Functions.OpenApi as a Cake Tool
#tool nuget:?package=Devlooped.Azure.Functions.OpenApi&version=0.3.1

Icon OpenAPI/Swagger Source Generator for C# Azure Functions

Version Downloads License Build

A zero-code basic OpenAPI (Swagger) generator for C# Azure Functions.

Usage

Just install the package and run the app. By default, you will get an endpoint openapi that returns the Swagger UI for browing your API, as well as an endpoint with the standard swagger.json file. The generated swagger file will contain all HTTP-triggered functions in the compilation.

endpoints screenshot

This assumes the routePrefix has been configured as empty (to override the default of /api) in host.json:

{
  ...
  "extensions": {
    "http": {
      "routePrefix": ""
    }
  }
}

Opening the openapi endpoint renders the SwaggerUI:

swagger UI screenshot

The generated swagger.json can be inspected in the project's intermediate output path (by default, obj\Debug\[TFM]\openapi\v2\swagger.json).

The swagger.json as well as the function endpoints are generated at build-time by a C# source generator. As such, you can inspect the generated code by setting the EmitCompilerGeneratedFiles project property to true like:

  <PropertyGroup>
    <EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
  </PropertyGroup>

This will emit the generated functions source files under $(IntermediateOutputPath)\generated\Devlooped.Azure.Functions.OpenApi\SourceGenerator:

generated sources screenshot

Customization

There are several ways of customizing the generation, all driven by MSBuild.

The main generation driver is an MSBuild item OpenApi, which contains various pieces of metadata to tweak the output. Its item definition is as follows:

  <ItemDefinitionGroup>
    <OpenApi>
      <Title />
      <Description />
      <Version />
      <Route />
      <Url />
      <SchemaVersion>2</SchemaVersion>
    </OpenApi>
  </ItemDefinitionGroup>

If no <OpenApi Include=".."> is provided, one is automatically added, with the default values applied.

The default values are:

  • Title: first with a non-empty value from $(AssemblyTitle), $(Product), $(ProductName), $(Title).
  • Description: $(Description)
  • Version: first with non-empty value from $(Version), $(InformationalVersion), $(AssemblyVersion)
  • Route: /openapi/v%(SchemaVersion)/swagger.json, with SchemaVersion being 2 by default.
  • Url: /api or extensions.http.routePrefix in host.json if set to a non-empty value, / otherwise.

Dogfooding

CI Version Build

We also produce CI packages from branches and pull requests so you can dogfood builds as quickly as they are produced.

The CI feed is https://pkg.kzu.io/index.json.

The versioning scheme for packages is:

  • PR builds: 42.42.42-pr[NUMBER]
  • Branch builds: 42.42.42-[BRANCH].[COMMITS]

Sponsors

sponsored clariusclarius

get mentioned here too!

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in 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.3.1 349 9/30/2021
0.3.0 280 9/30/2021
0.2.0 312 9/30/2021