Skip to content

Commit 78acdd5

Browse files
committed
Add v13 deprecation announcement and quick migration guide.
1 parent 606799f commit 78acdd5

File tree

2 files changed

+106
-0
lines changed

2 files changed

+106
-0
lines changed

README.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
# GraphQL.AzureFunctionsProxy
22
## An (Unofficial) Extension pack for using HotChocolate GraphQL framework within Azure Functions for v11 & v12.
33

4+
## Update Announcement -- Deprecated as of v13:
5+
As of the new releas of Hot Chocolate GraphQL Server v13, the Azure Functions Proxy and it's feature set are now an OOTB feature of Hot Chococlate -- along with some optimizations since it's part of the core code base! This was announced and shared in the [v13 introduction blog post here!](https://chillicream.com/blog/2023/02/08/new-in-hot-chocolate-13#azure-functions)
6+
7+
I collaborated closely with the core HC team to merge the valuable elements of the `GraphQL.AzureFunctionsProxy` library into HC and enable support for both In-Process and Isolated Process Azure Functions as an OOTB feature of HC now! Therefore as of v13, this project will no longer be maintained as a separate library -- my efforts will be focused on maintaining the core functionality going forward with the HC team!
8+
9+
So if you're upgrading to v13 you’ll need to migrate (it’s very easy) to use the OOTB version [as outlined here in the quick migration guide...](migrate_to_hc_v13.md)
10+
11+
412
**Update Notes for v12.5.0.0**
513
- Added Support for new HC v12.5 which changed middleware signatures; enabling support for OpenTelemetry, etc.
614

migrate_to_hc_v13.md

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# GraphQL.AzureFunctionsProxy to HC v13 Migration Guide
2+
3+
Azure Functions are now an OOTB feature of HotChocolate GraphQL v13 supporting both In-process & Isolated Process models... 🙌🙌🙌
4+
5+
As of the new Hot Chocolate GraphQL Server v13 release, the Azure Functions Proxy and it's feature set are now an OOTB feature of Hot Chococlate -- along with some optimizations since it's part of the core code base! This was announced and shared in the [v13 introduction blog post here!](https://chillicream.com/blog/2023/02/08/new-in-hot-chocolate-13#azure-functions)
6+
7+
I collaborated closely with the core HC team to merge the valuable elements of the `GraphQL.AzureFunctionsProxy` library to enable support for both In-Process and Isolated Process Azure Functions as an OOTB feature of HC now! And therefore as of v13, this project will no longer be maintained as a separate library -- my efforts will be focused on maintaining the core functionality going forward with the HC team!
8+
9+
## Migrating an In-process Azure Function:
10+
11+
### v13 Configuration in your FunctionsStartup class:
12+
```csharp
13+
[assembly: FunctionsStartup(typeof(Startup))]
14+
public class Startup : FunctionsStartup
15+
{
16+
public override void Configure(IFunctionsHostBuilder builder)
17+
{
18+
builder
19+
.AddGraphQLFunction()
20+
//Optionally customize how the Azure Functions specific functionality works
21+
// (e.g. Enable/Disable the BananaCakePop IDE)...
22+
.ModifyFunctionOptions(options => options.Tool.Enable = true)
23+
//All of the following is normal HC Configuration
24+
.AddQueryType<Query>();
25+
}
26+
}
27+
```
28+
29+
### v13 Azure Function Binding:
30+
31+
Using the Dependency Injection approach...
32+
*Note: this is the universal approach and is virtually identical to the Isolated process function binding below.*
33+
34+
TL;DR:
35+
- `IGraphQLAzureFunctionsExecutorProxy` now becomes `IGraphQLRequestExecutor`
36+
- The call to `ExecuteFunctionsQueryAsync` is now simplified as a call to `ExecuteAsync(request)`
37+
```csharp
38+
public class GraphQLFunction
39+
{
40+
private readonly IGraphQLRequestExecutor _graphqlExecutor;
41+
public GraphQLFunction(IGraphQLRequestExecutor executor)
42+
{
43+
_graphqlExecutor = executor;
44+
}
45+
46+
[FunctionName("GraphQLHttpFunction")]
47+
public Task<IActionResult> Run(
48+
[HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = "graphql/{**slug}")] HttpRequest request
49+
) => _graphqlExecutor.ExecuteAsync(request);
50+
}
51+
```
52+
53+
Or if you really want to streamline you can use the custom binding; *but it's only supported on the In-Process model*:
54+
```csharp
55+
public class GraphQLFunction
56+
{
57+
[FunctionName("GraphQLHttpFunction")]
58+
public Task<IActionResult> Run(
59+
[HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = "graphql/{**slug}")] HttpRequest request,
60+
[GraphQL] IGraphQLRequestExecutor executor
61+
) => executor.ExecuteAsync(request);
62+
}
63+
```
64+
65+
## Migrating an Isolated Process Azure Function:
66+
67+
###v13 Startup configuration in you Program.cs class:
68+
```csharp
69+
var host = new HostBuilder()
70+
.ConfigureFunctionsWorkerDefaults()
71+
.AddGraphQLFunction(b => b.AddQueryType<Query>())
72+
.Build();
73+
74+
host.Run();
75+
```
76+
77+
### v13 Azure Function Binding:
78+
79+
*Note: It's virtually identical to the above In-Process if you are using hte Dependency injection approach.*
80+
81+
TL;DR:
82+
- `IGraphQLAzureFunctionsExecutorProxy` now becomes `IGraphQLRequestExecutor`
83+
- The call to `ExecuteFunctionsQueryAsync` is now simplified as a call to `ExecuteAsync(request)`
84+
```csharp
85+
public class GraphQLFunction
86+
{
87+
private readonly IGraphQLRequestExecutor _graphqlExecutor;
88+
public GraphQLFunction(IGraphQLRequestExecutor executor)
89+
{
90+
_graphqlExecutor = executor;
91+
}
92+
93+
[Function("GraphQLHttpFunction")]
94+
public Task<HttpResponseData> Run(
95+
[HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = "graphql/{**slug}")] HttpRequestData request
96+
) => _executor.ExecuteAsync(request);
97+
}
98+
```

0 commit comments

Comments
 (0)