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

Documentation: Update .ConfigureFunctionsWorkerDefaults(...) to be .ConfigureFunctionsWebApplication(...)

throwaway34059 opened this issue · comments

In the documentation

It says to use:

namespace MyOpenApiFunctionApp
{
    public class Program
    {
        public static void Main()
        {
            var host = new HostBuilder()
            // Remove this line below
                .ConfigureFunctionsWorkerDefaults()
            // Remove this line above

            // Add these lines below
                .ConfigureFunctionsWorkerDefaults(worker => worker.UseNewtonsoftJson())
            // Add these lines above
                .Build();

            host.Run();
        }
    }
}

I guess newer versions of Azure Functions it should be:

.ConfigureFunctionsWebApplication(worker => worker.UseNewtonsoftJson())

This is mentioned in #629 but it's subtle and not the focus of that ticket. It took me a several tries and a couple hours to realize the documentation does not meet the scaffold of the function.

If you replace the line in the scaffold with documented version of things your get a 200 OK white screen.