OpenAPI (aka Swagger) in Azure Functions V2

Albert picture Albert · Sep 25, 2018 · Viewed 9.7k times · Source

I'm creating a V2 Function App and want to use Swagger/Open API for docs, however it is not yet supported in the Azure Portal for V2 Functions.

Any suggestions on how I can use Swagger with V2 Functions in VSTS to create the docs on each build?

Answer

justinyoo picture justinyoo · Feb 6, 2019

TL;DR - use the NuGet package to render Open API document and Swagger UI through Azure Functions.

—-

Microsoft hasn’t officially started supporting Open API (or Swagger) yet. But there is a community-driven NuGet package currently available:

https://www.nuget.org/packages/Aliencube.AzureFunctions.Extensions.OpenApi/

And here’s the blog post for it:

https://devkimchi.com/2019/02/02/introducing-swagger-ui-on-azure-functions/

Basically its usage is similar to Swashbuckle — using decorators. And it supports both Azure Functions V1 and V2.

Acknowledgement: I am the owner of the NuGet package.