Skip to content
Open
Show file tree
Hide file tree
Changes from 4 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
2 changes: 2 additions & 0 deletions src/HotChocolate/Fusion/HotChocolate.Fusion.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<Project Path="src/Fusion.Language/HotChocolate.Fusion.Language.csproj" />
<Project Path="src/Fusion.Packaging/HotChocolate.Fusion.Packaging.csproj" />
<Project Path="src/Fusion.SourceSchema.Packaging/HotChocolate.Fusion.SourceSchema.Packaging.csproj" />
<Project Path="src/Fusion.Connectors.ApolloFederation/HotChocolate.Fusion.Connectors.ApolloFederation.csproj" />
<Project Path="src/Fusion.Connectors.InMemory/HotChocolate.Fusion.Connectors.InMemory.csproj" />
<Project Path="src/Fusion.Utilities/HotChocolate.Fusion.Utilities.csproj" />
</Folder>
Expand All @@ -26,6 +27,7 @@
<Project Path="test/Fusion.Language.Tests/HotChocolate.Fusion.Language.Tests.csproj" />
<Project Path="test/Fusion.Packaging.Tests/HotChocolate.Fusion.Packaging.Tests.csproj" />
<Project Path="test/Fusion.SourceSchema.Packaging.Tests/HotChocolate.Fusion.SourceSchema.Packaging.Tests.csproj" />
<Project Path="test/Fusion.Connectors.ApolloFederation.Tests/HotChocolate.Fusion.Connectors.ApolloFederation.Tests.csproj" />
<Project Path="test/Fusion.Connectors.InMemory.Tests/HotChocolate.Fusion.Connectors.InMemory.Tests.csproj" />
<Project Path="test/Fusion.Utilities.Tests/HotChocolate.Fusion.Utilities.Tests.csproj" />
<Project Path="test/Fusion.Tests.Shared/HotChocolate.Fusion.Tests.Shared.csproj" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using HotChocolate.Fusion.Errors;
using HotChocolate.Language;

namespace HotChocolate.Fusion.ApolloFederation;

/// <summary>
/// Contains the metadata extracted from analyzing a Federation v2 schema document.
/// </summary>
internal sealed class AnalysisResult
{
/// <summary>
/// Gets the detected federation version string (e.g. "v2.0", "v2.5").
/// A value of "v1" indicates unsupported federation v1.
/// </summary>
public string FederationVersion { get; set; } = "v1";

/// <summary>
/// Gets the entity key definitions keyed by type name.
/// Each type may have multiple <c>@key</c> directives.
/// </summary>
public Dictionary<string, List<EntityKeyInfo>> EntityKeys { get; init; } = [];

/// <summary>
/// Gets the field type map: typeName -> fieldName -> field type node.
/// </summary>
public Dictionary<string, Dictionary<string, ITypeNode>> TypeFieldTypes { get; init; } = [];

/// <summary>
/// Gets the name of the query root type (defaults to "Query").
/// </summary>
public string QueryTypeName { get; set; } = "Query";

/// <summary>
/// Gets the list of composition errors detected during analysis.
/// </summary>
public List<CompositionError> Errors { get; init; } = [];

/// <summary>
/// Gets a value indicating whether analysis produced any errors.
/// </summary>
public bool HasErrors => Errors.Count > 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
namespace HotChocolate.Fusion.ApolloFederation;

/// <summary>
/// Represents a single <c>@key</c> directive on a federation entity type.
/// </summary>
internal sealed class EntityKeyInfo
{
/// <summary>
/// Gets the raw field selection string from <c>@key(fields: "...")</c>.
/// </summary>
public required string Fields { get; init; }

/// <summary>
/// Gets a value indicating whether the key is resolvable.
/// Defaults to <c>true</c> when the <c>resolvable</c> argument is omitted.
/// </summary>
public bool Resolvable { get; init; } = true;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
namespace HotChocolate.Fusion.ApolloFederation;

internal static class FederationDirectiveNames
{
public const string Key = "key";
public const string Requires = "requires";
public const string Provides = "provides";
public const string External = "external";
public const string Link = "link";
public const string Shareable = "shareable";
public const string Inaccessible = "inaccessible";
public const string Override = "override";
public const string Tag = "tag";
public const string InterfaceObject = "interfaceObject";
public const string ComposeDirective = "composeDirective";
public const string Authenticated = "authenticated";
public const string RequiresScopes = "requiresScopes";
public const string Policy = "policy";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace HotChocolate.Fusion.ApolloFederation;

internal static class FederationFieldNames
{
public const string Entities = "_entities";
public const string Service = "_service";
}
Loading
Loading