Azure / Azure/azure-functions-openapi-extension

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

Open Beginner friendly
#648 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
388
Forks
202
PR merge metrics
No merged PRs in 30d

Description

In the [documentation ](https://github.com/Azure/azure-functions-openapi-extension/blob/main/docs/enable-open-api-endpoints-out-of-proc.md)

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.

Contributor guide

Open the contributing guide

Research direction

Open docs/enable-open-api-endpoints-out-of-proc.md and locate the HostBuilder example using ConfigureFunctionsWorkerDefaults. Compare it with the current Azure Functions scaffold and update the documented call to ConfigureFunctionsWebApplication while preserving the Newtonsoft JSON configuration. Confirm the example matches the scaffold and avoids the reported 200 OK white screen.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.