azure-functions-openapi-extension
azure-functions-openapi-extension copied to clipboard
Documentation: Update .ConfigureFunctionsWorkerDefaults(...) to be .ConfigureFunctionsWebApplication(...)
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.