Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Fusion 15 base project structure. #7743

Merged
merged 31 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
ef19cf0
Started introducing execution representation.
michaelstaib Oct 28, 2024
a0e76bb
Refactored operation nodes
michaelstaib Oct 28, 2024
e030fd4
More edits
michaelstaib Nov 8, 2024
c8a74a9
More edits
michaelstaib Nov 12, 2024
cb29429
Merge branch 'main' into mst/planning
michaelstaib Nov 12, 2024
0354830
More edits
michaelstaib Nov 12, 2024
8b4ac43
changes
michaelstaib Nov 19, 2024
abe0df1
Fixed CS9258 (#7713)
glen-84 Nov 13, 2024
f931a09
Added v15 documentation (#7715)
glen-84 Nov 16, 2024
ef971ca
Fixed incorrect Strawberry Shake URL in v14 documentation (#7714)
glen-84 Nov 16, 2024
581a973
Updated to .NET 9.0.100 SDK (#7726)
michaelstaib Nov 16, 2024
165d1ae
Fixed URL-safe ID serialization (#7724)
PascalSenn Nov 16, 2024
96ebc46
Returned error for unsupported enumerable value types in paging handl…
glen-84 Nov 17, 2024
29bf673
Fixed issue when accept:*/* and operation is a subscription. (#7732)
michaelstaib Nov 17, 2024
7934dfb
Support nodes field for automatic mocking (#7728)
tobias-tengler Nov 17, 2024
c7be9e8
[Fusion] Add tests for @remove (#7727)
tobias-tengler Nov 17, 2024
a2747fe
@semanticNonNull support (#7681)
tobias-tengler Nov 17, 2024
3d83e13
Added v15 migration document (#7716)
glen-84 Nov 17, 2024
577d94b
Changed the runtime type for LocalDateType, LocalTimeType, and DateTy…
glen-84 Nov 17, 2024
d82d8c4
Updated snapshots (#7733)
glen-84 Nov 18, 2024
25d3977
Updated "Persisted operations" documentation (#7734)
glen-84 Nov 18, 2024
d59a1dd
Added migration section for OnlyAllowPersistedOperations option chang…
glen-84 Nov 18, 2024
f7ce557
Fixed integration tests for Windows users (#7683)
CronKz Nov 18, 2024
c27e05d
Enforced specific format for LocalDateType, LocalTimeType, and DateTy…
glen-84 Nov 18, 2024
8a03f87
Added migration section for runtime type changes (#7721)
glen-84 Nov 18, 2024
59ebf4b
Added migration section for LocalDate/LocalTime/Date enforced format …
glen-84 Nov 18, 2024
711bc78
Remove Old Planner Files
michaelstaib Nov 19, 2024
2817e26
Make it compile
michaelstaib Nov 19, 2024
abde0da
It somewhat works sometimes
michaelstaib Nov 20, 2024
b6d0fd1
Project Setup
michaelstaib Nov 20, 2024
1edd36b
Merge branch 'main' into mst/planning
michaelstaib Nov 20, 2024
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
1 change: 1 addition & 0 deletions src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
<PackageVersion Include="System.Reactive" Version="6.0.0" />
<PackageVersion Include="Xunit" Version="2.9.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
<PackageVersion Include="TUnit" Version="0.3.34" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
Expand Down
4 changes: 4 additions & 0 deletions src/HotChocolate/Fusion-vnext/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<Project>
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)..\'))" />

</Project>
50 changes: 50 additions & 0 deletions src/HotChocolate/Fusion-vnext/HotChocolate.Fusion-vnext.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{1718E238-A6E5-42AE-A2D6-A0580457D486}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HotChocolate.Fusion.Execution", "src\Fusion.Execution\HotChocolate.Fusion.Execution.csproj", "{1566D098-4146-4ECF-9F45-EA43D88EEAA9}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{F7DA6A87-1AFE-479A-B138-96C32439ABF5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HotChocolate.Fusion.Execution.Tests", "test\Fusion.Execution.Tests\HotChocolate.Fusion.Execution.Tests.csproj", "{51749890-1860-46CD-B872-3E790C44A876}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HotChocolate.Fusion.Composition", "src\Fusion.Composition\HotChocolate.Fusion.Composition.csproj", "{6524E2C7-12A0-4987-B146-46C077B46DC0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HotChocolate.Fusion.Composition.Tests", "test\Fusion.Composition.Tests\HotChocolate.Fusion.Composition.Tests.csproj", "{1B0E0209-A99B-4AA4-95DD-30828C9CB5A9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1566D098-4146-4ECF-9F45-EA43D88EEAA9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1566D098-4146-4ECF-9F45-EA43D88EEAA9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1566D098-4146-4ECF-9F45-EA43D88EEAA9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1566D098-4146-4ECF-9F45-EA43D88EEAA9}.Release|Any CPU.Build.0 = Release|Any CPU
{51749890-1860-46CD-B872-3E790C44A876}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{51749890-1860-46CD-B872-3E790C44A876}.Debug|Any CPU.Build.0 = Debug|Any CPU
{51749890-1860-46CD-B872-3E790C44A876}.Release|Any CPU.ActiveCfg = Release|Any CPU
{51749890-1860-46CD-B872-3E790C44A876}.Release|Any CPU.Build.0 = Release|Any CPU
{6524E2C7-12A0-4987-B146-46C077B46DC0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6524E2C7-12A0-4987-B146-46C077B46DC0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6524E2C7-12A0-4987-B146-46C077B46DC0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6524E2C7-12A0-4987-B146-46C077B46DC0}.Release|Any CPU.Build.0 = Release|Any CPU
{1B0E0209-A99B-4AA4-95DD-30828C9CB5A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1B0E0209-A99B-4AA4-95DD-30828C9CB5A9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1B0E0209-A99B-4AA4-95DD-30828C9CB5A9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1B0E0209-A99B-4AA4-95DD-30828C9CB5A9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{1566D098-4146-4ECF-9F45-EA43D88EEAA9} = {1718E238-A6E5-42AE-A2D6-A0580457D486}
{51749890-1860-46CD-B872-3E790C44A876} = {F7DA6A87-1AFE-479A-B138-96C32439ABF5}
{6524E2C7-12A0-4987-B146-46C077B46DC0} = {1718E238-A6E5-42AE-A2D6-A0580457D486}
{1B0E0209-A99B-4AA4-95DD-30828C9CB5A9} = {F7DA6A87-1AFE-479A-B138-96C32439ABF5}
EndGlobalSection
EndGlobal
15 changes: 15 additions & 0 deletions src/HotChocolate/Fusion-vnext/src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project>
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)..\'))" />
<Import Project="$([MSBuild]::GetPathOfFileAbove('Nullable.props', '$(MSBuildThisFileDirectory)..\'))" />

<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<NoWarn>$(NoWarn);CA1812</NoWarn>
</PropertyGroup>

<PropertyGroup>
<IsAotCompatible>true</IsAotCompatible>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<AssemblyName>HotChocolate.Fusion.Composition.Tests</AssemblyName>
<RootNamespace>HotChocolate.Composition</RootNamespace>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<AssemblyName>HotChocolate.Fusion.Planning</AssemblyName>
<AssemblyName>HotChocolate.Fusion.Execution</AssemblyName>
<RootNamespace>HotChocolate.Fusion</RootNamespace>
<Nullable>enable</Nullable>
</PropertyGroup>

<PropertyGroup>
<IsAotCompatible>true</IsAotCompatible>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using HotChocolate.Language;

namespace HotChocolate.Fusion.Planning;

public interface IOperationNode
{
ISyntaxNode ToSyntaxNode();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using HotChocolate.Fusion.Types.Collections;
using HotChocolate.Language;

namespace HotChocolate.Fusion.Planning;

public interface ISelection : IOperationNode
{
SelectionSet? SelectionSet { get; }

DirectiveCollection Directives { get; }

new ISelectionNode ToSyntaxNode();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using HotChocolate.Fusion.Types;
using HotChocolate.Fusion.Types.Collections;
using HotChocolate.Language;

namespace HotChocolate.Fusion.Planning;

public sealed class InlineFragment : ISelection
{
public InlineFragment(
ICompositeNamedType type,
DirectiveCollection directives,
SelectionSet selectionSet)
{
Type = type;
Directives = directives;
SelectionSet = selectionSet;
}

public ICompositeNamedType Type { get; }

public DirectiveCollection Directives { get; }


public SelectionSet SelectionSet { get; }

public InlineFragmentNode ToSyntaxNode()
{
return new InlineFragmentNode(
null,
new NamedTypeNode(new NameNode(Type.Name)),
Directives.ToSyntaxNodes(),
SelectionSet.ToSyntaxNode());
}

ISelectionNode ISelection.ToSyntaxNode()
=> ToSyntaxNode();

ISyntaxNode IOperationNode.ToSyntaxNode()
=> ToSyntaxNode();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using HotChocolate.Fusion.Types;
using HotChocolate.Language;

namespace HotChocolate.Fusion.Planning;

public class FieldPlanNode : SelectionPlanNode
{
public FieldPlanNode(
FieldNode fieldNode,
CompositeOutputField field)
: base(field.Type.NamedType(), fieldNode.SelectionSet?.Selections)
{
FieldNode = fieldNode;
Field = field;
ResponseName = FieldNode.Alias?.Value ?? field.Name;
}

public string ResponseName { get; }

public FieldNode FieldNode { get; }

public CompositeOutputField Field { get; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace HotChocolate.Fusion.Planning;

public interface IOperationPlanNodeProvider
{
public IReadOnlyList<OperationPlanNode> Operations { get; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using HotChocolate.Fusion.Types;
using HotChocolate.Language;

namespace HotChocolate.Fusion.Planning;

/// <summary>
/// Represents an operation to resolve data from a specific source schema.
/// </summary>
public sealed class OperationPlanNode : SelectionPlanNode, IOperationPlanNodeProvider
{
private List<OperationPlanNode>? _operations;

public OperationPlanNode(
string schemaName,
ICompositeNamedType declaringType,
SelectionSetNode selectionSet,
PlanNode? parent = null)
: base(declaringType, selectionSet.Selections)
{
SchemaName = schemaName;
Parent = parent;
}

public OperationPlanNode(
string schemaName,
ICompositeNamedType declaringType,
IReadOnlyList<ISelectionNode> selections,
PlanNode? parent = null)
: base(declaringType, selections)
{
SchemaName = schemaName;
Parent = parent;
}

public string SchemaName { get; }

public IReadOnlyList<OperationPlanNode> Operations
=> _operations ?? (IReadOnlyList<OperationPlanNode>)Array.Empty<OperationPlanNode>();

public void AddOperation(OperationPlanNode operation)
{
ArgumentNullException.ThrowIfNull(operation);
(_operations ??= []).Add(operation);
operation.Parent = this;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace HotChocolate.Fusion.Planning;

public abstract class PlanNode
{
public PlanNode? Parent { get; internal set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace HotChocolate.Fusion.Planning;

public class RootPlanNode : PlanNode, IOperationPlanNodeProvider
{
private readonly List<OperationPlanNode> _operations = new();

public IReadOnlyList<OperationPlanNode> Operations
=> _operations;

public void AddOperation(OperationPlanNode operation)
{
ArgumentNullException.ThrowIfNull(operation);
_operations.Add(operation);
operation.Parent = this;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
using HotChocolate.Fusion.Types;
using HotChocolate.Language;

namespace HotChocolate.Fusion.Planning;

/// <summary>
/// The base class for plan nodes that can have child selections.
/// </summary>
public abstract class SelectionPlanNode : PlanNode
{
private List<CompositeDirective>? _directives;
private List<SelectionPlanNode>? _selections;

/// <summary>
/// Initializes a new instance of <see cref="SelectionPlanNode"/>.
/// </summary>
/// <param name="declaringType">
/// The type on which this selection is declared on.
/// </param>
/// <param name="selectionNodes">
/// The child selection syntax nodes of this selection.
/// </param>
protected SelectionPlanNode(
ICompositeNamedType declaringType,
IReadOnlyList<ISelectionNode>? selectionNodes)
{
DeclaringType = declaringType;
IsEntity = declaringType.IsEntity();
SelectionNodes = selectionNodes;
}

/// <summary>
/// Gets the type on which this selection is declared on.
/// </summary>
public ICompositeNamedType DeclaringType { get; }

/// <summary>
/// Defines if the selection is declared on an entity type.
/// </summary>
public bool IsEntity { get; }

/// <summary>
/// Gets the directives that are annotated to this selection.
/// </summary>
public IReadOnlyList<CompositeDirective> Directives
=> _directives ?? (IReadOnlyList<CompositeDirective>)Array.Empty<CompositeDirective>();

/// <summary>
/// Gets the child selection syntax nodes of this selection.
/// </summary>
public IReadOnlyList<ISelectionNode>? SelectionNodes { get; }

/// <summary>
/// Gets the child selections of this selection.
/// </summary>
public IReadOnlyList<SelectionPlanNode> Selections
=> _selections ?? (IReadOnlyList<SelectionPlanNode>)Array.Empty<SelectionPlanNode>();

/// <summary>
/// Adds a child selection to this selection.
/// </summary>
/// <param name="selection">
/// The child selection that shall be added.
/// </param>
public void AddSelection(SelectionPlanNode selection)
{
ArgumentNullException.ThrowIfNull(selection);
(_selections ??= []).Add(selection);
selection.Parent = this;
}

/// <summary>
/// Adds a directive to the selection.
/// </summary>
/// <param name="directive">
/// The directive that shall be added.
/// </param>
public void AddDirective(CompositeDirective directive)
{
ArgumentNullException.ThrowIfNull(directive);
(_directives ??= []).Add(directive);
}
}
Loading
Loading