Azure / azure-functions-openapi-extension

This extension provides an Azure Functions app with Open API capability for better discoverability to consuming parties
https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.OpenApi/
MIT License
372 stars 195 forks source link

Sample - V3IoC - Unable to navigate to api/swagger/ui #192

Open OskarNet opened 3 years ago

OskarNet commented 3 years ago

Hi

I must be missing something but I'm unable to navigate to api/swagger/ui as RenderSwaggerUI and RenderSwaggerDocument are not shown as endpoints when running the functions project locally. I'm looking at the sample Microsoft.Azure.WebJobs.Extensions.OpenApi.FunctionApp.V3IoC as I've got an v3 Azure Functions project.

I'm using the latest version 0.8.1-preview

Project packages:

netcoreapp3.1 v3 7.2
<PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.0.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.OpenApi" Version="0.8.1-preview" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.OpenApi.Core" Version="0.8.1-preview" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.ServiceBus" version="4.1.0" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.3" />
<PackageReference Include="NLog" Version="4.6.8" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.0" />

Any thoughts?

Regards, Oskar

OskarNet commented 3 years ago

As the readme.md file explains it sounds like it should be enough to add the package build the project and run it and the Swagger endpoints should be created and be accessible.

justinyoo commented 3 years ago

@OskarNet Thanks for the issue. Here's the sample code project directly from the package, not from the project.

https://github.com/justinyoo/azfunc-openapi-dotnet

Would you please try this one? If it's working, please add Microsoft.Azure.WebJobs.Extensions.ServiceBus, NLog and System.Data.SqlClient one-by-one to find out which package is impacting on you.

OskarNet commented 3 years ago

Right. I've added the extension to seven of my Azure Functions projects and most are working. Don't think it's the other packages that are the problem as I've removed them and still not working for a few of them. Continuing to investigate

justinyoo commented 3 years ago

Yeah, There are several issues reporting some other NuGet packages prevents the OpenAPI document from being rendered.

justinyoo commented 3 years ago

@OskarNet Can you try this workaround? https://github.com/Azure/azure-functions-openapi-extension/issues/281#issuecomment-942883598

KholofeloMoyaba commented 2 years ago

@justinyoo Having this issue with this pair:

    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.OpenApi" Version="1.3.0" />
    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.ServiceBus" Version="5.6.0" />

Adding

    <_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>

Also doesn't work. When I add that, the swagger renders but doesn't pick up any operations - so I get an empty swagger

For now my only option seems to use the direct ServiceBus nuget (i.e. not the function app extensions one), which isn't ideal