Skip to content

Commit

Permalink
Merge branch 'main' into personal/dr/non-resolvable-key
Browse files Browse the repository at this point in the history
  • Loading branch information
danielreynolds1 authored Jun 21, 2024
2 parents 076cdde + eb3a05c commit d9a1127
Show file tree
Hide file tree
Showing 400 changed files with 9,424 additions and 5,465 deletions.
1 change: 1 addition & 0 deletions .build/Helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ static class Helpers
Path.Combine("HotChocolate", "Marten"),
Path.Combine("HotChocolate", "MongoDb"),
Path.Combine("HotChocolate", "OpenApi"),
Path.Combine("HotChocolate", "Primitives"),
Path.Combine("HotChocolate", "Raven"),
Path.Combine("HotChocolate", "Skimmed"),
Path.Combine("HotChocolate", "Fusion"),
Expand Down
3 changes: 1 addition & 2 deletions src/CookieCrumble/src/CookieCrumble/CookieCrumble.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@
<ProjectReference Include="..\..\..\HotChocolate\AspNetCore\src\Transport.Abstractions\HotChocolate.Transport.Abstractions.csproj" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net7.0' OR '$(TargetFramework)' == 'net8.0'">
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<ProjectReference Include="..\..\..\HotChocolate\Fusion\src\Core\HotChocolate.Fusion.csproj" />
<ProjectReference Include="..\..\..\HotChocolate\Skimmed\src\Skimmed\Skimmed.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if NET7_0_OR_GREATER
#if NET8_0_OR_GREATER
using System.Buffers;
using HotChocolate.Fusion.Execution.Nodes;

Expand Down

This file was deleted.

32 changes: 18 additions & 14 deletions src/CookieCrumble/src/CookieCrumble/LocalFactDiscoverer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,29 @@ namespace CookieCrumble;
[XunitTestCaseDiscoverer("LocalFactDiscoverer", "YourTestAssemblyName")]
public class LocalFactAttribute : FactAttribute;

public class LocalFactDiscoverer : FactDiscoverer
public class LocalFactDiscoverer(IMessageSink diagnosticMessageSink) : FactDiscoverer(diagnosticMessageSink)
{
private readonly IMessageSink _diagnosticMessageSink;
private readonly IMessageSink _diagnosticMessageSink = diagnosticMessageSink;

public LocalFactDiscoverer(IMessageSink diagnosticMessageSink) : base(diagnosticMessageSink)
{
_diagnosticMessageSink = diagnosticMessageSink;
}


protected override IXunitTestCase CreateTestCase(ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo factAttribute)
protected override IXunitTestCase CreateTestCase(
ITestFrameworkDiscoveryOptions discoveryOptions,
ITestMethod testMethod,
IAttributeInfo factAttribute)
{
if (TestEnvironment.IsLocalEnvironment())
{
return new XunitTestCase(_diagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), discoveryOptions.MethodDisplayOptionsOrDefault(), testMethod);
}
else
{
return new ExecutionErrorTestCase(_diagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), discoveryOptions.MethodDisplayOptionsOrDefault(), testMethod, "LocalFact tests cannot run in CI environment");
return new XunitTestCase(
_diagnosticMessageSink,
discoveryOptions.MethodDisplayOrDefault(),
discoveryOptions.MethodDisplayOptionsOrDefault(),
testMethod);
}

return new ExecutionErrorTestCase(
_diagnosticMessageSink,
discoveryOptions.MethodDisplayOrDefault(),
discoveryOptions.MethodDisplayOptionsOrDefault(),
testMethod,
"LocalFact tests cannot run in CI environment");
}
}
3 changes: 1 addition & 2 deletions src/CookieCrumble/src/CookieCrumble/Snapshot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ public class Snapshot
new HttpResponseSnapshotValueFormatter(),
new OperationResultSnapshotValueFormatter(),
new JsonElementSnapshotValueFormatter(),
#if NET7_0_OR_GREATER
#if NET8_0_OR_GREATER
new QueryPlanSnapshotValueFormatter(),
new SkimmedSchemaSnapshotValueFormatter(),
#endif
});
private static readonly JsonSnapshotValueFormatter _defaultFormatter = new();
Expand Down
15 changes: 12 additions & 3 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,18 @@
</ItemGroup>

<ItemGroup Condition="'$(Configuration)' == 'debug'">
<PackageReference Include="Roslynator.Analyzers" Version="4.12.3" />
<PackageReference Include="Roslynator.CodeAnalysis.Analyzers" Version="4.12.3" />
<PackageReference Include="Roslynator.Formatting.Analyzers" Version="4.12.3" />
<PackageReference Include="Roslynator.Analyzers" Version="4.12.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Roslynator.CodeAnalysis.Analyzers" Version="4.12.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Roslynator.Formatting.Analyzers" Version="4.12.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ internal static ObjectFieldDefinition CreateServiceField(IDescriptorContext cont
descriptor.Type<NonNullType<ObjectType<_Service>>>().Resolve(_service);
descriptor.Definition.PureResolver = Resolve;

static _Service Resolve(IPureResolverContext ctx)
static _Service Resolve(IResolverContext ctx)
=> _service;

return descriptor.CreateDefinition();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace HotChocolate.AspNetCore;

internal static class GlobalStateHelpers
{
public static HttpContext GetHttpContext(IPureResolverContext context)
public static HttpContext GetHttpContext(IResolverContext context)
{
if (context.ContextData.TryGetValue(nameof(HttpContext), out var value) &&
value is HttpContext httpContext)
Expand All @@ -16,9 +16,9 @@ public static HttpContext GetHttpContext(IPureResolverContext context)
throw new MissingStateException("Resolver", nameof(HttpContext), StateKind.Global);
}

public static HttpRequest GetHttpRequest(IPureResolverContext context)
public static HttpRequest GetHttpRequest(IResolverContext context)
=> GetHttpContext(context).Request;

public static HttpResponse GetHttpResponse(IPureResolverContext context)
public static HttpResponse GetHttpResponse(IResolverContext context)
=> GetHttpContext(context).Response;
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
using System.Reflection;
using HotChocolate.Internal;
using HotChocolate.Resolvers;
using HotChocolate.Resolvers.Expressions.Parameters;
using Microsoft.AspNetCore.Http;

namespace HotChocolate.AspNetCore.ParameterExpressionBuilders;

internal sealed class HttpContextParameterExpressionBuilder
: LambdaParameterExpressionBuilder<IPureResolverContext, HttpContext>
internal sealed class HttpContextParameterExpressionBuilder()
: LambdaParameterExpressionBuilder<HttpContext>(ctx => GlobalStateHelpers.GetHttpContext(ctx), isPure: true)
{
public HttpContextParameterExpressionBuilder()
: base(ctx => GlobalStateHelpers.GetHttpContext(ctx)) { }

public override ArgumentKind Kind => ArgumentKind.GlobalState;

public override bool CanHandle(ParameterInfo parameter)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,9 @@

namespace HotChocolate.AspNetCore.ParameterExpressionBuilders;

internal sealed class HttpRequestParameterExpressionBuilder
: LambdaParameterExpressionBuilder<IPureResolverContext, HttpRequest>
internal sealed class HttpRequestParameterExpressionBuilder()
: LambdaParameterExpressionBuilder<HttpRequest>(ctx => GlobalStateHelpers.GetHttpRequest(ctx), isPure: true)
{
public HttpRequestParameterExpressionBuilder()
: base(ctx => GlobalStateHelpers.GetHttpRequest(ctx)) { }

public override ArgumentKind Kind => ArgumentKind.GlobalState;

public override bool CanHandle(ParameterInfo parameter)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,9 @@

namespace HotChocolate.AspNetCore.ParameterExpressionBuilders;

internal sealed class HttpResponseParameterExpressionBuilder
: LambdaParameterExpressionBuilder<IPureResolverContext, HttpResponse>
internal sealed class HttpResponseParameterExpressionBuilder()
: LambdaParameterExpressionBuilder<HttpResponse>(ctx => GlobalStateHelpers.GetHttpResponse(ctx), isPure: true)
{
public HttpResponseParameterExpressionBuilder()
: base(ctx => GlobalStateHelpers.GetHttpResponse(ctx)) { }

public override ArgumentKind Kind => ArgumentKind.GlobalState;

public override bool CanHandle(ParameterInfo parameter)
Expand Down
15 changes: 15 additions & 0 deletions src/HotChocolate/Core/HotChocolate.Core.sln
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HotChocolate.Features.Tests
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HotChocolate.Pagination.Core", "src\Pagination.Core\HotChocolate.Pagination.Core.csproj", "{4E7D749A-7172-411D-977C-E88500321FB0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HotChocolate.Types.Analyzers.DataLoader.Tests", "test\Types.Analyzers.DataLoader.Tests\HotChocolate.Types.Analyzers.DataLoader.Tests.csproj", "{DC27BCB9-CF45-4FD4-BECF-5D97494666A1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -1013,6 +1015,18 @@ Global
{4E7D749A-7172-411D-977C-E88500321FB0}.Release|x64.Build.0 = Release|Any CPU
{4E7D749A-7172-411D-977C-E88500321FB0}.Release|x86.ActiveCfg = Release|Any CPU
{4E7D749A-7172-411D-977C-E88500321FB0}.Release|x86.Build.0 = Release|Any CPU
{DC27BCB9-CF45-4FD4-BECF-5D97494666A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DC27BCB9-CF45-4FD4-BECF-5D97494666A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DC27BCB9-CF45-4FD4-BECF-5D97494666A1}.Debug|x64.ActiveCfg = Debug|Any CPU
{DC27BCB9-CF45-4FD4-BECF-5D97494666A1}.Debug|x64.Build.0 = Debug|Any CPU
{DC27BCB9-CF45-4FD4-BECF-5D97494666A1}.Debug|x86.ActiveCfg = Debug|Any CPU
{DC27BCB9-CF45-4FD4-BECF-5D97494666A1}.Debug|x86.Build.0 = Debug|Any CPU
{DC27BCB9-CF45-4FD4-BECF-5D97494666A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DC27BCB9-CF45-4FD4-BECF-5D97494666A1}.Release|Any CPU.Build.0 = Release|Any CPU
{DC27BCB9-CF45-4FD4-BECF-5D97494666A1}.Release|x64.ActiveCfg = Release|Any CPU
{DC27BCB9-CF45-4FD4-BECF-5D97494666A1}.Release|x64.Build.0 = Release|Any CPU
{DC27BCB9-CF45-4FD4-BECF-5D97494666A1}.Release|x86.ActiveCfg = Release|Any CPU
{DC27BCB9-CF45-4FD4-BECF-5D97494666A1}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -1089,6 +1103,7 @@ Global
{669FA147-3B41-4841-921A-55B019C3AF26} = {37B9D3B1-CA34-4720-9A0B-CFF1E64F52C2}
{EA77D317-8767-4DDE-8038-820D582C52D6} = {7462D089-D350-44D6-8131-896D949A65B7}
{4E7D749A-7172-411D-977C-E88500321FB0} = {37B9D3B1-CA34-4720-9A0B-CFF1E64F52C2}
{DC27BCB9-CF45-4FD4-BECF-5D97494666A1} = {7462D089-D350-44D6-8131-896D949A65B7}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E4D94C77-6657-4630-9D42-0A9AC5153A1B}
Expand Down
13 changes: 12 additions & 1 deletion src/HotChocolate/Core/src/Abstractions/ErrorBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public IErrorBuilder SetMessage(string message)
AbstractionResources.Error_Message_Must_Not_Be_Null,
nameof(message));
}

_message = message;
return this;
}
Expand Down Expand Up @@ -110,7 +111,17 @@ public IErrorBuilder AddLocation(Location location)
public IErrorBuilder AddLocation(int line, int column) =>
AddLocation(new Location(line, column));

public IErrorBuilder AddLocation<T>(IReadOnlyList<T>? syntaxNodes) where T : ISyntaxNode
public IErrorBuilder AddLocation(ISyntaxNode syntaxNode)
{
if (syntaxNode.Location is { } location)
{
AddLocation(location.Line, location.Column);
}

return this;
}

public IErrorBuilder SetLocations<T>(IReadOnlyList<T>? syntaxNodes) where T : ISyntaxNode
{
if (syntaxNodes is null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ namespace HotChocolate;

public static class ErrorBuilderExtensions
{
public static IErrorBuilder SetFieldCoordinate(
this IErrorBuilder builder,
SchemaCoordinate fieldCoordinate)
=> builder.SetExtension(nameof(fieldCoordinate), fieldCoordinate.ToString());

public static IErrorBuilder SetMessage(this IErrorBuilder builder, string format, params object[] args)
=> builder.SetMessage(string.Format(CultureInfo.InvariantCulture, format, args));
}
14 changes: 0 additions & 14 deletions src/HotChocolate/Core/src/Abstractions/ErrorCodes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -270,20 +270,6 @@ public static class Filtering
public const string FilterFieldDescriptorType = "FILTER_FIELD_DESCRIPTOR_TYPE";
}

public static class Stitching
{
public const string HttpRequestException = "HC0006";

public const string UnknownRequestException = "HC0007";

public const string ArgumentNotDefined = "STITCHING_ARG_NOT_DEFINED";
public const string FieldNotDefined = "STITCHING_FLD_NOT_DEFINED";
public const string VariableNotDefined = "STITCHING_VAR_NOT_DEFINED";
public const string ScopeNotDefined = "STITCHING_SCOPE_NOT_DEFINED";
public const string TypeNotDefined = "STITCHING_TYPE_NOT_DEFINED";
public const string ArgumentNotFound = "STITCHING_DEL_ARGUMENT_NOT_FOUND";
}

public static class Spatial
{
/// <summary>
Expand Down
Loading

0 comments on commit d9a1127

Please sign in to comment.