-
-
Notifications
You must be signed in to change notification settings - Fork 803
Add apollo federation connector #9479
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
Open
michaelstaib
wants to merge
10
commits into
main
Choose a base branch
from
mst/apollofederation-adapter
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
006a340
Add apollo federation connector
michaelstaib f1318a2
adds basic adapter
michaelstaib 9898ddc
Merge branch 'main' into mst/apollofederation-adapter
michaelstaib 8e15bcb
Merge branch 'main' into mst/apollofederation-adapter
michaelstaib 8f94dc6
Merge branch 'main' into mst/apollofederation-adapter
michaelstaib 6013419
edits
michaelstaib 1d8183f
edits
michaelstaib 4402859
edits
michaelstaib 88692ac
edits
michaelstaib f941211
Merge remote-tracking branch 'origin/main' into mst/apollofederation-…
michaelstaib File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/HotChocolate/Fusion/src/Fusion.Composition.ApolloFederation/AnalysisResult.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
| } |
18 changes: 18 additions & 0 deletions
18
src/HotChocolate/Fusion/src/Fusion.Composition.ApolloFederation/EntityKeyInfo.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
| } |
19 changes: 19 additions & 0 deletions
19
src/HotChocolate/Fusion/src/Fusion.Composition.ApolloFederation/FederationDirectiveNames.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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"; | ||
| } |
7 changes: 7 additions & 0 deletions
7
src/HotChocolate/Fusion/src/Fusion.Composition.ApolloFederation/FederationFieldNames.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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"; | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.