Skip to content

Commit 7e39c4e

Browse files
committed
Merge branch 'main' into gai/dotnet-10
2 parents 675cccb + 6ee125a commit 7e39c4e

File tree

2,256 files changed

+64648
-27624
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,256 files changed

+64648
-27624
lines changed

.markdownlint.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@ MD033:
2727
- u
2828
- Video
2929
MD036: false # Rationale: Possibly too strict, used frequently in documentation.
30+
MD059: false # Rationale: Already used in many places in the documentation.

src/All.slnx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,19 @@
6767
<Folder Name="/HotChocolate/Caching/" />
6868
<Folder Name="/HotChocolate/Caching/src/">
6969
<Project Path="HotChocolate/Caching/src/Caching/HotChocolate.Caching.csproj" />
70+
<Project Path="HotChocolate/Caching/src/Caching.Memory/HotChocolate.Caching.Memory.csproj" />
7071
</Folder>
7172
<Folder Name="/HotChocolate/Caching/test/">
7273
<Project Path="HotChocolate/Caching/test/Caching.Tests/HotChocolate.Caching.Tests.csproj" />
74+
<Project Path="HotChocolate/Caching/test/Caching.Memory.Tests/HotChocolate.Caching.Memory.Tests.csproj" />
7375
</Folder>
7476
<Folder Name="/HotChocolate/Core/" />
7577
<Folder Name="/HotChocolate/Core/src/">
7678
<Project Path="HotChocolate/Core/src/Abstractions/HotChocolate.Abstractions.csproj" />
7779
<Project Path="HotChocolate/Core/src/Authorization/HotChocolate.Authorization.csproj" />
7880
<Project Path="HotChocolate/Core/src/Core/HotChocolate.Core.csproj" />
7981
<Project Path="HotChocolate/Core/src/Execution.Abstractions/HotChocolate.Execution.Abstractions.csproj" />
82+
<Project Path="HotChocolate/Core/src/Execution.Configuration.Abstractions/HotChocolate.Execution.Configuration.Abstractions.csproj" />
8083
<Project Path="HotChocolate/Core/src/Execution.Projections/HotChocolate.Execution.Projections.csproj" />
8184
<Project Path="HotChocolate/Core/src/Execution/HotChocolate.Execution.csproj" />
8285
<Project Path="HotChocolate/Core/src/Features/HotChocolate.Features.csproj" />
@@ -107,6 +110,7 @@
107110
<Folder Name="/HotChocolate/Core/test/">
108111
<Project Path="HotChocolate/Core/test/Abstractions.Tests/HotChocolate.Abstractions.Tests.csproj" />
109112
<Project Path="HotChocolate/Core/test/Authorization.Tests/HotChocolate.Authorization.Tests.csproj" />
113+
<Project Path="HotChocolate/Core/test/Execution.Abstractions.Tests/HotChocolate.Execution.Abstractions.Tests.csproj" />
110114
<Project Path="HotChocolate/Core/test/Execution.Tests/HotChocolate.Execution.Tests.csproj" />
111115
<Project Path="HotChocolate/Core/test/Features.Tests/HotChocolate.Features.Tests.csproj" />
112116
<Project Path="HotChocolate/Core/test/Fetching.Tests/HotChocolate.Fetching.Tests.csproj" />
@@ -118,6 +122,7 @@
118122
<Project Path="HotChocolate/Core/test/Subscriptions.Redis.Tests/HotChocolate.Subscriptions.Redis.Tests.csproj" />
119123
<Project Path="HotChocolate/Core/test/Subscriptions.Tests/HotChocolate.Subscriptions.Tests.csproj" />
120124
<Project Path="HotChocolate/Core/test/Types.Analyzers.Tests/HotChocolate.Types.Analyzers.Tests.csproj" />
125+
<Project Path="HotChocolate/Core/test/Types.Analyzer.Integration.Tests/HotChocolate.Types.Analyzers.Integration.Tests.csproj" />
121126
<Project Path="HotChocolate/Core/test/Types.CursorPagination.Tests/HotChocolate.Types.CursorPagination.Tests.csproj" />
122127
<Project Path="HotChocolate/Core/test/Types.Json.Tests/HotChocolate.Types.Json.Tests.csproj" />
123128
<Project Path="HotChocolate/Core/test/Types.Mutations.Tests/HotChocolate.Types.Mutations.Tests.csproj" />
@@ -131,9 +136,6 @@
131136
<Project Path="HotChocolate/Core/test/Utilities/HotChocolate.Tests.Utilities.csproj" />
132137
<Project Path="HotChocolate/Core/test/Validation.Tests/HotChocolate.Validation.Tests.csproj" />
133138
</Folder>
134-
<Folder Name="/HotChocolate/Core/test/Types.Analyzer.Integration.Tests/">
135-
<Project Path="HotChocolate/Core/test/Types.Analyzer.Integration.Tests/HotChocolate.Types.Analyzers.Tests.csproj" />
136-
</Folder>
137139
<Folder Name="/HotChocolate/CostAnalysis/" />
138140
<Folder Name="/HotChocolate/CostAnalysis/src/">
139141
<Project Path="HotChocolate/CostAnalysis/src/CostAnalysis/HotChocolate.CostAnalysis.csproj" />
@@ -266,6 +268,8 @@
266268
</Folder>
267269
<Folder Name="/HotChocolate/Utilities/" />
268270
<Folder Name="/HotChocolate/Utilities/src/">
271+
<Project Path="HotChocolate/Utilities/src/Utilities.Buffers/HotChocolate.Utilities.Buffers.csproj" />
272+
<Project Path="HotChocolate/Utilities/src/Utilities.Tasks/HotChocolate.Utilities.Tasks.csproj" />
269273
<Project Path="HotChocolate/Utilities/src/Utilities.DependencyInjection/HotChocolate.Utilities.DependencyInjection.csproj" />
270274
<Project Path="HotChocolate/Utilities/src/Utilities.Introspection/HotChocolate.Utilities.Introspection.csproj" />
271275
<Project Path="HotChocolate/Utilities/src/Utilities/HotChocolate.Utilities.csproj" />

src/CookieCrumble/src/CookieCrumble.HotChocolate/Extensions/SnapshotExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public static void MatchSnapshot(
1818
formatter: SnapshotValueFormatters.GraphQL);
1919

2020
public static void MatchSnapshot(
21-
this ISchema? value,
21+
this ISchemaDefinition? value,
2222
string? postFix = null)
2323
=> Snapshot.Match(
2424
value,

src/CookieCrumble/src/CookieCrumble.HotChocolate/Formatters/SchemaSnapshotValueFormatter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
namespace CookieCrumble.HotChocolate.Formatters;
66

7-
internal sealed class SchemaSnapshotValueFormatter() : SnapshotValueFormatter<ISchema>("graphql")
7+
internal sealed class SchemaSnapshotValueFormatter() : SnapshotValueFormatter<ISchemaDefinition>("graphql")
88
{
9-
protected override void Format(IBufferWriter<byte> snapshot, ISchema value)
9+
protected override void Format(IBufferWriter<byte> snapshot, ISchemaDefinition value)
1010
=> snapshot.Append(value.ToString());
1111
}

src/GreenDonut/CHANGELOG.md

Lines changed: 0 additions & 155 deletions
This file was deleted.

src/GreenDonut/src/GreenDonut.Data/Extensions/GreenDonutPageExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public static ImmutableArray<PageCursor> CreateRelativeForwardCursors<T>(this Pa
112112
return [];
113113
}
114114

115-
var totalPages = (page.TotalCount ?? 0) / (page.RequestedSize ?? 10);
115+
var totalPages = Math.Ceiling((double)(page.TotalCount ?? 0) / (page.RequestedSize ?? 10));
116116

117117
if (page.Index >= totalPages)
118118
{

src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/RelativeCursorTests.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,23 @@ await ctx.Brands.Where(t => t.GroupId == 2).OrderBy(t => t.Name).ThenBy(t => t.I
728728
await Assert.ThrowsAsync<ArgumentException>(Error);
729729
}
730730

731+
[Fact]
732+
public async Task RequestedSize_Not_Evenly_Divisible_By_TotalCount()
733+
{
734+
// Arrange
735+
var connectionString = CreateConnectionString();
736+
await SeedAsync(connectionString);
737+
await using var context = new TestContext(connectionString);
738+
var arguments = new PagingArguments(12) { EnableRelativeCursors = true };
739+
740+
// Act
741+
var first = await context.Brands.OrderBy(t => t.Name).ThenBy(t => t.Id).ToPageAsync(arguments);
742+
743+
// Assert
744+
Assert.Equal(20, first.TotalCount);
745+
Assert.Single(first.CreateRelativeForwardCursors());
746+
}
747+
731748
private static async Task SeedAsync(string connectionString)
732749
{
733750
await using var context = new TestContext(connectionString);

src/HotChocolate/ApolloFederation/src/ApolloFederation/Extensions/ApolloFederationRequestExecutorBuilderExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public static IRequestExecutorBuilder AddApolloFederation(
3030
FederationVersion version = FederationVersion.Default)
3131
{
3232
ArgumentNullException.ThrowIfNull(builder);
33-
builder.SetContextData(FederationContextData.FederationVersion, version);
33+
builder.ConfigureSchema(b => b.Features.Set(new ApolloFederationFeature(version)));
3434
builder.TryAddTypeInterceptor<FederationTypeInterceptor>();
3535
builder.BindRuntimeType<Policy, StringType>();
3636
builder.AddTypeConverter<Policy, string>(from => from.Value);

src/HotChocolate/ApolloFederation/src/ApolloFederation/Extensions/FederationVersionExtensions.cs

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
using HotChocolate.Features;
12
using HotChocolate.Types.Descriptors;
2-
using HotChocolate.Types.Descriptors.Definitions;
3+
using HotChocolate.Types.Descriptors.Configurations;
34

45
namespace HotChocolate.ApolloFederation;
56

@@ -31,31 +32,12 @@ [new Uri(FederationVersionUrls.Federation27)] = FederationVersion.Federation27,
3132

3233
public static FederationVersion GetFederationVersion<T>(
3334
this IDescriptor<T> descriptor)
34-
where T : DefinitionBase
35-
{
36-
var contextData = descriptor.Extend().Context.ContextData;
37-
if (contextData.TryGetValue(FederationContextData.FederationVersion, out var value) &&
38-
value is FederationVersion version and > FederationVersion.Unknown)
39-
{
40-
return version;
41-
}
42-
43-
// TODO : resources
44-
throw new InvalidOperationException("The configuration state is invalid.");
45-
}
35+
where T : TypeSystemConfiguration
36+
=> descriptor.Extend().Context.GetFederationVersion();
4637

4738
public static FederationVersion GetFederationVersion(
4839
this IDescriptorContext context)
49-
{
50-
if (context.ContextData.TryGetValue(FederationContextData.FederationVersion, out var value) &&
51-
value is FederationVersion version and > FederationVersion.Unknown)
52-
{
53-
return version;
54-
}
55-
56-
// TODO : resources
57-
throw new InvalidOperationException("The configuration state is invalid.");
58-
}
40+
=> context.Features.GetRequired<ApolloFederationFeature>().Version;
5941

6042
public static Uri ToUrl(this FederationVersion version)
6143
{
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
namespace HotChocolate.ApolloFederation;
2+
3+
internal sealed record ApolloFederationFeature(FederationVersion Version);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
namespace HotChocolate.ApolloFederation;
2+
3+
internal sealed class ContactMarker;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
namespace HotChocolate.ApolloFederation;
2+
3+
internal sealed class ExportedDirectives
4+
{
5+
public List<Type> Directives { get; } = [];
6+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using HotChocolate.Language;
2+
3+
namespace HotChocolate.ApolloFederation;
4+
5+
internal sealed class ExternalSetter(Action<ObjectType, IValueNode, object> setter)
6+
{
7+
public void Invoke(ObjectType type, IValueNode data, object obj)
8+
=> setter(type, data, obj);
9+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
namespace HotChocolate.ApolloFederation;
2+
3+
internal sealed record KeyMarker(bool Resolvable);
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
using HotChocolate.Resolvers;
2+
3+
namespace HotChocolate.ApolloFederation;
4+
5+
internal sealed record ReferenceResolver(FieldResolverDelegate Resolver);

src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationContextData.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ internal static class FederationContextData
44
{
55
public const string KeyMarker = "HotChocolate.ApolloFederation.Key";
66
public const string ContactMarker = "HotChocolate.ApolloFederation.Contact";
7-
public const string ExternalSetter = "HotChocolate.ApolloFederation.ExternalSetter";
8-
public const string EntityResolver = "HotChocolate.ApolloFederation.EntityResolver";
9-
public const string FederationVersion = "HotChocolate.ApolloFederation.Version";
107
public const string ExportedDirectives = "HotChocolate.ApolloFederation.ExportedDirectives";
118
public const string DataField = "data";
129
public const string TypeField = "__type";

0 commit comments

Comments
 (0)