This extension adds the functionality to run the OpenAPI as CLI project. In this way you can create a OpenAPI definition on build time of your functions project.
Add the nuget package to your function project
rebuild your project.
you can then create a OpenAPI output by running the following command in your root of your function project.
dotnet ./bin/debug/net8.0/azfuncopenapi.dll
Make sure you swap out net8.0 for the version you are using within your project
Option | Description |
---|---|
-p (--project) | specify the path to your project (Default is current directory) |
-o (--output) | specify the output path for swagger definition file |
-a (--apibaseurl) | specify the API base url used within the swagger definition (default localhost) |
-c (--configuration) | Specify the project Configuration. Default is 'Debug |
-t (--target) | Specifty the project target framework. Default is 'net8.0' |
-v (--version) | Specify the OpenAPI version. Default is V3 |
-f (--format) | Specify the OpenAPI output format. Value can be either 'json' or 'yaml'. Default is 'json |
add the following to your csproj. file
*** This is not published to a public registry, you will need to publish this nuget to your own registry.
dotnet add package Microsoft.Azure.Functions.Worker.Extensions.OpenApi.CLI --version 1.0.7
see the props available for customization.