Devlooped.Azure.Functions.OpenApi 0.3.1 Prefix Reserved

Install-Package Devlooped.Azure.Functions.OpenApi -Version 0.3.1
dotnet add package Devlooped.Azure.Functions.OpenApi --version 0.3.1
<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
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Devlooped.Azure.Functions.OpenApi, 0.3.1"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. 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
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

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!

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 92 9/30/2021
0.3.0 99 9/30/2021
0.2.0 114 9/30/2021