azure-functions-openapi-extension icon indicating copy to clipboard operation
azure-functions-openapi-extension copied to clipboard

Feature Request: Generate swagger file when FunctionApp is compiled

Open wsucoug69 opened this issue 3 years ago • 4 comments

It would be great to have the ability to produce swagger.json or swagger.yaml when the FunctionApp is compiled.

Issue: When we are running a pipeline (using a bicep template) to create the API operations (in Azure API Management), using the swagger URL for the FunctionApp. The swagger file is not accessible when the FunctionApp is configured with Authentication.

Workaround: One workaround would be to have an option to output the swagger.json as part of the build where the bicep template cold reference the file locally.

any thoughts??

wsucoug69 avatar Feb 18 '22 19:02 wsucoug69

@zapadoody Thanks for the issue. We're working on the CLI feature to sort out your request. However, in the meantime, you can still figure that out by a small trick like:

https://github.com/Azure/azure-functions-openapi-extension/blob/e432a6bcdcd6f060f8a0cc58db680066f20157cb/.github/workflows/main-build.yaml#L77-L108

It's our GitHub Actions workflow, which you might be interested in getting the OpenAPI document within your CI/CD pipeline.

And here's the blog post you might want to read.

justinyoo avatar Feb 20 '22 15:02 justinyoo

Perfect thanks for the workaround, I'll keep an eye out for the CLI update.

wsucoug69 avatar Feb 22 '22 13:02 wsucoug69

@zapadoody - would you mind sharing detail on how you applied the workaround?

Would be keen to have the swagger file generated in build pipeline myself =)

NeillCain-zz avatar Apr 05 '22 11:04 NeillCain-zz

As this PR, #489, has been merged, you can generate the OpenAPI doc within the GitHub Actions workflow on-the-fly.

justinyoo avatar Sep 20 '22 07:09 justinyoo