Skip to content

Commit

Permalink
Mark GraphQL Playground as obsolete
Browse files Browse the repository at this point in the history
  • Loading branch information
Shane32 committed Nov 18, 2024
1 parent 5501fe8 commit f6572cc
Show file tree
Hide file tree
Showing 27 changed files with 59 additions and 43 deletions.
6 changes: 3 additions & 3 deletions samples/Samples.Authorization/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
// -------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion samples/Samples.Authorization/Samples.Authorization.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<ItemGroup>
<ProjectReference Include="..\..\src\Transports.AspNetCore\Transports.AspNetCore.csproj" />
<ProjectReference Include="..\..\src\Ui.Playground\Ui.Playground.csproj" />
<ProjectReference Include="..\..\src\Ui.GraphiQL\Ui.GraphiQL.csproj" />
</ItemGroup>

</Project>
8 changes: 4 additions & 4 deletions samples/Samples.AzureFunctions/GraphQL.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
<ItemGroup>
<ProjectReference Include="..\..\src\Transports.AspNetCore\Transports.AspNetCore.csproj" />
<ProjectReference Include="..\..\src\Ui.GraphiQL\Ui.GraphiQL.csproj" />
<ProjectReference Include="..\..\src\Ui.Playground\Ui.Playground.csproj" />
<ProjectReference Include="..\Samples.Schemas.Chat\Samples.Schemas.Chat.csproj" />
</ItemGroup>
<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions samples/Samples.Basic/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion samples/Samples.Basic/Samples.Basic.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<ItemGroup>
<ProjectReference Include="..\..\src\Transports.AspNetCore\Transports.AspNetCore.csproj" />
<ProjectReference Include="..\Samples.Schemas.Chat\Samples.Schemas.Chat.csproj" />
<ProjectReference Include="..\..\src\Ui.Playground\Ui.Playground.csproj" />
<ProjectReference Include="..\..\src\Ui.GraphiQL\Ui.GraphiQL.csproj" />
</ItemGroup>

</Project>
2 changes: 2 additions & 0 deletions samples/Samples.Complex/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
{
Expand Down
2 changes: 2 additions & 0 deletions samples/Samples.Complex/StartupWithRouting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
{
Expand Down
4 changes: 2 additions & 2 deletions samples/Samples.Cors/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
2 changes: 1 addition & 1 deletion samples/Samples.Cors/Samples.Cors.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<ItemGroup>
<ProjectReference Include="..\..\src\Transports.AspNetCore\Transports.AspNetCore.csproj" />
<ProjectReference Include="..\Samples.Schemas.Chat\Samples.Schemas.Chat.csproj" />
<ProjectReference Include="..\..\src\Ui.Playground\Ui.Playground.csproj" />
<ProjectReference Include="..\..\src\Ui.GraphiQL\Ui.GraphiQL.csproj" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions samples/Samples.EndpointRouting/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<ItemGroup>
<ProjectReference Include="..\..\src\Transports.AspNetCore\Transports.AspNetCore.csproj" />
<ProjectReference Include="..\Samples.Schemas.Chat\Samples.Schemas.Chat.csproj" />
<ProjectReference Include="..\..\src\Ui.Playground\Ui.Playground.csproj" />
<ProjectReference Include="..\..\src\Ui.GraphiQL\Ui.GraphiQL.csproj" />
</ItemGroup>

</Project>
16 changes: 8 additions & 8 deletions samples/Samples.MultipleSchemas/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@
app.UseGraphQL<MultipleSchema.Cats.CatsSchema>("/cats/graphql");
// configure the graphql endpoint at "/dogs/graphql"
app.UseGraphQL<MultipleSchema.Dogs.DogsSchema>("/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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<ItemGroup>
<ProjectReference Include="..\..\src\Transports.AspNetCore\Transports.AspNetCore.csproj" />
<ProjectReference Include="..\..\src\Ui.Playground\Ui.Playground.csproj" />
<ProjectReference Include="..\..\src\Ui.GraphiQL\Ui.GraphiQL.csproj" />
<PackageReference Include="System.Reactive" Version="6.0.0" />
<Using Include="GraphQL" />
<Using Include="GraphQL.Types" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public static class PlaygroundApplicationBuilderExtensions
/// <param name="options"> Options to customize <see cref="PlaygroundMiddleware"/>. If not set, then the default values will be used. </param>
/// <param name="path">The path to the GraphQL Playground endpoint which defaults to '/ui/playground'</param>
/// <returns> The reference to provided <paramref name="app"/> instance. </returns>
[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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public static class PlaygroundEndpointRouteBuilderExtensions
/// <param name="options">Options to customize <see cref="PlaygroundMiddleware"/>. If not set, then the default values will be used.</param>
/// <param name="pattern">The route pattern.</param>
/// <returns>The <see cref="IApplicationBuilder"/> received as parameter</returns>
[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)
Expand Down
1 change: 1 addition & 0 deletions src/Ui.Playground/PlaygroundActionResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace GraphQL.Server.Ui.Playground;
/// <summary>
/// An action result that returns a Playground user interface.
/// </summary>
[Obsolete("GraphQL Playground has not been updated since 2019. Please use GraphiQL instead.")]
public class PlaygroundActionResult : IActionResult
{
private readonly PlaygroundMiddleware _middleware;
Expand Down
1 change: 1 addition & 0 deletions src/Ui.Playground/PlaygroundMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace GraphQL.Server.Ui.Playground;
/// <summary>
/// A middleware for GraphQL Playground UI.
/// </summary>
[Obsolete("GraphQL Playground has not been updated since 2019. Please use GraphiQL instead.")]
public class PlaygroundMiddleware
{
private readonly PlaygroundOptions _options;
Expand Down
2 changes: 2 additions & 0 deletions tests/ApiApprovalTests/ApiApprovalTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<GraphQL.Server.Ui.Playground.PlaygroundOptions>? 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) { }
Expand Down Expand Up @@ -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
Expand All @@ -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) { }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<GraphQL.Server.Ui.Playground.PlaygroundOptions>? 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) { }
Expand Down Expand Up @@ -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) { }
}
}
4 changes: 2 additions & 2 deletions tests/Samples.Authorization.Tests/EndToEndTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ public class EndToEndTests
private const string ACCESS_DENIED_RESPONSE = @"{""errors"":" + ACCESS_DENIED_ERRORS + "}";

[Fact]
public Task Playground()
=> new ServerTests<Program>().VerifyPlaygroundAsync("/ui/graphql");
public Task GraphiQL()
=> new ServerTests<Program>().VerifyGraphiQLAsync("/ui/graphql");

[Fact]
public Task GraphQLGet_Success()
Expand Down
6 changes: 3 additions & 3 deletions tests/Samples.AzureFunctions.Tests/EndToEndTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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("<!DOCTYPE html>", Case.Insensitive);
body.ShouldContain("playground", Case.Insensitive);
body.ShouldContain("GraphiQL", Case.Insensitive);
}

private async Task<(int statusCode, string? contentType, string body)> ExecuteRequest(Action<HttpRequest> configureRequest, Func<HttpRequest, ILogger, IActionResult> func)
Expand Down
4 changes: 2 additions & 2 deletions tests/Samples.Basic.Tests/EndToEndTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ namespace Samples.Basic.Tests;
public class EndToEndTests
{
[Fact]
public Task Playground()
=> new ServerTests<Program>().VerifyPlaygroundAsync();
public Task GraphiQL()
=> new ServerTests<Program>().VerifyGraphiQLAsync();

[Fact]
public Task GraphQLGet()
Expand Down
4 changes: 2 additions & 2 deletions tests/Samples.Cors.Tests/EndToEndTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ namespace Samples.Cors.Tests;
public class EndToEndTests
{
[Fact]
public Task Playground()
=> new ServerTests<Program>().VerifyPlaygroundAsync();
public Task GraphiQL()
=> new ServerTests<Program>().VerifyGraphiQLAsync();

[Fact]
public Task GraphQLGet()
Expand Down
4 changes: 2 additions & 2 deletions tests/Samples.EndpointRouting.Tests/EndToEndTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ namespace Samples.EndpointRouting.Tests;
public class EndToEndTests
{
[Fact]
public Task Playground()
=> new ServerTests<Program>().VerifyPlaygroundAsync();
public Task GraphiQL()
=> new ServerTests<Program>().VerifyGraphiQLAsync();

[Fact]
public Task GraphQLGet()
Expand Down
8 changes: 4 additions & 4 deletions tests/Samples.MultipleSchemas.Tests/EndToEndTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ public class EndToEndTests
private const string DOG_RESPONSE = """{"data":{"dog":{"name":"Shadow"}}}""";

[Fact]
public Task Cats_Playground()
=> new ServerTests<Program>().VerifyPlaygroundAsync("/cats/ui/playground");
public Task Cats_GraphiQL()
=> new ServerTests<Program>().VerifyGraphiQLAsync("/cats/ui/graphiql");

[Fact]
public Task Dogs_Playground()
=> new ServerTests<Program>().VerifyPlaygroundAsync("/dogs/ui/playground");
public Task Dogs_GraphiQL()
=> new ServerTests<Program>().VerifyGraphiQLAsync("/dogs/ui/graphiql");

[Fact]
public Task Cats_GraphQLGet()
Expand Down

0 comments on commit f6572cc

Please sign in to comment.