Azure / azure-functions-openapi-extension

This extension provides an Azure Functions app with Open API capability for better discoverability to consuming parties

Home Page:https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.OpenApi/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Generate OpenApi swagger at build time.

davidpetric opened this issue · comments

Description

I am wondering if there is a way to generate the swagger file at BUILD time from OpenApi attributes.

We are working on a project that involves a lot of Azure Functions and we use NSwag to generate HttpClients for them. However, we have to do this manually every time because we need to run the functions and get the OpenAPI document first.

Is there a better solution for this? I would appreciate any suggestions or tips. Thank you very much.

I'm searching for the exact same thing. I did not find anything yet, there is pipeline support which does something related:

https://github.com/Azure/azure-functions-openapi-extension/blob/main/docs/generic-cicd-pipeline-support.md

Another thing I've tried is the nswag aspnetcore2openapi command, but that is barely documented and used. Couldn't get it to work properly on my function project.

https://github.com/RicoSuter/NSwag/wiki/AspNetCoreToOpenApiCommand

Another option seems to be OpenApiReference, but after a few tries, this doesn't seem to be the answer here as well.

https://learn.microsoft.com/en-us/aspnet/core/web-api/microsoft.dotnet-openapi?view=aspnetcore-6.0