Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>

<PropertyGroup>
<VersionPrefix>7.1.0-preview</VersionPrefix>
<VersionPrefix>8.0.0-preview</VersionPrefix>
<LangVersion>12.0</LangVersion>
<Copyright>Shane Krueger</Copyright>
<Authors>Shane Krueger</Authors>
Expand All @@ -20,7 +20,7 @@
<ImplicitUsings>true</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<GraphQLVersion>8.2.1</GraphQLVersion>
<GraphQLVersion>8.8.0</GraphQLVersion>
<NoWarn>$(NoWarn);IDE0056;IDE0057;NU1902;NU1903</NoWarn>
<NuGetAuditMode>direct</NuGetAuditMode>
</PropertyGroup>
Expand Down
13 changes: 10 additions & 3 deletions src/GraphQL.AspNetCore3/GraphQL.AspNetCore3.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netcoreapp2.1;netcoreapp3.1;net5.0</TargetFrameworks>
Expand All @@ -17,13 +17,20 @@
<PackageReference Include="GraphQL.SystemTextJson" Version="$(GraphQLVersion)" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0' OR '$(TargetFramework)' == 'netcoreapp2.1'">
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="Microsoft.AspNetCore" Version="2.3.0" />
<PackageReference Include="Microsoft.AspNetCore.Authorization" Version="2.3.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.3.0" />
<PackageReference Include="Microsoft.AspNetCore.WebSockets" Version="2.3.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1'">
<PackageReference Include="Microsoft.AspNetCore" Version="2.1.7" />
<PackageReference Include="Microsoft.AspNetCore.Authorization" Version="2.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.1.3" />
<PackageReference Include="Microsoft.AspNetCore.WebSockets" Version="2.1.7" />
</ItemGroup>

<ItemGroup>
<Using Include="GraphQL" />
<Using Include="GraphQL.AspNetCore3.Errors" />
Expand Down
11 changes: 6 additions & 5 deletions src/GraphQL.AspNetCore3/GraphQLHttpMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ public GraphQLHttpMiddleware(
IDocumentExecuter<TSchema> documentExecuter,
IServiceScopeFactory serviceScopeFactory,
GraphQLHttpMiddlewareOptions options,
#pragma warning disable CS0618 // Type or member is obsolete
IHostApplicationLifetime hostApplicationLifetime)
#pragma warning restore CS0618 // Type or member is obsolete
: base(next, serializer, documentExecuter, serviceScopeFactory, options, hostApplicationLifetime)
{
}
Expand Down Expand Up @@ -64,7 +66,9 @@ public class GraphQLHttpMiddleware : IUserContextBuilder
private readonly IEnumerable<IValidationRule> _postCachedDocumentValidationRules;
private readonly IGraphQLTextSerializer _serializer;
private readonly RequestDelegate _next;
#pragma warning disable CS0618 // Type or member is obsolete
private readonly IHostApplicationLifetime _hostApplicationLifetime;
#pragma warning restore CS0618 // Type or member is obsolete
private readonly GraphQLHttpMiddlewareOptions _options;

private const string QUERY_KEY = "query";
Expand All @@ -90,7 +94,9 @@ public GraphQLHttpMiddleware(
IDocumentExecuter documentExecuter,
IServiceScopeFactory serviceScopeFactory,
GraphQLHttpMiddlewareOptions options,
#pragma warning disable CS0618 // Type or member is obsolete
IHostApplicationLifetime hostApplicationLifetime)
#pragma warning restore CS0618 // Type or member is obsolete
{
_next = next ?? throw new ArgumentNullException(nameof(next));
_serializer = serializer ?? throw new ArgumentNullException(nameof(serializer));
Expand Down Expand Up @@ -896,11 +902,6 @@ protected virtual Task WriteJsonResponseAsync<TResult>(HttpContext context, Http
return _serializer.WriteAsync(context.Response.Body, result, context.RequestAborted);
}

private static readonly IEnumerable<string> _supportedSubProtocols = new List<string>(new[] {
WebSockets.GraphQLWs.SubscriptionServer.SubProtocol,
WebSockets.SubscriptionsTransportWs.SubscriptionServer.SubProtocol,
}).AsReadOnly();

/// <summary>
/// Gets a list of WebSocket sub-protocols supported.
/// </summary>
Expand Down
13 changes: 12 additions & 1 deletion src/Samples/Net48Sample/Net48Sample.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' != 'true'">
<TargetFramework>netcoreapp2.1</TargetFramework>
Expand All @@ -12,6 +12,17 @@

<ItemGroup>
<PackageReference Include="GraphQL.NewtonsoftJson" Version="$(GraphQLVersion)" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net48'">
<PackageReference Include="Microsoft.AspNetCore" Version="2.3.0" />
<PackageReference Include="Microsoft.AspNetCore.CookiePolicy" Version="2.3.0" />
<PackageReference Include="Microsoft.AspNetCore.HttpsPolicy" Version="2.3.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.3.0" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.3.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1'">
<PackageReference Include="Microsoft.AspNetCore" Version="2.1.7" />
<PackageReference Include="Microsoft.AspNetCore.CookiePolicy" Version="2.1.14" />
<PackageReference Include="Microsoft.AspNetCore.HttpsPolicy" Version="2.1.1" />
Expand Down
2 changes: 2 additions & 0 deletions src/Tests/Middleware/AuthorizationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,9 @@ public async Task WebSocket_NotAuthorized()

private class MyMiddleware : GraphQLHttpMiddleware<ISchema>
{
#pragma warning disable CS0618 // Type or member is obsolete
public MyMiddleware(RequestDelegate next, IGraphQLTextSerializer serializer, IDocumentExecuter<ISchema> documentExecuter, IServiceScopeFactory serviceScopeFactory, IHostApplicationLifetime hostApplicationLifetime)
#pragma warning restore CS0618 // Type or member is obsolete
: base(next, serializer, documentExecuter, serviceScopeFactory, new(), hostApplicationLifetime)
{
}
Expand Down
2 changes: 2 additions & 0 deletions src/Tests/Middleware/FileUploadTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ public class MyMiddleware : GraphQLHttpMiddleware<MySchema>
{
private readonly IGraphQLTextSerializer _serializer;

#pragma warning disable CS0618 // Type or member is obsolete
public MyMiddleware(RequestDelegate next, IGraphQLTextSerializer serializer, IDocumentExecuter<MySchema> documentExecuter, IServiceScopeFactory serviceScopeFactory, GraphQLHttpMiddlewareOptions options, IHostApplicationLifetime hostApplicationLifetime)
#pragma warning restore CS0618 // Type or member is obsolete
: base(next, serializer, documentExecuter, serviceScopeFactory, options, hostApplicationLifetime)
{
_serializer = serializer;
Expand Down
8 changes: 8 additions & 0 deletions src/Tests/Middleware/MiscTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ public void Constructors()
var options = new GraphQLHttpMiddlewareOptions();
var executer = Mock.Of<IDocumentExecuter<ISchema>>();
var scopeFactory = Mock.Of<IServiceScopeFactory>();
#pragma warning disable CS0618 // Type or member is obsolete
var appLifetime = Mock.Of<IHostApplicationLifetime>();
#pragma warning restore CS0618 // Type or member is obsolete
Should.Throw<ArgumentNullException>(() => new GraphQLHttpMiddleware<ISchema>(null!, serializer, executer, scopeFactory, options, appLifetime));
Should.Throw<ArgumentNullException>(() => new GraphQLHttpMiddleware<ISchema>(next, null!, executer, scopeFactory, options, appLifetime));
Should.Throw<ArgumentNullException>(() => new GraphQLHttpMiddleware<ISchema>(next, serializer, null!, scopeFactory, options, appLifetime));
Expand Down Expand Up @@ -46,7 +48,9 @@ public async Task SchemaSpecificBuilders()
Mock.Of<IDocumentExecuter<Schema>>(MockBehavior.Strict),
Mock.Of<IServiceScopeFactory>(MockBehavior.Strict),
new GraphQLHttpMiddlewareOptions(),
#pragma warning disable CS0618 // Type or member is obsolete
Mock.Of<IHostApplicationLifetime>(MockBehavior.Strict));
#pragma warning restore CS0618 // Type or member is obsolete
var builder = new Mock<IUserContextBuilder<Schema>>(MockBehavior.Strict);
var d = new Dictionary<string, object?> { { "test", "test" } };
builder.Setup(x => x.BuildUserContextAsync(It.IsAny<HttpContext>(), It.IsAny<object?>())).ReturnsAsync(d);
Expand All @@ -60,7 +64,9 @@ public async Task SchemaSpecificBuilders()
private class MyMiddleware<TSchema> : GraphQLHttpMiddleware<TSchema>
where TSchema : ISchema
{
#pragma warning disable CS0618 // Type or member is obsolete
public MyMiddleware(RequestDelegate next, IGraphQLTextSerializer serializer, IDocumentExecuter<TSchema> executer, IServiceScopeFactory scopeFactory, GraphQLHttpMiddlewareOptions options, IHostApplicationLifetime hostApplicationLifetime)
#pragma warning restore CS0618 // Type or member is obsolete
: base(next, serializer, executer, scopeFactory, options, hostApplicationLifetime)
{
}
Expand Down Expand Up @@ -115,11 +121,13 @@ public void WebSocketSubProtocolNotSupportedError_Message()

public class MyMiddleware : GraphQLHttpMiddleware<ISchema>
{
#pragma warning disable CS0618 // Type or member is obsolete
public MyMiddleware() : this(Mock.Of<IHostApplicationLifetime>(MockBehavior.Strict))
{
}

public MyMiddleware(IHostApplicationLifetime hostApplicationLifetime) : base(
#pragma warning restore CS0618 // Type or member is obsolete
_ => throw new NotSupportedException(),
Mock.Of<IGraphQLTextSerializer>(MockBehavior.Strict),
Mock.Of<IDocumentExecuter<ISchema>>(MockBehavior.Strict),
Expand Down
4 changes: 4 additions & 0 deletions src/Tests/Middleware/WebSocketTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ private class TestMiddleware : GraphQLHttpMiddleware
{
private readonly string[] _subprotocols;

#pragma warning disable CS0618 // Type or member is obsolete
public TestMiddleware(RequestDelegate next, string[] subprotocols) : base(next, new GraphQLSerializer(), Mock.Of<IDocumentExecuter>(MockBehavior.Strict), Mock.Of<IServiceScopeFactory>(MockBehavior.Strict), new GraphQLHttpMiddlewareOptions(), Mock.Of<IHostApplicationLifetime>(MockBehavior.Strict))
#pragma warning restore CS0618 // Type or member is obsolete
{
_subprotocols = subprotocols;
}
Expand Down Expand Up @@ -161,12 +163,14 @@ private class TestMiddleware2 : GraphQLHttpMiddleware
{
private readonly Tuple<CancellationTokenSource, TaskCompletionSource<bool>> _tuple;

#pragma warning disable CS0618 // Type or member is obsolete
public TestMiddleware2(RequestDelegate next, IGraphQLTextSerializer serializer, IDocumentExecuter<ISchema> documentExecuter, IServiceScopeFactory serviceScopeFactory, GraphQLHttpMiddlewareOptions options, Tuple<CancellationTokenSource, TaskCompletionSource<bool>> tuple)
: this(next, serializer, documentExecuter, serviceScopeFactory, options, Mock.Of<IHostApplicationLifetime>(MockBehavior.Strict), tuple)
{
}

private TestMiddleware2(RequestDelegate next, IGraphQLTextSerializer serializer, IDocumentExecuter<ISchema> documentExecuter, IServiceScopeFactory serviceScopeFactory, GraphQLHttpMiddlewareOptions options, IHostApplicationLifetime hostApplicationLifetime, Tuple<CancellationTokenSource, TaskCompletionSource<bool>> tuple)
#pragma warning restore CS0618 // Type or member is obsolete
: base(next, serializer, documentExecuter, serviceScopeFactory, options, hostApplicationLifetime)
{
Mock.Get(hostApplicationLifetime).Setup(x => x.ApplicationStopping).Returns(tuple.Item1.Token);
Expand Down
Loading