Skip to content

Commit 8b60a5b

Browse files
authored
Mark GraphQL Playground as obsolete (#1165)
1 parent bae4b0d commit 8b60a5b

File tree

28 files changed

+71
-54
lines changed

28 files changed

+71
-54
lines changed

README.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Provides the following packages:
2121
| GraphQL.Server.All | [![Nuget](https://img.shields.io/nuget/dt/GraphQL.Server.All)](https://www.nuget.org/packages/GraphQL.Server.All) | [![Nuget](https://img.shields.io/nuget/v/GraphQL.Server.All)](https://www.nuget.org/packages/GraphQL.Server.All) | Includes all the packages below, plus the `GraphQL.DataLoader` and `GraphQL.MemoryCache` packages |
2222
| GraphQL.Server.Transports.AspNetCore | [![Nuget](https://img.shields.io/nuget/dt/GraphQL.Server.Transports.AspNetCore)](https://www.nuget.org/packages/GraphQL.Server.Transports.AspNetCore) | [![Nuget](https://img.shields.io/nuget/v/GraphQL.Server.Transports.AspNetCore)](https://www.nuget.org/packages/GraphQL.Server.Transports.AspNetCore) | Provides GraphQL over HTTP/WebSocket server support on top of ASP.NET Core, plus authorization rule support |
2323
| GraphQL.Server.Ui.Altair | [![Nuget](https://img.shields.io/nuget/dt/GraphQL.Server.Ui.Altair)](https://www.nuget.org/packages/GraphQL.Server.Ui.Altair) | [![Nuget](https://img.shields.io/nuget/v/GraphQL.Server.Ui.Altair)](https://www.nuget.org/packages/GraphQL.Server.Ui.Altair) | Provides Altair UI middleware |
24-
| GraphQL.Server.Ui.Playground | [![Nuget](https://img.shields.io/nuget/dt/GraphQL.Server.Ui.Playground)](https://www.nuget.org/packages/GraphQL.Server.Ui.Playground) | [![Nuget](https://img.shields.io/nuget/v/GraphQL.Server.Ui.Playground)](https://www.nuget.org/packages/GraphQL.Server.Ui.Playground) | Provides Playground UI middleware |
24+
| GraphQL.Server.Ui.Playground :warning: | [![Nuget](https://img.shields.io/nuget/dt/GraphQL.Server.Ui.Playground)](https://www.nuget.org/packages/GraphQL.Server.Ui.Playground) | [![Nuget](https://img.shields.io/nuget/v/GraphQL.Server.Ui.Playground)](https://www.nuget.org/packages/GraphQL.Server.Ui.Playground) | Provides Playground UI middleware (deprecated) |
2525
| GraphQL.Server.Ui.GraphiQL | [![Nuget](https://img.shields.io/nuget/dt/GraphQL.Server.Ui.GraphiQL)](https://www.nuget.org/packages/GraphQL.Server.Ui.GraphiQL) | [![Nuget](https://img.shields.io/nuget/v/GraphQL.Server.Ui.GraphiQL)](https://www.nuget.org/packages/GraphQL.Server.Ui.GraphiQL) | Provides GraphiQL UI middleware |
2626
| GraphQL.Server.Ui.Voyager | [![Nuget](https://img.shields.io/nuget/dt/GraphQL.Server.Ui.Voyager)](https://www.nuget.org/packages/GraphQL.Server.Ui.Voyager) | [![Nuget](https://img.shields.io/nuget/v/GraphQL.Server.Ui.Voyager)](https://www.nuget.org/packages/GraphQL.Server.Ui.Voyager) | Provides Voyager UI middleware |
2727

@@ -81,7 +81,7 @@ Then update your `Program.cs` or `Startup.cs` to configure GraphQL, registering
8181
and the serialization engine as a minimum. Configure WebSockets and GraphQL in the HTTP
8282
pipeline by calling `UseWebSockets` and `UseGraphQL` at the appropriate point.
8383
Finally, you may also include some UI middleware for easy testing of your GraphQL endpoint
84-
by calling `UseGraphQLVoyager` or a similar method at the appropriate point.
84+
by calling `UseGraphQLGraphiQL` or a similar method at the appropriate point.
8585

8686
Below is a complete sample of a .NET 6 console app that hosts a GraphQL endpoint at
8787
`http://localhost:5000/graphql`:
@@ -118,9 +118,9 @@ var app = builder.Build();
118118
app.UseDeveloperExceptionPage();
119119
app.UseWebSockets();
120120
app.UseGraphQL("/graphql"); // url to host GraphQL endpoint
121-
app.UseGraphQLPlayground(
122-
"/", // url to host Playground at
123-
new GraphQL.Server.Ui.Playground.PlaygroundOptions
121+
app.UseGraphQLGraphiQL(
122+
"/", // url to host GraphiQL at
123+
new GraphQL.Server.Ui.GraphiQL.GraphiQLOptions
124124
{
125125
GraphQLEndPoint = "/graphql", // url of GraphQL endpoint
126126
SubscriptionsEndPoint = "/graphql", // url of GraphQL endpoint
@@ -297,11 +297,11 @@ public static IActionResult RunGraphQL(
297297
4. Optionally, add a UI package to the project and configure it:
298298

299299
```csharp
300-
[FunctionName("Playground")]
301-
public static IActionResult RunGraphQL(
300+
[FunctionName("GraphiQL")]
301+
public static IActionResult RunGraphiQL(
302302
[HttpTrigger(AuthorizationLevel.Anonymous, "get"] HttpRequest req)
303303
{
304-
return new PlaygroundActionResult(opts => opts.GraphQLEndPoint = "/api/graphql");
304+
return new GraphiQLActionResult(opts => opts.GraphQLEndPoint = "/api/graphql");
305305
}
306306
```
307307

@@ -534,20 +534,21 @@ field authorization will perform role and policy checks against the same authent
534534
### UI configuration
535535

536536
There are four UI middleware projects included; Altair, GraphiQL, Playground and Voyager.
537+
Playground has not been updated since 2019 and is deprecated in favor of GraphiQL.
537538
See review the following methods for configuration options within each of the 4 respective
538539
NuGet packages:
539540

540541
```csharp
541542
app.UseGraphQLAltair();
542543
app.UseGraphQLGraphiQL();
543-
app.UseGraphQLPlayground();
544+
app.UseGraphQLPlayground(); // deprecated
544545
app.UseGraphQLVoyager();
545546

546547
// or
547548
548549
endpoints.MapGraphQLAltair();
549550
endpoints.MapGraphQLGraphiQL();
550-
endpoints.MapGraphQLPlayground();
551+
endpoints.MapGraphQLPlayground(); // deprecated
551552
endpoints.MapGraphQLVoyager();
552553
```
553554

samples/Samples.Authorization/Program.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@
6161
// configure the graphql endpoint at "/graphql"
6262
app.UseGraphQL("/graphql");
6363
// configure Playground at "/ui/graphql"
64-
app.UseGraphQLPlayground(
64+
app.UseGraphQLGraphiQL(
6565
"/ui/graphql",
66-
new GraphQL.Server.Ui.Playground.PlaygroundOptions
66+
new GraphQL.Server.Ui.GraphiQL.GraphiQLOptions
6767
{
6868
GraphQLEndPoint = "/graphql",
6969
SubscriptionsEndPoint = "/graphql",
70-
RequestCredentials = GraphQL.Server.Ui.Playground.RequestCredentials.Include,
70+
RequestCredentials = GraphQL.Server.Ui.GraphiQL.RequestCredentials.Include,
7171
});
7272
// -------------------------------------
7373

samples/Samples.Authorization/Samples.Authorization.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
<ItemGroup>
2121
<ProjectReference Include="..\..\src\Transports.AspNetCore\Transports.AspNetCore.csproj" />
22-
<ProjectReference Include="..\..\src\Ui.Playground\Ui.Playground.csproj" />
22+
<ProjectReference Include="..\..\src\Ui.GraphiQL\Ui.GraphiQL.csproj" />
2323
</ItemGroup>
2424

2525
</Project>

samples/Samples.AzureFunctions/GraphQL.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using GraphQL.Server.Transports.AspNetCore;
2-
using GraphQL.Server.Ui.Playground;
2+
using GraphQL.Server.Ui.GraphiQL;
33
using Microsoft.AspNetCore.Http;
44
using Microsoft.AspNetCore.Mvc;
55
using Microsoft.Azure.WebJobs;
@@ -20,13 +20,13 @@ public static IActionResult RunGraphQL(
2020
return new GraphQLExecutionActionResult();
2121
}
2222

23-
[FunctionName("Playground")]
24-
public static IActionResult RunPlayground(
23+
[FunctionName("GraphiQL")]
24+
public static IActionResult RunGraphiQL(
2525
[HttpTrigger(AuthorizationLevel.Anonymous, "get")] HttpRequest request,
2626
ILogger log)
2727
{
28-
log.LogInformation("C# HTTP trigger function processed a request for the GraphQL Playground UI.");
28+
log.LogInformation("C# HTTP trigger function processed a request for the GraphiQL UI.");
2929

30-
return new PlaygroundActionResult(opts => opts.GraphQLEndPoint = "/api/graphql"); // /api/graphql route will call RunGraphQL method
30+
return new GraphiQLActionResult(opts => opts.GraphQLEndPoint = "/api/graphql"); // /api/graphql route will call RunGraphQL method
3131
}
3232
}

samples/Samples.AzureFunctions/Samples.AzureFunctions.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
<ItemGroup>
1212
<ProjectReference Include="..\..\src\Transports.AspNetCore\Transports.AspNetCore.csproj" />
1313
<ProjectReference Include="..\..\src\Ui.GraphiQL\Ui.GraphiQL.csproj" />
14-
<ProjectReference Include="..\..\src\Ui.Playground\Ui.Playground.csproj" />
1514
<ProjectReference Include="..\Samples.Schemas.Chat\Samples.Schemas.Chat.csproj" />
1615
</ItemGroup>
1716
<ItemGroup>

samples/Samples.Basic/Program.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
app.UseWebSockets();
1616
// configure the graphql endpoint at "/graphql"
1717
app.UseGraphQL("/graphql");
18-
// configure Playground at "/"
19-
app.UseGraphQLPlayground(
18+
// configure GraphiQL at "/"
19+
app.UseGraphQLGraphiQL(
2020
"/",
21-
new GraphQL.Server.Ui.Playground.PlaygroundOptions
21+
new GraphQL.Server.Ui.GraphiQL.GraphiQLOptions
2222
{
2323
GraphQLEndPoint = "/graphql",
2424
SubscriptionsEndPoint = "/graphql",

samples/Samples.Basic/Samples.Basic.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<ItemGroup>
1111
<ProjectReference Include="..\..\src\Transports.AspNetCore\Transports.AspNetCore.csproj" />
1212
<ProjectReference Include="..\Samples.Schemas.Chat\Samples.Schemas.Chat.csproj" />
13-
<ProjectReference Include="..\..\src\Ui.Playground\Ui.Playground.csproj" />
13+
<ProjectReference Include="..\..\src\Ui.GraphiQL\Ui.GraphiQL.csproj" />
1414
</ItemGroup>
1515

1616
</Project>

samples/Samples.Complex/Startup.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public void Configure(IApplicationBuilder app)
6060
ReadFormOnPost = true,
6161
});
6262

63+
#pragma warning disable CS0618 // Type or member is obsolete
6364
app.UseGraphQLPlayground(options: new PlaygroundOptions
6465
{
6566
BetaUpdates = true,
@@ -87,6 +88,7 @@ public void Configure(IApplicationBuilder app)
8788
["MyHeader2"] = 42,
8889
},
8990
});
91+
#pragma warning restore CS0618 // Type or member is obsolete
9092

9193
app.UseGraphQLGraphiQL(options: new GraphiQLOptions
9294
{

samples/Samples.Complex/StartupWithRouting.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ public void Configure(IApplicationBuilder app)
6565
ReadFormOnPost = true,
6666
});
6767

68+
#pragma warning disable CS0618 // Type or member is obsolete
6869
endpoints.MapGraphQLPlayground(options: new PlaygroundOptions
6970
{
7071
BetaUpdates = true,
@@ -92,6 +93,7 @@ public void Configure(IApplicationBuilder app)
9293
["MyHeader2"] = 42,
9394
},
9495
});
96+
#pragma warning restore CS0618 // Type or member is obsolete
9597

9698
endpoints.MapGraphQLGraphiQL(options: new GraphiQLOptions
9799
{

samples/Samples.Cors/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
// configure the graphql endpoint at "/graphql"
3030
endpoints.MapGraphQL("/graphql")
3131
.RequireCors("MyCorsPolicy");
32-
// configure Playground at "/"
33-
endpoints.MapGraphQLPlayground("/");
32+
// configure GraphiQL at "/"
33+
endpoints.MapGraphQLGraphiQL("/");
3434
});
3535
await app.RunAsync();

0 commit comments

Comments
 (0)