Skip to content

Commit

Permalink
Merge branch 'main' into mst/handle-async-enumerable
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelstaib authored Jul 1, 2024
2 parents f00e0f3 + 51933a6 commit 9b43523
Show file tree
Hide file tree
Showing 59 changed files with 228 additions and 663 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
<Description>This package contains the command line extensions for HotChocolate</Description>
</PropertyGroup>

<ItemGroup>
<InternalsVisibleTo Include="HotChocolate.AspNetCore.CommandLine.Tests" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\Core\src\Core\HotChocolate.Core.csproj" />
</ItemGroup>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

<ItemGroup>
<InternalsVisibleTo Include="HotChocolate.Abstractions.Tests" />
<InternalsVisibleTo Include="HotChocolate.Core.Tests" />
<InternalsVisibleTo Include="HotChocolate.CostAnalysis" />
<InternalsVisibleTo Include="HotChocolate.Types.Tests" />

<!-- Legacy -->
<InternalsVisibleTo Include="HotChocolate.Execution" />
<InternalsVisibleTo Include="HotChocolate.Types" />
<InternalsVisibleTo Include="HotChocolate.Validation" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="6.0.0" />
<PackageReference Include="System.Collections.Immutable" Version="6.0.0" />
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,18 @@
</PropertyGroup>

<ItemGroup>
<InternalsVisibleTo Include="HotChocolate.Types.Mutations" />
<InternalsVisibleTo Include="DynamicProxyGenAssembly2" />
<InternalsVisibleTo Include="HotChocolate.AspNetCore.Tests" />
<InternalsVisibleTo Include="HotChocolate.Caching" />
<InternalsVisibleTo Include="HotChocolate.CostAnalysis" />
<InternalsVisibleTo Include="HotChocolate.Data" />
<InternalsVisibleTo Include="HotChocolate.Data.Raven" />
<InternalsVisibleTo Include="HotChocolate.Fusion" />
<InternalsVisibleTo Include="HotChocolate.Data" />
<InternalsVisibleTo Include="HotChocolate.Execution.Benchmarks" />
<InternalsVisibleTo Include="HotChocolate.Execution.Tests" />
<InternalsVisibleTo Include="HotChocolate.Fusion.Tests" />
<InternalsVisibleTo Include="HotChocolate.Fusion" />
<InternalsVisibleTo Include="HotChocolate.Types.Mutations" />
<InternalsVisibleTo Include="StrawberryShake.CodeGeneration" />
<InternalsVisibleTo Include="HotChocolate.Caching" />
</ItemGroup>

<ItemGroup>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public static IObjectFieldDescriptor UsePaging(
d.State = d.State.Add(WellKnownContextData.PagingOptions, pagingOptions);
d.Flags |= FieldFlags.Connection;
CreatePagingArguments(d.Arguments, backward, pagingOptions.LegacySupport ?? false);
CreatePagingArguments(d.Arguments, backward);
if (string.IsNullOrEmpty(connectionName))
{
Expand Down Expand Up @@ -223,7 +223,7 @@ public static IInterfaceFieldDescriptor UsePaging(
d.State = d.State.Add(WellKnownContextData.PagingOptions, pagingOptions);
d.Flags |= FieldFlags.Connection;
CreatePagingArguments(d.Arguments, backward, pagingOptions.LegacySupport ?? false);
CreatePagingArguments(d.Arguments, backward);
if (string.IsNullOrEmpty(connectionName))
{
Expand Down Expand Up @@ -259,12 +259,6 @@ public static IObjectFieldDescriptor AddPagingArguments(
public static IObjectFieldDescriptor AddPagingArguments(
this IObjectFieldDescriptor descriptor,
bool allowBackwardPagination)
=> AddPagingArguments(descriptor, allowBackwardPagination, false);

public static IObjectFieldDescriptor AddPagingArguments(
this IObjectFieldDescriptor descriptor,
bool allowBackwardPagination,
bool legacySupport)
{
if (descriptor == null)
{
Expand All @@ -273,8 +267,7 @@ public static IObjectFieldDescriptor AddPagingArguments(

CreatePagingArguments(
descriptor.Extend().Definition.Arguments,
allowBackwardPagination,
legacySupport);
allowBackwardPagination);

return descriptor;
}
Expand All @@ -286,12 +279,6 @@ public static IInterfaceFieldDescriptor AddPagingArguments(
public static IInterfaceFieldDescriptor AddPagingArguments(
this IInterfaceFieldDescriptor descriptor,
bool allowBackwardPagination)
=> AddPagingArguments(descriptor, allowBackwardPagination, false);

public static IInterfaceFieldDescriptor AddPagingArguments(
this IInterfaceFieldDescriptor descriptor,
bool allowBackwardPagination,
bool legacySupport)
{
if (descriptor == null)
{
Expand All @@ -300,22 +287,16 @@ public static IInterfaceFieldDescriptor AddPagingArguments(

CreatePagingArguments(
descriptor.Extend().Definition.Arguments,
allowBackwardPagination,
legacySupport);
allowBackwardPagination);

return descriptor;
}

private static void CreatePagingArguments(
IList<ArgumentDefinition> arguments,
bool allowBackwardPagination,
bool legacySupport)
bool allowBackwardPagination)
{
var intType =
legacySupport
? TypeReference.Parse(ScalarNames.PaginationAmount)
: TypeReference.Parse(ScalarNames.Int);

var intType = TypeReference.Parse(ScalarNames.Int);
var stringType = TypeReference.Parse(ScalarNames.String);

arguments.AddOrUpdate(First, PagingArguments_First_Description, intType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
<Description>Contains middleware and types for cursor based pagination.</Description>
</PropertyGroup>

<ItemGroup>
<InternalsVisibleTo Include="HotChocolate.Types.CursorPagination.Tests" />
<InternalsVisibleTo Include="HotChocolate.Types.Tests" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Types\HotChocolate.Types.csproj" />
<ProjectReference Include="..\Execution\HotChocolate.Execution.csproj" />
Expand Down

This file was deleted.

This file was deleted.

49 changes: 23 additions & 26 deletions src/HotChocolate/Core/src/Types/HotChocolate.Types.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,39 +16,36 @@
</ItemGroup>

<ItemGroup>
<InternalsVisibleTo Include="DynamicProxyGenAssembly2" />
<InternalsVisibleTo Include="HotChocolate.ApolloFederation" />
<InternalsVisibleTo Include="HotChocolate.AspNetCore.Authorization" />
<InternalsVisibleTo Include="HotChocolate.AspNetCore.Tests" />
<InternalsVisibleTo Include="HotChocolate.AspNetCore" />
<InternalsVisibleTo Include="HotChocolate.Authorization" />
<InternalsVisibleTo Include="HotChocolate.Caching.Tests" />
<InternalsVisibleTo Include="HotChocolate.Caching" />
<InternalsVisibleTo Include="HotChocolate.Core.Tests" />
<InternalsVisibleTo Include="HotChocolate.Core" />
<InternalsVisibleTo Include="HotChocolate.CostAnalysis" />
<InternalsVisibleTo Include="HotChocolate.Execution" />
<InternalsVisibleTo Include="HotChocolate.Data.Filters.Tests" />
<InternalsVisibleTo Include="HotChocolate.Data.Projections.Tests" />
<InternalsVisibleTo Include="HotChocolate.Data.Raven" />
<InternalsVisibleTo Include="HotChocolate.Data.Sorting.Tests" />
<InternalsVisibleTo Include="HotChocolate.Data" />
<InternalsVisibleTo Include="HotChocolate.Execution.Tests" />
<InternalsVisibleTo Include="HotChocolate.Execution" />
<InternalsVisibleTo Include="HotChocolate.Fusion" />
<InternalsVisibleTo Include="HotChocolate.Types.CursorPagination" />
<InternalsVisibleTo Include="HotChocolate.Types.Errors" />
<InternalsVisibleTo Include="HotChocolate.Types.Queries" />
<InternalsVisibleTo Include="HotChocolate.Types.Filters.Tests" />
<InternalsVisibleTo Include="HotChocolate.Types.Mutations" />
<InternalsVisibleTo Include="HotChocolate.Authorization" />
<InternalsVisibleTo Include="HotChocolate.AspNetCore" />
<InternalsVisibleTo Include="HotChocolate.AspNetCore.Authorization" />
<InternalsVisibleTo Include="HotChocolate.Validation" />
<InternalsVisibleTo Include="HotChocolate.Types.CursorPagination" />
<InternalsVisibleTo Include="HotChocolate.Types.OffsetPagination" />
<InternalsVisibleTo Include="HotChocolate.ApolloFederation" />
<InternalsVisibleTo Include="HotChocolate.Data" />
<InternalsVisibleTo Include="HotChocolate.Data.Raven" />
<InternalsVisibleTo Include="HotChocolate.Caching" />
<InternalsVisibleTo Include="HotChocolate.Fusion" />
<InternalsVisibleTo Include="StrawberryShake.CodeGeneration" />

<!--Legacy Support-->
<InternalsVisibleTo Include="HotChocolate.Types.Filters" />
<InternalsVisibleTo Include="HotChocolate.Types.Sorting" />
<InternalsVisibleTo Include="HotChocolate.Types.Selections" />

<!--Tests-->
<InternalsVisibleTo Include="HotChocolate.Types.Filters.Tests" />
<InternalsVisibleTo Include="HotChocolate.Types.Queries" />
<InternalsVisibleTo Include="HotChocolate.Types.Sorting.Tests" />
<InternalsVisibleTo Include="HotChocolate.Types.Tests" />
<InternalsVisibleTo Include="HotChocolate.AspNetCore.Tests" />
<InternalsVisibleTo Include="HotChocolate.Data.Filters.Tests" />
<InternalsVisibleTo Include="HotChocolate.Data.Sorting.Tests" />
<InternalsVisibleTo Include="HotChocolate.Data.Projections.Tests" />
<InternalsVisibleTo Include="HotChocolate.Caching.Tests" />
<InternalsVisibleTo Include="HotChocolate.Types.Tests" />
<InternalsVisibleTo Include="HotChocolate.Validation" />
<InternalsVisibleTo Include="StrawberryShake.CodeGeneration" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,6 @@ public struct PagingOptions
/// </summary>
public string? ProviderName { get; set; }

/// <summary>
/// Specifies if the GraphQL server shall emulate the PaginationAmount scalar for
/// the paging navigation arguments.
/// </summary>
public bool? LegacySupport { get; set; }

/// <summary>
/// Merges the <paramref name="other"/> options into this options instance wherever
/// a property is not set.
Expand All @@ -74,7 +68,6 @@ internal void Merge(PagingOptions other)
InferConnectionNameFromField ??= other.InferConnectionNameFromField;
InferCollectionSegmentNameFromField ??= other.InferCollectionSegmentNameFromField;
ProviderName ??= other.ProviderName;
LegacySupport ??= other.LegacySupport;
}

/// <summary>
Expand All @@ -90,7 +83,6 @@ internal PagingOptions Copy()
RequirePagingBoundaries = RequirePagingBoundaries,
InferConnectionNameFromField = InferConnectionNameFromField,
InferCollectionSegmentNameFromField = InferCollectionSegmentNameFromField,
ProviderName = ProviderName,
LegacySupport = LegacySupport,
ProviderName = ProviderName
};
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@ public static class ScalarNames
public const string Date = nameof(Date);
public const string TimeSpan = nameof(TimeSpan);
public const string Name = nameof(Name);
public const string PaginationAmount = nameof(PaginationAmount);
public const string JSON = nameof(JSON);
}
5 changes: 1 addition & 4 deletions src/HotChocolate/Core/src/Types/Types/Scalars/Scalars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,7 @@ public static class Scalars
{ ScalarNames.Any, typeof(AnyType) },

{ ScalarNames.ByteArray, typeof(ByteArrayType) },
{ ScalarNames.JSON, typeof(JsonType) },

// legacy support
{ ScalarNames.PaginationAmount, typeof(PaginationAmountType) },
{ ScalarNames.JSON, typeof(JsonType) }
};

private static readonly Dictionary<Type, ValueKind> _scalarKinds = new()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -938,53 +938,6 @@ public async Task Ensure_That_Explicit_Backward_Paging_Fields_Work_Execute()
.MatchSnapshotAsync();
}

[Fact]
public async Task LegacySupport_Schema()
{
Snapshot.FullName();

await new ServiceCollection()
.AddGraphQL()
.AddQueryType<QueryType>()
.SetPagingOptions(new PagingOptions { LegacySupport = true, })
.BuildSchemaAsync()
.MatchSnapshotAsync();
}

[Fact]
public async Task LegacySupport_Query()
{
Snapshot.FullName();

var executor =
await new ServiceCollection()
.AddGraphQL()
.AddQueryType<QueryType>()
.SetPagingOptions(new PagingOptions { LegacySupport = true, })
.Services
.BuildServiceProvider()
.GetRequestExecutorAsync();

await executor
.ExecuteAsync(@"
query($first: PaginationAmount = 2){
letters(first: $first) {
edges {
node
cursor
}
nodes
pageInfo {
hasNextPage
hasPreviousPage
startCursor
endCursor
}
}
}")
.MatchSnapshotAsync();
}

[Fact]
public async Task TotalCountWithCustomConnection()
{
Expand Down

This file was deleted.

Loading

0 comments on commit 9b43523

Please sign in to comment.