This repository has been archived by the owner on Aug 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Apollo Federation v2 support (#4)
- Loading branch information
1 parent
e17fb99
commit b8c82e6
Showing
71 changed files
with
2,546 additions
and
232 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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 |
---|---|---|
|
@@ -3,6 +3,7 @@ obj | |
out | ||
|
||
# compatibility stuff | ||
products.graphql | ||
package.json | ||
package-lock.json | ||
results.md | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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,11 @@ | ||
using HotChocolate.Types.Descriptors; | ||
|
||
namespace Products; | ||
|
||
public sealed class CustomAttribute : ObjectTypeDescriptorAttribute | ||
{ | ||
protected override void OnConfigure(IDescriptorContext context, IObjectTypeDescriptor descriptor, Type type) | ||
{ | ||
descriptor.Directive(CustomDirectiveType.CustomDirectiveName); | ||
} | ||
} |
This file contains 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,11 @@ | ||
namespace Products; | ||
|
||
public sealed class CustomDirectiveType : DirectiveType | ||
{ | ||
public const string CustomDirectiveName = "custom"; | ||
|
||
protected override void Configure(IDirectiveTypeDescriptor descriptor) | ||
=> descriptor | ||
.Name(CustomDirectiveName) | ||
.Location(DirectiveLocation.Object); | ||
} |
This file contains 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,11 @@ | ||
using ApolloGraphQL.HotChocolate.Federation; | ||
using ApolloGraphQL.HotChocolate.Federation.Two; | ||
|
||
namespace Products; | ||
|
||
[ComposeDirective("@custom")] | ||
[Link("https://myspecs.dev/myCustomDirective/v1.0", new string[] { "@custom" })] | ||
public class CustomSchema : FederatedSchema | ||
{ | ||
|
||
} |
This file contains 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
This file contains 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,28 @@ | ||
using ApolloGraphQL.HotChocolate.Federation; | ||
|
||
namespace Products; | ||
|
||
[Key("id")] | ||
[InterfaceObject] | ||
public class Inventory | ||
{ | ||
|
||
public Inventory(string id) | ||
{ | ||
Id = id; | ||
} | ||
|
||
[ID] | ||
public string Id { get; } | ||
|
||
public List<DeprecatedProduct> DeprecatedProducts(Data repository) => repository.DeprecatedProducts; | ||
|
||
[ReferenceResolver] | ||
public static Inventory? GetInventoryById( | ||
string id, | ||
Data repository) | ||
{ | ||
return repository.Inventories().FirstOrDefault( | ||
r => r.Id.Equals(id)); | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
Oops, something went wrong.