Devlooped.Azure.Functions.OpenApi
0.2.0
Prefix Reserved
See the version list below for details.
dotnet add package Devlooped.Azure.Functions.OpenApi --version 0.2.0
NuGet\Install-Package Devlooped.Azure.Functions.OpenApi -Version 0.2.0
<PackageReference Include="Devlooped.Azure.Functions.OpenApi" Version="0.2.0" />
paket add Devlooped.Azure.Functions.OpenApi --version 0.2.0
#r "nuget: Devlooped.Azure.Functions.OpenApi, 0.2.0"
// Install Devlooped.Azure.Functions.OpenApi as a Cake Addin #addin nuget:?package=Devlooped.Azure.Functions.OpenApi&version=0.2.0 // Install Devlooped.Azure.Functions.OpenApi as a Cake Tool #tool nuget:?package=Devlooped.Azure.Functions.OpenApi&version=0.2.0
OpenAPI/Swagger Source Generator for C# Azure Functions
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.
This assumes the routePrefix
has been configured as empty (to override the default of /api
) with:
{
...
"extensions": {
"http": {
"routePrefix": ""
}
}
}
Opening the openapi
endpoint renders the SwaggerUI:
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
:
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
, withSchemaVersion
being2
by default.Url
:/api
orextensions.http.routePrefix
inhost.json
if set to a non-empty value,/
otherwise.
Dogfooding
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
Product | Versions 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. |
-
.NETStandard 2.0
- JsonPeek (>= 1.0.3)
- Microsoft.Extensions.FileProviders.Embedded (>= 5.0.0)
- Microsoft.OpenApi (>= 1.2.3)
- Swashbuckle.AspNetCore.SwaggerUI (>= 6.2.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.