From f6572cc7a0994f44ecafb0776dc86c7987b5c9ef Mon Sep 17 00:00:00 2001 From: Shane32 Date: Mon, 18 Nov 2024 13:33:25 -0500 Subject: [PATCH 1/3] Mark GraphQL Playground as obsolete --- samples/Samples.Authorization/Program.cs | 6 +++--- .../Samples.Authorization.csproj | 2 +- samples/Samples.AzureFunctions/GraphQL.cs | 8 ++++---- .../Samples.AzureFunctions.csproj | 1 - samples/Samples.Basic/Program.cs | 6 +++--- samples/Samples.Basic/Samples.Basic.csproj | 2 +- samples/Samples.Complex/Startup.cs | 2 ++ samples/Samples.Complex/StartupWithRouting.cs | 2 ++ samples/Samples.Cors/Program.cs | 4 ++-- samples/Samples.Cors/Samples.Cors.csproj | 2 +- samples/Samples.EndpointRouting/Program.cs | 4 ++-- .../Samples.EndpointRouting.csproj | 2 +- samples/Samples.MultipleSchemas/Program.cs | 16 ++++++++-------- .../Samples.MultipleSchemas.csproj | 2 +- .../PlaygroundApplicationBuilderExtensions.cs | 1 + .../PlaygroundEndpointRouteBuilderExtensions.cs | 1 + src/Ui.Playground/PlaygroundActionResult.cs | 1 + src/Ui.Playground/PlaygroundMiddleware.cs | 1 + tests/ApiApprovalTests/ApiApprovalTests.cs | 2 ++ .../GraphQL.Server.Ui.Playground.approved.txt | 4 ++++ .../GraphQL.Server.Ui.Playground.approved.txt | 3 +++ .../Samples.Authorization.Tests/EndToEndTests.cs | 4 ++-- .../EndToEndTests.cs | 6 +++--- tests/Samples.Basic.Tests/EndToEndTests.cs | 4 ++-- tests/Samples.Cors.Tests/EndToEndTests.cs | 4 ++-- .../EndToEndTests.cs | 4 ++-- .../EndToEndTests.cs | 8 ++++---- 27 files changed, 59 insertions(+), 43 deletions(-) diff --git a/samples/Samples.Authorization/Program.cs b/samples/Samples.Authorization/Program.cs index dc5ecf4c..dba41ef8 100644 --- a/samples/Samples.Authorization/Program.cs +++ b/samples/Samples.Authorization/Program.cs @@ -61,13 +61,13 @@ // configure the graphql endpoint at "/graphql" app.UseGraphQL("/graphql"); // configure Playground at "/ui/graphql" -app.UseGraphQLPlayground( +app.UseGraphQLGraphiQL( "/ui/graphql", - new GraphQL.Server.Ui.Playground.PlaygroundOptions + new GraphQL.Server.Ui.GraphiQL.GraphiQLOptions { GraphQLEndPoint = "/graphql", SubscriptionsEndPoint = "/graphql", - RequestCredentials = GraphQL.Server.Ui.Playground.RequestCredentials.Include, + RequestCredentials = GraphQL.Server.Ui.GraphiQL.RequestCredentials.Include, }); // ------------------------------------- diff --git a/samples/Samples.Authorization/Samples.Authorization.csproj b/samples/Samples.Authorization/Samples.Authorization.csproj index 5a09d21d..d58b9220 100644 --- a/samples/Samples.Authorization/Samples.Authorization.csproj +++ b/samples/Samples.Authorization/Samples.Authorization.csproj @@ -19,7 +19,7 @@ - + diff --git a/samples/Samples.AzureFunctions/GraphQL.cs b/samples/Samples.AzureFunctions/GraphQL.cs index 1b7ceac2..3037f52b 100644 --- a/samples/Samples.AzureFunctions/GraphQL.cs +++ b/samples/Samples.AzureFunctions/GraphQL.cs @@ -1,5 +1,5 @@ using GraphQL.Server.Transports.AspNetCore; -using GraphQL.Server.Ui.Playground; +using GraphQL.Server.Ui.GraphiQL; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Azure.WebJobs; @@ -21,12 +21,12 @@ public static IActionResult RunGraphQL( } [FunctionName("Playground")] - public static IActionResult RunPlayground( + public static IActionResult RunGraphiQL( [HttpTrigger(AuthorizationLevel.Anonymous, "get")] HttpRequest request, ILogger log) { - log.LogInformation("C# HTTP trigger function processed a request for the GraphQL Playground UI."); + log.LogInformation("C# HTTP trigger function processed a request for the GraphiQL UI."); - return new PlaygroundActionResult(opts => opts.GraphQLEndPoint = "/api/graphql"); // /api/graphql route will call RunGraphQL method + return new GraphiQLActionResult(opts => opts.GraphQLEndPoint = "/api/graphql"); // /api/graphql route will call RunGraphQL method } } diff --git a/samples/Samples.AzureFunctions/Samples.AzureFunctions.csproj b/samples/Samples.AzureFunctions/Samples.AzureFunctions.csproj index 039330c7..14a289d3 100644 --- a/samples/Samples.AzureFunctions/Samples.AzureFunctions.csproj +++ b/samples/Samples.AzureFunctions/Samples.AzureFunctions.csproj @@ -11,7 +11,6 @@ - diff --git a/samples/Samples.Basic/Program.cs b/samples/Samples.Basic/Program.cs index 86dca6cd..eeb8fe18 100644 --- a/samples/Samples.Basic/Program.cs +++ b/samples/Samples.Basic/Program.cs @@ -15,10 +15,10 @@ app.UseWebSockets(); // configure the graphql endpoint at "/graphql" app.UseGraphQL("/graphql"); -// configure Playground at "/" -app.UseGraphQLPlayground( +// configure GraphiQL at "/" +app.UseGraphQLGraphiQL( "/", - new GraphQL.Server.Ui.Playground.PlaygroundOptions + new GraphQL.Server.Ui.GraphiQL.GraphiQLOptions { GraphQLEndPoint = "/graphql", SubscriptionsEndPoint = "/graphql", diff --git a/samples/Samples.Basic/Samples.Basic.csproj b/samples/Samples.Basic/Samples.Basic.csproj index 0475f3df..974f10a9 100644 --- a/samples/Samples.Basic/Samples.Basic.csproj +++ b/samples/Samples.Basic/Samples.Basic.csproj @@ -10,7 +10,7 @@ - + diff --git a/samples/Samples.Complex/Startup.cs b/samples/Samples.Complex/Startup.cs index 57cfde5e..3b39ddd8 100644 --- a/samples/Samples.Complex/Startup.cs +++ b/samples/Samples.Complex/Startup.cs @@ -60,6 +60,7 @@ public void Configure(IApplicationBuilder app) ReadFormOnPost = true, }); +#pragma warning disable CS0618 // Type or member is obsolete app.UseGraphQLPlayground(options: new PlaygroundOptions { BetaUpdates = true, @@ -87,6 +88,7 @@ public void Configure(IApplicationBuilder app) ["MyHeader2"] = 42, }, }); +#pragma warning restore CS0618 // Type or member is obsolete app.UseGraphQLGraphiQL(options: new GraphiQLOptions { diff --git a/samples/Samples.Complex/StartupWithRouting.cs b/samples/Samples.Complex/StartupWithRouting.cs index 70039929..7d13b538 100644 --- a/samples/Samples.Complex/StartupWithRouting.cs +++ b/samples/Samples.Complex/StartupWithRouting.cs @@ -65,6 +65,7 @@ public void Configure(IApplicationBuilder app) ReadFormOnPost = true, }); +#pragma warning disable CS0618 // Type or member is obsolete endpoints.MapGraphQLPlayground(options: new PlaygroundOptions { BetaUpdates = true, @@ -92,6 +93,7 @@ public void Configure(IApplicationBuilder app) ["MyHeader2"] = 42, }, }); +#pragma warning restore CS0618 // Type or member is obsolete endpoints.MapGraphQLGraphiQL(options: new GraphiQLOptions { diff --git a/samples/Samples.Cors/Program.cs b/samples/Samples.Cors/Program.cs index 046d1620..514aede7 100644 --- a/samples/Samples.Cors/Program.cs +++ b/samples/Samples.Cors/Program.cs @@ -29,7 +29,7 @@ // configure the graphql endpoint at "/graphql" endpoints.MapGraphQL("/graphql") .RequireCors("MyCorsPolicy"); - // configure Playground at "/" - endpoints.MapGraphQLPlayground("/"); + // configure GraphiQL at "/" + endpoints.MapGraphQLGraphiQL("/"); }); await app.RunAsync(); diff --git a/samples/Samples.Cors/Samples.Cors.csproj b/samples/Samples.Cors/Samples.Cors.csproj index 0475f3df..974f10a9 100644 --- a/samples/Samples.Cors/Samples.Cors.csproj +++ b/samples/Samples.Cors/Samples.Cors.csproj @@ -10,7 +10,7 @@ - + diff --git a/samples/Samples.EndpointRouting/Program.cs b/samples/Samples.EndpointRouting/Program.cs index d452b5a9..5d8f8491 100644 --- a/samples/Samples.EndpointRouting/Program.cs +++ b/samples/Samples.EndpointRouting/Program.cs @@ -19,7 +19,7 @@ { // configure the graphql endpoint at "/graphql" endpoints.MapGraphQL("/graphql"); - // configure Playground at "/" - endpoints.MapGraphQLPlayground("/"); + // configure GraphiQL at "/" + endpoints.MapGraphQLGraphiQL("/"); }); await app.RunAsync(); diff --git a/samples/Samples.EndpointRouting/Samples.EndpointRouting.csproj b/samples/Samples.EndpointRouting/Samples.EndpointRouting.csproj index 0475f3df..974f10a9 100644 --- a/samples/Samples.EndpointRouting/Samples.EndpointRouting.csproj +++ b/samples/Samples.EndpointRouting/Samples.EndpointRouting.csproj @@ -10,7 +10,7 @@ - + diff --git a/samples/Samples.MultipleSchemas/Program.cs b/samples/Samples.MultipleSchemas/Program.cs index d61b8263..b10184ec 100644 --- a/samples/Samples.MultipleSchemas/Program.cs +++ b/samples/Samples.MultipleSchemas/Program.cs @@ -16,18 +16,18 @@ app.UseGraphQL("/cats/graphql"); // configure the graphql endpoint at "/dogs/graphql" app.UseGraphQL("/dogs/graphql"); -// configure Playground at "/cats/ui/playground" with relative link to api -app.UseGraphQLPlayground( - "/cats/ui/playground", - new GraphQL.Server.Ui.Playground.PlaygroundOptions +// configure GraphiQL at "/cats/ui/graphiql" with relative link to api +app.UseGraphQLGraphiQL( + "/cats/ui/graphiql", + new GraphQL.Server.Ui.GraphiQL.GraphiQLOptions { GraphQLEndPoint = "../graphql", SubscriptionsEndPoint = "../graphql", }); -// configure Playground at "/dogs/ui/playground" with relative link to api -app.UseGraphQLPlayground( - "/dogs/ui/playground", - new GraphQL.Server.Ui.Playground.PlaygroundOptions +// configure GraphiQL at "/dogs/ui/graphiql" with relative link to api +app.UseGraphQLGraphiQL( + "/dogs/ui/graphiql", + new GraphQL.Server.Ui.GraphiQL.GraphiQLOptions { GraphQLEndPoint = "../graphql", SubscriptionsEndPoint = "../graphql", diff --git a/samples/Samples.MultipleSchemas/Samples.MultipleSchemas.csproj b/samples/Samples.MultipleSchemas/Samples.MultipleSchemas.csproj index ae1560d7..55f49a4f 100644 --- a/samples/Samples.MultipleSchemas/Samples.MultipleSchemas.csproj +++ b/samples/Samples.MultipleSchemas/Samples.MultipleSchemas.csproj @@ -8,7 +8,7 @@ - + diff --git a/src/Ui.Playground/Extensions/PlaygroundApplicationBuilderExtensions.cs b/src/Ui.Playground/Extensions/PlaygroundApplicationBuilderExtensions.cs index ecbad25d..2c555ee7 100644 --- a/src/Ui.Playground/Extensions/PlaygroundApplicationBuilderExtensions.cs +++ b/src/Ui.Playground/Extensions/PlaygroundApplicationBuilderExtensions.cs @@ -13,6 +13,7 @@ public static class PlaygroundApplicationBuilderExtensions /// Options to customize . If not set, then the default values will be used. /// The path to the GraphQL Playground endpoint which defaults to '/ui/playground' /// The reference to provided instance. + [Obsolete("GraphQL Playground has not been updated since 2019. Please use GraphiQL instead.")] public static IApplicationBuilder UseGraphQLPlayground(this IApplicationBuilder app, string path = "/ui/playground", PlaygroundOptions? options = null) { return app.UseWhen( diff --git a/src/Ui.Playground/Extensions/PlaygroundEndpointRouteBuilderExtensions.cs b/src/Ui.Playground/Extensions/PlaygroundEndpointRouteBuilderExtensions.cs index d3823235..942c7083 100644 --- a/src/Ui.Playground/Extensions/PlaygroundEndpointRouteBuilderExtensions.cs +++ b/src/Ui.Playground/Extensions/PlaygroundEndpointRouteBuilderExtensions.cs @@ -17,6 +17,7 @@ public static class PlaygroundEndpointRouteBuilderExtensions /// Options to customize . If not set, then the default values will be used. /// The route pattern. /// The received as parameter + [Obsolete("GraphQL Playground has not been updated since 2019. Please use GraphiQL instead.")] public static PlaygroundEndpointConventionBuilder MapGraphQLPlayground(this IEndpointRouteBuilder endpoints, string pattern = "ui/playground", PlaygroundOptions? options = null) { if (endpoints == null) diff --git a/src/Ui.Playground/PlaygroundActionResult.cs b/src/Ui.Playground/PlaygroundActionResult.cs index 76e70b76..5dfe01d8 100644 --- a/src/Ui.Playground/PlaygroundActionResult.cs +++ b/src/Ui.Playground/PlaygroundActionResult.cs @@ -5,6 +5,7 @@ namespace GraphQL.Server.Ui.Playground; /// /// An action result that returns a Playground user interface. /// +[Obsolete("GraphQL Playground has not been updated since 2019. Please use GraphiQL instead.")] public class PlaygroundActionResult : IActionResult { private readonly PlaygroundMiddleware _middleware; diff --git a/src/Ui.Playground/PlaygroundMiddleware.cs b/src/Ui.Playground/PlaygroundMiddleware.cs index ab0b213e..99ae1a25 100644 --- a/src/Ui.Playground/PlaygroundMiddleware.cs +++ b/src/Ui.Playground/PlaygroundMiddleware.cs @@ -7,6 +7,7 @@ namespace GraphQL.Server.Ui.Playground; /// /// A middleware for GraphQL Playground UI. /// +[Obsolete("GraphQL Playground has not been updated since 2019. Please use GraphiQL instead.")] public class PlaygroundMiddleware { private readonly PlaygroundOptions _options; diff --git a/tests/ApiApprovalTests/ApiApprovalTests.cs b/tests/ApiApprovalTests/ApiApprovalTests.cs index 08978814..78d123c3 100644 --- a/tests/ApiApprovalTests/ApiApprovalTests.cs +++ b/tests/ApiApprovalTests/ApiApprovalTests.cs @@ -11,7 +11,9 @@ public class ApiApprovalTests [Theory] [InlineData(typeof(Server.Ui.Altair.AltairMiddleware))] [InlineData(typeof(Server.Ui.GraphiQL.GraphiQLMiddleware))] +#pragma warning disable CS0618 // Type or member is obsolete [InlineData(typeof(Server.Ui.Playground.PlaygroundMiddleware))] +#pragma warning restore CS0618 // Type or member is obsolete [InlineData(typeof(Server.Ui.Voyager.VoyagerMiddleware))] [InlineData(typeof(Server.Transports.AspNetCore.GraphQLHttpMiddleware<>))] public void public_api_should_not_change_unintentionally(Type type) diff --git a/tests/ApiApprovalTests/net80+netcoreapp31/GraphQL.Server.Ui.Playground.approved.txt b/tests/ApiApprovalTests/net80+netcoreapp31/GraphQL.Server.Ui.Playground.approved.txt index 9d0f4898..d0b0df8f 100644 --- a/tests/ApiApprovalTests/net80+netcoreapp31/GraphQL.Server.Ui.Playground.approved.txt +++ b/tests/ApiApprovalTests/net80+netcoreapp31/GraphQL.Server.Ui.Playground.approved.txt @@ -11,12 +11,14 @@ namespace GraphQL.Server.Ui.Playground Dark = 0, Light = 1, } + [System.Obsolete("GraphQL Playground has not been updated since 2019. Please use GraphiQL instead.")] public class PlaygroundActionResult : Microsoft.AspNetCore.Mvc.IActionResult { public PlaygroundActionResult(GraphQL.Server.Ui.Playground.PlaygroundOptions options) { } public PlaygroundActionResult(System.Action? configure = null) { } public System.Threading.Tasks.Task ExecuteResultAsync(Microsoft.AspNetCore.Mvc.ActionContext context) { } } + [System.Obsolete("GraphQL Playground has not been updated since 2019. Please use GraphiQL instead.")] public class PlaygroundMiddleware { public PlaygroundMiddleware(Microsoft.AspNetCore.Http.RequestDelegate next, GraphQL.Server.Ui.Playground.PlaygroundOptions options) { } @@ -59,6 +61,7 @@ namespace Microsoft.AspNetCore.Builder { public static class PlaygroundApplicationBuilderExtensions { + [System.Obsolete("GraphQL Playground has not been updated since 2019. Please use GraphiQL instead.")] public static Microsoft.AspNetCore.Builder.IApplicationBuilder UseGraphQLPlayground(this Microsoft.AspNetCore.Builder.IApplicationBuilder app, string path = "/ui/playground", GraphQL.Server.Ui.Playground.PlaygroundOptions? options = null) { } } public class PlaygroundEndpointConventionBuilder : Microsoft.AspNetCore.Builder.IEndpointConventionBuilder @@ -67,6 +70,7 @@ namespace Microsoft.AspNetCore.Builder } public static class PlaygroundEndpointRouteBuilderExtensions { + [System.Obsolete("GraphQL Playground has not been updated since 2019. Please use GraphiQL instead.")] public static Microsoft.AspNetCore.Builder.PlaygroundEndpointConventionBuilder MapGraphQLPlayground(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string pattern = "ui/playground", GraphQL.Server.Ui.Playground.PlaygroundOptions? options = null) { } } } \ No newline at end of file diff --git a/tests/ApiApprovalTests/netstandard20/GraphQL.Server.Ui.Playground.approved.txt b/tests/ApiApprovalTests/netstandard20/GraphQL.Server.Ui.Playground.approved.txt index fcb09377..4ebc768a 100644 --- a/tests/ApiApprovalTests/netstandard20/GraphQL.Server.Ui.Playground.approved.txt +++ b/tests/ApiApprovalTests/netstandard20/GraphQL.Server.Ui.Playground.approved.txt @@ -11,12 +11,14 @@ namespace GraphQL.Server.Ui.Playground Dark = 0, Light = 1, } + [System.Obsolete("GraphQL Playground has not been updated since 2019. Please use GraphiQL instead.")] public class PlaygroundActionResult : Microsoft.AspNetCore.Mvc.IActionResult { public PlaygroundActionResult(GraphQL.Server.Ui.Playground.PlaygroundOptions options) { } public PlaygroundActionResult(System.Action? configure = null) { } public System.Threading.Tasks.Task ExecuteResultAsync(Microsoft.AspNetCore.Mvc.ActionContext context) { } } + [System.Obsolete("GraphQL Playground has not been updated since 2019. Please use GraphiQL instead.")] public class PlaygroundMiddleware { public PlaygroundMiddleware(Microsoft.AspNetCore.Http.RequestDelegate next, GraphQL.Server.Ui.Playground.PlaygroundOptions options) { } @@ -59,6 +61,7 @@ namespace Microsoft.AspNetCore.Builder { public static class PlaygroundApplicationBuilderExtensions { + [System.Obsolete("GraphQL Playground has not been updated since 2019. Please use GraphiQL instead.")] public static Microsoft.AspNetCore.Builder.IApplicationBuilder UseGraphQLPlayground(this Microsoft.AspNetCore.Builder.IApplicationBuilder app, string path = "/ui/playground", GraphQL.Server.Ui.Playground.PlaygroundOptions? options = null) { } } } \ No newline at end of file diff --git a/tests/Samples.Authorization.Tests/EndToEndTests.cs b/tests/Samples.Authorization.Tests/EndToEndTests.cs index ab1daa62..6b5a7c07 100644 --- a/tests/Samples.Authorization.Tests/EndToEndTests.cs +++ b/tests/Samples.Authorization.Tests/EndToEndTests.cs @@ -12,8 +12,8 @@ public class EndToEndTests private const string ACCESS_DENIED_RESPONSE = @"{""errors"":" + ACCESS_DENIED_ERRORS + "}"; [Fact] - public Task Playground() - => new ServerTests().VerifyPlaygroundAsync("/ui/graphql"); + public Task GraphiQL() + => new ServerTests().VerifyGraphiQLAsync("/ui/graphql"); [Fact] public Task GraphQLGet_Success() diff --git a/tests/Samples.AzureFunctions.Tests/EndToEndTests.cs b/tests/Samples.AzureFunctions.Tests/EndToEndTests.cs index dbeab21c..09e94e46 100644 --- a/tests/Samples.AzureFunctions.Tests/EndToEndTests.cs +++ b/tests/Samples.AzureFunctions.Tests/EndToEndTests.cs @@ -41,17 +41,17 @@ public async Task GraphQLPost() } [Fact] - public async Task Playground() + public async Task GraphiQL() { var (statusCode, contentType, body) = await ExecuteRequest(request => { request.Method = "GET"; - }, GraphQL.RunPlayground); + }, GraphQL.RunGraphiQL); statusCode.ShouldBe(200); contentType.ShouldBe("text/html"); body.ShouldContain("", Case.Insensitive); - body.ShouldContain("playground", Case.Insensitive); + body.ShouldContain("GraphiQL", Case.Insensitive); } private async Task<(int statusCode, string? contentType, string body)> ExecuteRequest(Action configureRequest, Func func) diff --git a/tests/Samples.Basic.Tests/EndToEndTests.cs b/tests/Samples.Basic.Tests/EndToEndTests.cs index cb842417..4942e31d 100644 --- a/tests/Samples.Basic.Tests/EndToEndTests.cs +++ b/tests/Samples.Basic.Tests/EndToEndTests.cs @@ -5,8 +5,8 @@ namespace Samples.Basic.Tests; public class EndToEndTests { [Fact] - public Task Playground() - => new ServerTests().VerifyPlaygroundAsync(); + public Task GraphiQL() + => new ServerTests().VerifyGraphiQLAsync(); [Fact] public Task GraphQLGet() diff --git a/tests/Samples.Cors.Tests/EndToEndTests.cs b/tests/Samples.Cors.Tests/EndToEndTests.cs index a870e4f6..e987367d 100644 --- a/tests/Samples.Cors.Tests/EndToEndTests.cs +++ b/tests/Samples.Cors.Tests/EndToEndTests.cs @@ -5,8 +5,8 @@ namespace Samples.Cors.Tests; public class EndToEndTests { [Fact] - public Task Playground() - => new ServerTests().VerifyPlaygroundAsync(); + public Task GraphiQL() + => new ServerTests().VerifyGraphiQLAsync(); [Fact] public Task GraphQLGet() diff --git a/tests/Samples.EndpointRouting.Tests/EndToEndTests.cs b/tests/Samples.EndpointRouting.Tests/EndToEndTests.cs index 5a3af4b7..17bc1900 100644 --- a/tests/Samples.EndpointRouting.Tests/EndToEndTests.cs +++ b/tests/Samples.EndpointRouting.Tests/EndToEndTests.cs @@ -5,8 +5,8 @@ namespace Samples.EndpointRouting.Tests; public class EndToEndTests { [Fact] - public Task Playground() - => new ServerTests().VerifyPlaygroundAsync(); + public Task GraphiQL() + => new ServerTests().VerifyGraphiQLAsync(); [Fact] public Task GraphQLGet() diff --git a/tests/Samples.MultipleSchemas.Tests/EndToEndTests.cs b/tests/Samples.MultipleSchemas.Tests/EndToEndTests.cs index af5de1c7..b6058135 100644 --- a/tests/Samples.MultipleSchemas.Tests/EndToEndTests.cs +++ b/tests/Samples.MultipleSchemas.Tests/EndToEndTests.cs @@ -10,12 +10,12 @@ public class EndToEndTests private const string DOG_RESPONSE = """{"data":{"dog":{"name":"Shadow"}}}"""; [Fact] - public Task Cats_Playground() - => new ServerTests().VerifyPlaygroundAsync("/cats/ui/playground"); + public Task Cats_GraphiQL() + => new ServerTests().VerifyGraphiQLAsync("/cats/ui/graphiql"); [Fact] - public Task Dogs_Playground() - => new ServerTests().VerifyPlaygroundAsync("/dogs/ui/playground"); + public Task Dogs_GraphiQL() + => new ServerTests().VerifyGraphiQLAsync("/dogs/ui/graphiql"); [Fact] public Task Cats_GraphQLGet() From 24d0f9dcbd6b0a3a3c08b080a4e4336edba74d2e Mon Sep 17 00:00:00 2001 From: Shane32 Date: Mon, 18 Nov 2024 13:35:48 -0500 Subject: [PATCH 2/3] Update --- samples/Samples.AzureFunctions/GraphQL.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/Samples.AzureFunctions/GraphQL.cs b/samples/Samples.AzureFunctions/GraphQL.cs index 3037f52b..5fed19e8 100644 --- a/samples/Samples.AzureFunctions/GraphQL.cs +++ b/samples/Samples.AzureFunctions/GraphQL.cs @@ -20,7 +20,7 @@ public static IActionResult RunGraphQL( return new GraphQLExecutionActionResult(); } - [FunctionName("Playground")] + [FunctionName("GraphiQL")] public static IActionResult RunGraphiQL( [HttpTrigger(AuthorizationLevel.Anonymous, "get")] HttpRequest request, ILogger log) From 38b92038d4fff0bc73a49d4b3bdc6ad15763ef52 Mon Sep 17 00:00:00 2001 From: Shane32 Date: Mon, 18 Nov 2024 13:42:58 -0500 Subject: [PATCH 3/3] update readme --- README.md | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index e484444b..5aefc067 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Provides the following packages: | 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 | | 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 | | 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 | -| 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 | +| 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) | | 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 | | 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 | @@ -81,7 +81,7 @@ Then update your `Program.cs` or `Startup.cs` to configure GraphQL, registering and the serialization engine as a minimum. Configure WebSockets and GraphQL in the HTTP pipeline by calling `UseWebSockets` and `UseGraphQL` at the appropriate point. Finally, you may also include some UI middleware for easy testing of your GraphQL endpoint -by calling `UseGraphQLVoyager` or a similar method at the appropriate point. +by calling `UseGraphQLGraphiQL` or a similar method at the appropriate point. Below is a complete sample of a .NET 6 console app that hosts a GraphQL endpoint at `http://localhost:5000/graphql`: @@ -118,9 +118,9 @@ var app = builder.Build(); app.UseDeveloperExceptionPage(); app.UseWebSockets(); app.UseGraphQL("/graphql"); // url to host GraphQL endpoint -app.UseGraphQLPlayground( - "/", // url to host Playground at - new GraphQL.Server.Ui.Playground.PlaygroundOptions +app.UseGraphQLGraphiQL( + "/", // url to host GraphiQL at + new GraphQL.Server.Ui.GraphiQL.GraphiQLOptions { GraphQLEndPoint = "/graphql", // url of GraphQL endpoint SubscriptionsEndPoint = "/graphql", // url of GraphQL endpoint @@ -297,11 +297,11 @@ public static IActionResult RunGraphQL( 4. Optionally, add a UI package to the project and configure it: ```csharp -[FunctionName("Playground")] -public static IActionResult RunGraphQL( +[FunctionName("GraphiQL")] +public static IActionResult RunGraphiQL( [HttpTrigger(AuthorizationLevel.Anonymous, "get"] HttpRequest req) { - return new PlaygroundActionResult(opts => opts.GraphQLEndPoint = "/api/graphql"); + return new GraphiQLActionResult(opts => opts.GraphQLEndPoint = "/api/graphql"); } ``` @@ -534,20 +534,21 @@ field authorization will perform role and policy checks against the same authent ### UI configuration There are four UI middleware projects included; Altair, GraphiQL, Playground and Voyager. +Playground has not been updated since 2019 and is deprecated in favor of GraphiQL. See review the following methods for configuration options within each of the 4 respective NuGet packages: ```csharp app.UseGraphQLAltair(); app.UseGraphQLGraphiQL(); -app.UseGraphQLPlayground(); +app.UseGraphQLPlayground(); // deprecated app.UseGraphQLVoyager(); // or endpoints.MapGraphQLAltair(); endpoints.MapGraphQLGraphiQL(); -endpoints.MapGraphQLPlayground(); +endpoints.MapGraphQLPlayground(); // deprecated endpoints.MapGraphQLVoyager(); ```