diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 3391701..2def9b9 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -22,7 +22,7 @@ jobs: run: | NEW_VERSION=$(echo "${GITHUB_REF}" | sed 's/.*\/v//') echo "New version: ${NEW_VERSION}" - dotnet pack -p:Version=${NEW_VERSION} -p:Configuration=Release src/Federation/ApolloGraphQL.Federation.HotChocolate.csproj + dotnet pack -p:Version=${NEW_VERSION} -p:Configuration=Release src/Federation/ApolloGraphQL.HotChocolate.Federation.csproj - name: Publish package run: dotnet nuget push src/Federation/bin/Release/*.nupkg -k $NUGET_AUTH_TOKEN -s https://api.nuget.org/v3/index.json env: diff --git a/ApolloGraphQL.Federation.HotChocolate.sln b/ApolloGraphQL.Federation.HotChocolate.sln index 2eb77ff..748caef 100644 --- a/ApolloGraphQL.Federation.HotChocolate.sln +++ b/ApolloGraphQL.Federation.HotChocolate.sln @@ -5,11 +5,11 @@ VisualStudioVersion = 16.0.30114.105 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{74D95657-7BC6-409F-8484-F963A128764A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Federation", "src\Federation\ApolloGraphQL.Federation.HotChocolate.csproj", "{46D3566C-FBBC-46BB-A9AB-454F348A003E}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Federation", "src\Federation\ApolloGraphQL.HotChocolate.Federation.csproj", "{46D3566C-FBBC-46BB-A9AB-454F348A003E}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{EA937CAB-A9B1-474E-BF2A-A45399561B2E}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Federation.Tests", "test\Federation.Tests\ApolloGraphQL.Federation.HotChocolate.Tests.csproj", "{3B96CAE2-A6C0-4BA6-A21B-1CBFE6EF7A16}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Federation.Tests", "test\Federation.Tests\ApolloGraphQL.HotChocolate.Federation.Tests.csproj", "{3B96CAE2-A6C0-4BA6-A21B-1CBFE6EF7A16}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examples", "examples", "{82050CA3-2111-49D6-B682-EA22191ADB99}" EndProject diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7b4a3f0..72cc113 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -38,7 +38,7 @@ dotnet build #### Unit Tests -We are using `ApolloGraphQL.Federation.HotChocolate.Tests` project for our unit tests. This ensures we have good code coverage and can easily test all cases of schema federation. +We are using `ApolloGraphQL.HotChocolate.Federation.Tests` project for our unit tests. This ensures we have good code coverage and can easily test all cases of schema federation. To run tests: @@ -66,7 +66,7 @@ In order to [release a new version](https://github.com/apollographql/federation- and tag the commit. Releases are following [semantic versioning](https://semver.org/) and specify major, minor and patch version. Once release is published it will trigger corresponding [Github Action](https://github.com/apollographql/federation-hotchocolate/blob/main/.github/workflows/release.yaml) -based on the published release event. Release workflow will then proceed to build and publish all library artifacts to [NuGet](https://www.nuget.org/packages/ApolloGraphQL.Federation.HotChocolate). +based on the published release event. Release workflow will then proceed to build and publish all library artifacts to [NuGet](https://www.nuget.org/packages/ApolloGraphQL.HotChocolate.Federation). ### Release requirements diff --git a/README.md b/README.md index 689f0f8..c75d4d8 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [![Continuous Integration](https://github.com/apollographql/federation-hotchocolate/workflows/Continuous%20Integration/badge.svg)](https://github.com/apollographql/federation-hotchocolate/actions?query=workflow%3A%22Continuous+Integration%22) [![MIT License](https://img.shields.io/github/license/apollographql/federation-hotchocolate.svg)](LICENSE) -[![Nuget](https://img.shields.io/nuget/v/ApolloGraphQL.Federation.HotChocolate)](https://www.nuget.org/packages/ApolloGraphQL.Federation.HotChocolate/) +[![Nuget](https://img.shields.io/nuget/v/ApolloGraphQL.HotChocolate.Federation)](https://www.nuget.org/packages/ApolloGraphQL.HotChocolate.Federation/) [![Join the community forum](https://img.shields.io/badge/join%20the%20community-forum-blueviolet)](https://community.apollographql.com) [![Join our Discord server](https://img.shields.io/discord/1022972389463687228.svg?color=7389D8&labelColor=6A7EC2&logo=discord&logoColor=ffffff&style=flat-square)](https://discord.gg/graphos) @@ -10,28 +10,19 @@ >This is a fork of `HotChocolate.Federation` module that aims to provide first class [Apollo Federation](https://www.apollographql.com/docs/federation/) support for [`HotChocolate` subgraphs](https://chillicream.com/docs/hotchocolate/v13). [**Apollo Federation**](https://www.apollographql.com/docs/federation/) is a powerful, open architecture that helps you create a **unified supergraph** that combines multiple GraphQL APIs. -`ApolloGraphQL.Federation.HotChocolate` provides Apollo Federation support for building subgraphs in the `HotChocolate` ecosystem. Individual subgraphs can be run independently of each other but can also specify +`ApolloGraphQL.HotChocolate.Federation` provides Apollo Federation support for building subgraphs in the `HotChocolate` ecosystem. Individual subgraphs can be run independently of each other but can also specify relationships to the other subgraphs by using Federated directives. See [Apollo Federation documentation](https://www.apollographql.com/docs/federation/) for details. -```mermaid -graph BT; - router([Supergraph
router]); - serviceA[Users
subgraph]; - serviceB[Products
subgraph]; - serviceC[Reviews
subgraph]; - router --- serviceA & serviceB & serviceC; -``` - ## Installation -`ApolloGraphQL.Federation.HotChocolate` package is published to [Nuget](https://img.shields.io/nuget/v/ApolloGraphQL.Federation.HotChocolate). Update your `.csproj` file with following package references +`ApolloGraphQL.HotChocolate.Federation` package is published to [Nuget](https://img.shields.io/nuget/v/ApolloGraphQL.HotChocolate.Federation). Update your `.csproj` file with following package references ```xml - + ``` @@ -60,7 +51,7 @@ Apollo Federation requires subgraphs to provide some additional metadata to make the supergraph by the specified `@key`s. Since entities can be extended by various subgraphs, we need an extra entry point to access the entities, i.e. subgraphs need to implement reference resolvers for entities that they support. -Currently `ApolloGraphQL.Federation.HotChocolate` supports only Apollo Federation v1. See [Apollo documentation](https://www.apollographql.com/docs/federation/) for additional Federation details. +Currently `ApolloGraphQL.HotChocolate.Federation` supports only Apollo Federation v1. See [Apollo documentation](https://www.apollographql.com/docs/federation/) for additional Federation details. ### Annotation @@ -109,7 +100,7 @@ type Product @key(fields: "id") { Directives * `Key` applicable on objects, see [`@key` documentation](https://www.apollographql.com/docs/federation/federated-types/federated-directives#key) -* `ExtendService` applicable on objects, see [`@extends` documentation](https://www.apollographql.com/docs/federation/federated-types/federated-directives#extends) +* `Extends` applicable on objects, see [`@extends` documentation](https://www.apollographql.com/docs/federation/federated-types/federated-directives#extends) * `External` applicable on fields, see [`@external` documentation](https://www.apollographql.com/docs/federation/federated-types/federated-directives#external) * `Provides` applicable on fields, see [`@provides` documentation](https://www.apollographql.com/docs/federation/federated-types/federated-directives#provides) * `Requires` applicable on fields, see [`@requires` documentation](https://www.apollographql.com/docs/federation/federated-types/federated-directives#requires) diff --git a/compatibility/Products.csproj b/compatibility/Products.csproj index 977f9cb..c2251c1 100644 --- a/compatibility/Products.csproj +++ b/compatibility/Products.csproj @@ -13,7 +13,7 @@ - + diff --git a/compatibility/Types/DeprecatedProduct.cs b/compatibility/Types/DeprecatedProduct.cs index cb44780..d89ac37 100644 --- a/compatibility/Types/DeprecatedProduct.cs +++ b/compatibility/Types/DeprecatedProduct.cs @@ -1,4 +1,4 @@ -using ApolloGraphQL.Federation.HotChocolate; +using ApolloGraphQL.HotChocolate.Federation; namespace Products; diff --git a/compatibility/Types/Product.cs b/compatibility/Types/Product.cs index 82c18d4..fd8f95d 100644 --- a/compatibility/Types/Product.cs +++ b/compatibility/Types/Product.cs @@ -1,4 +1,4 @@ -using ApolloGraphQL.Federation.HotChocolate; +using ApolloGraphQL.HotChocolate.Federation; namespace Products; diff --git a/compatibility/Types/ProductResearch.cs b/compatibility/Types/ProductResearch.cs index cec566b..5947ae8 100644 --- a/compatibility/Types/ProductResearch.cs +++ b/compatibility/Types/ProductResearch.cs @@ -1,4 +1,4 @@ -using ApolloGraphQL.Federation.HotChocolate; +using ApolloGraphQL.HotChocolate.Federation; namespace Products; diff --git a/compatibility/Types/Query.cs b/compatibility/Types/Query.cs index 4f9ee36..92c9388 100644 --- a/compatibility/Types/Query.cs +++ b/compatibility/Types/Query.cs @@ -1,4 +1,4 @@ -using ApolloGraphQL.Federation.HotChocolate; +using ApolloGraphQL.HotChocolate.Federation; namespace Products; diff --git a/compatibility/Types/User.cs b/compatibility/Types/User.cs index 701c039..d49431a 100644 --- a/compatibility/Types/User.cs +++ b/compatibility/Types/User.cs @@ -1,4 +1,4 @@ -using ApolloGraphQL.Federation.HotChocolate; +using ApolloGraphQL.HotChocolate.Federation; namespace Products; diff --git a/compatibility/packages.lock.json b/compatibility/packages.lock.json index 0b5b33d..1d48edf 100644 --- a/compatibility/packages.lock.json +++ b/compatibility/packages.lock.json @@ -397,7 +397,7 @@ "System.IO.Hashing": "7.0.0" } }, - "apollographql.federation.hotchocolate": { + "ApolloGraphQL.HotChocolate.Federation": { "type": "Project", "dependencies": { "HotChocolate": "[13.5.1, )" diff --git a/examples/AnnotationBased/Accounts/Accounts.csproj b/examples/AnnotationBased/Accounts/Accounts.csproj index ae224d6..1afb6af 100644 --- a/examples/AnnotationBased/Accounts/Accounts.csproj +++ b/examples/AnnotationBased/Accounts/Accounts.csproj @@ -12,7 +12,7 @@ - + diff --git a/examples/AnnotationBased/Accounts/User.cs b/examples/AnnotationBased/Accounts/User.cs index 5706ff8..37466b3 100644 --- a/examples/AnnotationBased/Accounts/User.cs +++ b/examples/AnnotationBased/Accounts/User.cs @@ -1,4 +1,4 @@ -using ApolloGraphQL.Federation.HotChocolate; +using ApolloGraphQL.HotChocolate.Federation; namespace Accounts; diff --git a/examples/AnnotationBased/Accounts/packages.lock.json b/examples/AnnotationBased/Accounts/packages.lock.json index 44aeea3..82df759 100644 --- a/examples/AnnotationBased/Accounts/packages.lock.json +++ b/examples/AnnotationBased/Accounts/packages.lock.json @@ -382,7 +382,7 @@ "System.IO.Hashing": "7.0.0" } }, - "apollographql.federation.hotchocolate": { + "ApolloGraphQL.HotChocolate.Federation": { "type": "Project", "dependencies": { "HotChocolate": "[13.5.1, )" diff --git a/examples/AnnotationBased/Inventory/Inventory.csproj b/examples/AnnotationBased/Inventory/Inventory.csproj index ee45a62..515cb4b 100644 --- a/examples/AnnotationBased/Inventory/Inventory.csproj +++ b/examples/AnnotationBased/Inventory/Inventory.csproj @@ -12,7 +12,7 @@ - + diff --git a/examples/AnnotationBased/Inventory/Product.cs b/examples/AnnotationBased/Inventory/Product.cs index 92642a4..6a642e1 100644 --- a/examples/AnnotationBased/Inventory/Product.cs +++ b/examples/AnnotationBased/Inventory/Product.cs @@ -1,4 +1,4 @@ -using ApolloGraphQL.Federation.HotChocolate; +using ApolloGraphQL.HotChocolate.Federation; namespace Inventory; diff --git a/examples/AnnotationBased/Inventory/packages.lock.json b/examples/AnnotationBased/Inventory/packages.lock.json index 44aeea3..82df759 100644 --- a/examples/AnnotationBased/Inventory/packages.lock.json +++ b/examples/AnnotationBased/Inventory/packages.lock.json @@ -382,7 +382,7 @@ "System.IO.Hashing": "7.0.0" } }, - "apollographql.federation.hotchocolate": { + "ApolloGraphQL.HotChocolate.Federation": { "type": "Project", "dependencies": { "HotChocolate": "[13.5.1, )" diff --git a/examples/AnnotationBased/Products/Product.cs b/examples/AnnotationBased/Products/Product.cs index c372846..e1f88a6 100644 --- a/examples/AnnotationBased/Products/Product.cs +++ b/examples/AnnotationBased/Products/Product.cs @@ -1,4 +1,4 @@ -using ApolloGraphQL.Federation.HotChocolate; +using ApolloGraphQL.HotChocolate.Federation; namespace Products; diff --git a/examples/AnnotationBased/Products/Products.csproj b/examples/AnnotationBased/Products/Products.csproj index f02377e..cf7faa5 100644 --- a/examples/AnnotationBased/Products/Products.csproj +++ b/examples/AnnotationBased/Products/Products.csproj @@ -12,7 +12,7 @@ - + diff --git a/examples/AnnotationBased/Products/Program.cs b/examples/AnnotationBased/Products/Program.cs index 82764b7..ec442e1 100644 --- a/examples/AnnotationBased/Products/Program.cs +++ b/examples/AnnotationBased/Products/Program.cs @@ -1,4 +1,4 @@ -using ApolloGraphQL.Federation.HotChocolate; +using ApolloGraphQL.HotChocolate.Federation; var builder = WebApplication.CreateBuilder(args); diff --git a/examples/AnnotationBased/Products/packages.lock.json b/examples/AnnotationBased/Products/packages.lock.json index 44aeea3..82df759 100644 --- a/examples/AnnotationBased/Products/packages.lock.json +++ b/examples/AnnotationBased/Products/packages.lock.json @@ -382,7 +382,7 @@ "System.IO.Hashing": "7.0.0" } }, - "apollographql.federation.hotchocolate": { + "ApolloGraphQL.HotChocolate.Federation": { "type": "Project", "dependencies": { "HotChocolate": "[13.5.1, )" diff --git a/examples/AnnotationBased/Reviews/Product.cs b/examples/AnnotationBased/Reviews/Product.cs index 3148f0a..ba5242a 100644 --- a/examples/AnnotationBased/Reviews/Product.cs +++ b/examples/AnnotationBased/Reviews/Product.cs @@ -1,4 +1,4 @@ -using ApolloGraphQL.Federation.HotChocolate; +using ApolloGraphQL.HotChocolate.Federation; namespace Reviews; diff --git a/examples/AnnotationBased/Reviews/Review.cs b/examples/AnnotationBased/Reviews/Review.cs index 538e0a6..2b3d26e 100644 --- a/examples/AnnotationBased/Reviews/Review.cs +++ b/examples/AnnotationBased/Reviews/Review.cs @@ -1,4 +1,4 @@ -using ApolloGraphQL.Federation.HotChocolate; +using ApolloGraphQL.HotChocolate.Federation; namespace Reviews; diff --git a/examples/AnnotationBased/Reviews/Reviews.csproj b/examples/AnnotationBased/Reviews/Reviews.csproj index 90d8130..b8f71e1 100644 --- a/examples/AnnotationBased/Reviews/Reviews.csproj +++ b/examples/AnnotationBased/Reviews/Reviews.csproj @@ -12,6 +12,6 @@ - + diff --git a/examples/AnnotationBased/Reviews/User.cs b/examples/AnnotationBased/Reviews/User.cs index c0d54c4..d32ce1a 100644 --- a/examples/AnnotationBased/Reviews/User.cs +++ b/examples/AnnotationBased/Reviews/User.cs @@ -1,4 +1,4 @@ -using ApolloGraphQL.Federation.HotChocolate; +using ApolloGraphQL.HotChocolate.Federation; namespace Reviews; diff --git a/examples/AnnotationBased/Reviews/packages.lock.json b/examples/AnnotationBased/Reviews/packages.lock.json index 44aeea3..82df759 100644 --- a/examples/AnnotationBased/Reviews/packages.lock.json +++ b/examples/AnnotationBased/Reviews/packages.lock.json @@ -382,7 +382,7 @@ "System.IO.Hashing": "7.0.0" } }, - "apollographql.federation.hotchocolate": { + "ApolloGraphQL.HotChocolate.Federation": { "type": "Project", "dependencies": { "HotChocolate": "[13.5.1, )" diff --git a/examples/CodeFirst/Accounts/Accounts.csproj b/examples/CodeFirst/Accounts/Accounts.csproj index ae224d6..1afb6af 100644 --- a/examples/CodeFirst/Accounts/Accounts.csproj +++ b/examples/CodeFirst/Accounts/Accounts.csproj @@ -12,7 +12,7 @@ - + diff --git a/examples/CodeFirst/Accounts/packages.lock.json b/examples/CodeFirst/Accounts/packages.lock.json index 44aeea3..82df759 100644 --- a/examples/CodeFirst/Accounts/packages.lock.json +++ b/examples/CodeFirst/Accounts/packages.lock.json @@ -382,7 +382,7 @@ "System.IO.Hashing": "7.0.0" } }, - "apollographql.federation.hotchocolate": { + "ApolloGraphQL.HotChocolate.Federation": { "type": "Project", "dependencies": { "HotChocolate": "[13.5.1, )" diff --git a/examples/CodeFirst/Inventory/Inventory.csproj b/examples/CodeFirst/Inventory/Inventory.csproj index ee45a62..515cb4b 100644 --- a/examples/CodeFirst/Inventory/Inventory.csproj +++ b/examples/CodeFirst/Inventory/Inventory.csproj @@ -12,7 +12,7 @@ - + diff --git a/examples/CodeFirst/Inventory/packages.lock.json b/examples/CodeFirst/Inventory/packages.lock.json index 44aeea3..82df759 100644 --- a/examples/CodeFirst/Inventory/packages.lock.json +++ b/examples/CodeFirst/Inventory/packages.lock.json @@ -382,7 +382,7 @@ "System.IO.Hashing": "7.0.0" } }, - "apollographql.federation.hotchocolate": { + "ApolloGraphQL.HotChocolate.Federation": { "type": "Project", "dependencies": { "HotChocolate": "[13.5.1, )" diff --git a/examples/CodeFirst/Products/Products.csproj b/examples/CodeFirst/Products/Products.csproj index f02377e..cf7faa5 100644 --- a/examples/CodeFirst/Products/Products.csproj +++ b/examples/CodeFirst/Products/Products.csproj @@ -12,7 +12,7 @@ - + diff --git a/examples/CodeFirst/Products/packages.lock.json b/examples/CodeFirst/Products/packages.lock.json index 44aeea3..82df759 100644 --- a/examples/CodeFirst/Products/packages.lock.json +++ b/examples/CodeFirst/Products/packages.lock.json @@ -382,7 +382,7 @@ "System.IO.Hashing": "7.0.0" } }, - "apollographql.federation.hotchocolate": { + "ApolloGraphQL.HotChocolate.Federation": { "type": "Project", "dependencies": { "HotChocolate": "[13.5.1, )" diff --git a/examples/CodeFirst/Reviews/Reviews.csproj b/examples/CodeFirst/Reviews/Reviews.csproj index 4705013..3dcc1fc 100644 --- a/examples/CodeFirst/Reviews/Reviews.csproj +++ b/examples/CodeFirst/Reviews/Reviews.csproj @@ -12,7 +12,7 @@ - + diff --git a/examples/CodeFirst/Reviews/packages.lock.json b/examples/CodeFirst/Reviews/packages.lock.json index 44aeea3..82df759 100644 --- a/examples/CodeFirst/Reviews/packages.lock.json +++ b/examples/CodeFirst/Reviews/packages.lock.json @@ -382,7 +382,7 @@ "System.IO.Hashing": "7.0.0" } }, - "apollographql.federation.hotchocolate": { + "ApolloGraphQL.HotChocolate.Federation": { "type": "Project", "dependencies": { "HotChocolate": "[13.5.1, )" diff --git a/src/Federation/AnyType.cs b/src/Federation/AnyType.cs index a694532..6afa6c4 100644 --- a/src/Federation/AnyType.cs +++ b/src/Federation/AnyType.cs @@ -1,11 +1,11 @@ using System.Linq; -using ApolloGraphQL.Federation.HotChocolate.Constants; -using ApolloGraphQL.Federation.HotChocolate.Properties; +using ApolloGraphQL.HotChocolate.Federation.Constants; +using ApolloGraphQL.HotChocolate.Federation.Properties; using HotChocolate.Language; using HotChocolate.Utilities; -using static ApolloGraphQL.Federation.HotChocolate.ThrowHelper; +using static ApolloGraphQL.HotChocolate.Federation.ThrowHelper; -namespace ApolloGraphQL.Federation.HotChocolate; +namespace ApolloGraphQL.HotChocolate.Federation; /// /// The _Any scalar is used to pass representations of entities diff --git a/src/Federation/ApolloGraphQL.Federation.HotChocolate.csproj b/src/Federation/ApolloGraphQL.HotChocolate.Federation.csproj similarity index 80% rename from src/Federation/ApolloGraphQL.Federation.HotChocolate.csproj rename to src/Federation/ApolloGraphQL.HotChocolate.Federation.csproj index c61b5e8..85a175e 100644 --- a/src/Federation/ApolloGraphQL.Federation.HotChocolate.csproj +++ b/src/Federation/ApolloGraphQL.HotChocolate.Federation.csproj @@ -2,15 +2,15 @@ net7.0; net6.0 - ApolloGraphQL.Federation.HotChocolate - ApolloGraphQL.Federation.HotChocolate - ApolloGraphQL.Federation.HotChocolate + ApolloGraphQL.HotChocolate.Federation + ApolloGraphQL.HotChocolate.Federation + ApolloGraphQL.HotChocolate.Federation Apollo Federation Subgraph support for HotChocolate. README.md - + diff --git a/src/Federation/Constants/WellKnownArgumentNames.cs b/src/Federation/Constants/WellKnownArgumentNames.cs index 6394535..ac435de 100644 --- a/src/Federation/Constants/WellKnownArgumentNames.cs +++ b/src/Federation/Constants/WellKnownArgumentNames.cs @@ -1,4 +1,4 @@ -namespace ApolloGraphQL.Federation.HotChocolate.Constants; +namespace ApolloGraphQL.HotChocolate.Federation.Constants; internal static class WellKnownArgumentNames { diff --git a/src/Federation/Constants/WellKnownContextData.cs b/src/Federation/Constants/WellKnownContextData.cs index 74d2e5a..13a43ab 100644 --- a/src/Federation/Constants/WellKnownContextData.cs +++ b/src/Federation/Constants/WellKnownContextData.cs @@ -1,11 +1,11 @@ -namespace ApolloGraphQL.Federation.HotChocolate.Constants; +namespace ApolloGraphQL.HotChocolate.Federation.Constants; internal static class WellKnownContextData { - public const string KeyMarker = "ApolloGraphQL.Federation.HotChocolate.Key"; - public const string ExtendMarker = "ApolloGraphQL.Federation.HotChocolate.Extend"; - public const string ExternalSetter = "ApolloGraphQL.Federation.HotChocolate.ExternalSetter"; - public const string EntityResolver = "ApolloGraphQL.Federation.HotChocolate.EntityResolver"; + public const string KeyMarker = "ApolloGraphQL.HotChocolate.Federation.Key"; + public const string ExtendMarker = "ApolloGraphQL.HotChocolate.Federation.Extend"; + public const string ExternalSetter = "ApolloGraphQL.HotChocolate.Federation.ExternalSetter"; + public const string EntityResolver = "ApolloGraphQL.HotChocolate.Federation.EntityResolver"; public const string DataField = "data"; public const string TypeField = "__type"; } diff --git a/src/Federation/Constants/WellKnownFieldNames.cs b/src/Federation/Constants/WellKnownFieldNames.cs index 2083b73..3213ec1 100644 --- a/src/Federation/Constants/WellKnownFieldNames.cs +++ b/src/Federation/Constants/WellKnownFieldNames.cs @@ -1,4 +1,4 @@ -namespace ApolloGraphQL.Federation.HotChocolate.Constants; +namespace ApolloGraphQL.HotChocolate.Federation.Constants; internal static class WellKnownFieldNames { diff --git a/src/Federation/Constants/WellKnownTypeNames.cs b/src/Federation/Constants/WellKnownTypeNames.cs index 24eae9d..62b1dc9 100644 --- a/src/Federation/Constants/WellKnownTypeNames.cs +++ b/src/Federation/Constants/WellKnownTypeNames.cs @@ -1,7 +1,8 @@ -namespace ApolloGraphQL.Federation.HotChocolate.Constants; +namespace ApolloGraphQL.HotChocolate.Federation.Constants; internal static class WellKnownTypeNames { + public const string Extends = "extends"; public const string External = "external"; public const string Requires = "requires"; public const string Provides = "provides"; diff --git a/src/Federation/Descriptors/EntityResolverDefinition.cs b/src/Federation/Descriptors/EntityResolverDefinition.cs index 5e4b39a..fb740d2 100644 --- a/src/Federation/Descriptors/EntityResolverDefinition.cs +++ b/src/Federation/Descriptors/EntityResolverDefinition.cs @@ -1,6 +1,6 @@ using HotChocolate.Types.Descriptors.Definitions; -namespace ApolloGraphQL.Federation.HotChocolate.Descriptors; +namespace ApolloGraphQL.HotChocolate.Federation.Descriptors; /// /// The entity definition allows to specify a reference resolver. diff --git a/src/Federation/Descriptors/EntityResolverDescriptor.cs b/src/Federation/Descriptors/EntityResolverDescriptor.cs index 9fae74c..d5dddca 100644 --- a/src/Federation/Descriptors/EntityResolverDescriptor.cs +++ b/src/Federation/Descriptors/EntityResolverDescriptor.cs @@ -1,16 +1,16 @@ using System.Collections.Generic; using System.Linq.Expressions; using System.Reflection; -using ApolloGraphQL.Federation.HotChocolate.Helpers; -using ApolloGraphQL.Federation.HotChocolate.Properties; +using ApolloGraphQL.HotChocolate.Federation.Helpers; +using ApolloGraphQL.HotChocolate.Federation.Properties; using HotChocolate.Internal; using HotChocolate.Resolvers; using HotChocolate.Types.Descriptors; using HotChocolate.Types.Descriptors.Definitions; using HotChocolate.Utilities; -using static ApolloGraphQL.Federation.HotChocolate.Constants.WellKnownContextData; +using static ApolloGraphQL.HotChocolate.Federation.Constants.WellKnownContextData; -namespace ApolloGraphQL.Federation.HotChocolate.Descriptors; +namespace ApolloGraphQL.HotChocolate.Federation.Descriptors; /// /// The entity descriptor allows to specify a reference resolver. diff --git a/src/Federation/Descriptors/IEntityResolverDescriptor.cs b/src/Federation/Descriptors/IEntityResolverDescriptor.cs index 6ac4346..2e6758a 100644 --- a/src/Federation/Descriptors/IEntityResolverDescriptor.cs +++ b/src/Federation/Descriptors/IEntityResolverDescriptor.cs @@ -2,7 +2,7 @@ using System.Reflection; using HotChocolate.Resolvers; -namespace ApolloGraphQL.Federation.HotChocolate.Descriptors; +namespace ApolloGraphQL.HotChocolate.Federation.Descriptors; /// /// The entity descriptor allows to specify a reference resolver. diff --git a/src/Federation/Descriptors/ReferenceResolverDefinition.cs b/src/Federation/Descriptors/ReferenceResolverDefinition.cs index 01c806e..5dfa60f 100644 --- a/src/Federation/Descriptors/ReferenceResolverDefinition.cs +++ b/src/Federation/Descriptors/ReferenceResolverDefinition.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using HotChocolate.Resolvers; -namespace ApolloGraphQL.Federation.HotChocolate.Descriptors; +namespace ApolloGraphQL.HotChocolate.Federation.Descriptors; /// /// A reference resolver definition. diff --git a/src/Federation/EntityType.cs b/src/Federation/EntityType.cs index 09a1265..459f41b 100644 --- a/src/Federation/EntityType.cs +++ b/src/Federation/EntityType.cs @@ -1,7 +1,7 @@ -using ApolloGraphQL.Federation.HotChocolate.Properties; -using static ApolloGraphQL.Federation.HotChocolate.Constants.WellKnownTypeNames; +using ApolloGraphQL.HotChocolate.Federation.Properties; +using static ApolloGraphQL.HotChocolate.Federation.Constants.WellKnownTypeNames; -namespace ApolloGraphQL.Federation.HotChocolate; +namespace ApolloGraphQL.HotChocolate.Federation; /// /// A union called _Entity which is a union of all types that use the @key directive, diff --git a/src/Federation/ExtendServiceTypeAttribute.cs b/src/Federation/ExtendServiceTypeAttribute.cs index 811ee7a..70f8227 100644 --- a/src/Federation/ExtendServiceTypeAttribute.cs +++ b/src/Federation/ExtendServiceTypeAttribute.cs @@ -1,6 +1,6 @@ using HotChocolate.Types.Descriptors; -namespace ApolloGraphQL.Federation.HotChocolate; +namespace ApolloGraphQL.HotChocolate.Federation; /// /// This attribute is used to mark types as an extended type @@ -11,6 +11,7 @@ namespace ApolloGraphQL.Federation.HotChocolate; AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface)] +[Obsolete("Use ExtendsAttribute instead")] public sealed class ExtendServiceTypeAttribute : ObjectTypeDescriptorAttribute { protected override void OnConfigure( diff --git a/src/Federation/ExtendsAttribute.cs b/src/Federation/ExtendsAttribute.cs new file mode 100644 index 0000000..1514dfa --- /dev/null +++ b/src/Federation/ExtendsAttribute.cs @@ -0,0 +1,25 @@ +using System.Reflection; +using HotChocolate.Types.Descriptors; + +namespace ApolloGraphQL.HotChocolate.Federation; + +/// +/// Extends directive is used to represent type extensions in the schema. Federated extended types should have +/// corresponding @key directive defined that specifies primary key required to fetch the underlying object. +/// +/// +/// # extended from the Users service +/// type User @extends @key(fields: "email") { +/// email: String @external +/// reviews: [Review] +/// } +/// +/// +public sealed class ExtendsAttribute : ObjectTypeDescriptorAttribute +{ + protected override void OnConfigure( + IDescriptorContext context, + IObjectTypeDescriptor descriptor, + Type type) + => descriptor.ExtendsType(); +} diff --git a/src/Federation/Extensions/ApolloFederationDescriptorExtensions.cs b/src/Federation/Extensions/ApolloFederationDescriptorExtensions.cs index 951d9d4..f2cb578 100644 --- a/src/Federation/Extensions/ApolloFederationDescriptorExtensions.cs +++ b/src/Federation/Extensions/ApolloFederationDescriptorExtensions.cs @@ -1,8 +1,8 @@ -using ApolloGraphQL.Federation.HotChocolate.Constants; -using ApolloGraphQL.Federation.HotChocolate.Descriptors; +using ApolloGraphQL.HotChocolate.Federation.Constants; +using ApolloGraphQL.HotChocolate.Federation.Descriptors; using HotChocolate.Language; -using static ApolloGraphQL.Federation.HotChocolate.Properties.FederationResources; -using static ApolloGraphQL.Federation.HotChocolate.Constants.WellKnownContextData; +using static ApolloGraphQL.HotChocolate.Federation.Properties.FederationResources; +using static ApolloGraphQL.HotChocolate.Federation.Constants.WellKnownContextData; namespace HotChocolate.Types; @@ -210,6 +210,7 @@ public static IObjectFieldDescriptor Provides( /// of a type that is defined by another service when /// using apollo federation. /// + [Obsolete("Use ExtendsType type instead")] public static IObjectTypeDescriptor ExtendServiceType( this IObjectTypeDescriptor descriptor) { @@ -224,4 +225,36 @@ public static IObjectTypeDescriptor ExtendServiceType( return descriptor; } + + /// + /// Adds @extends directive which is used to represent type extensions in the schema. Federated extended types should have + /// corresponding @key directive defined that specifies primary key required to fetch the underlying object. + /// + /// + /// # extended from the Users service + /// type User @extends @key(fields: "email") { + /// email: String @external + /// reviews: [Review] + /// } + /// + /// + /// + /// The object type descriptor on which this directive shall be annotated. + /// + /// + /// Returns the object type descriptor. + /// + /// + /// is null. + /// + public static IObjectTypeDescriptor ExtendsType( + this IObjectTypeDescriptor descriptor) + { + if (descriptor is null) + { + throw new ArgumentNullException(nameof(descriptor)); + } + + return descriptor.Directive(WellKnownTypeNames.Extends); + } } diff --git a/src/Federation/Extensions/ApolloFederationDescriptorExtensions~1.cs b/src/Federation/Extensions/ApolloFederationDescriptorExtensions~1.cs index 7d0df4c..0afe3b9 100644 --- a/src/Federation/Extensions/ApolloFederationDescriptorExtensions~1.cs +++ b/src/Federation/Extensions/ApolloFederationDescriptorExtensions~1.cs @@ -1,8 +1,8 @@ -using ApolloGraphQL.Federation.HotChocolate.Constants; -using ApolloGraphQL.Federation.HotChocolate.Descriptors; +using ApolloGraphQL.HotChocolate.Federation.Constants; +using ApolloGraphQL.HotChocolate.Federation.Descriptors; using HotChocolate.Language; -using static ApolloGraphQL.Federation.HotChocolate.Properties.FederationResources; -using static ApolloGraphQL.Federation.HotChocolate.Constants.WellKnownContextData; +using static ApolloGraphQL.HotChocolate.Federation.Properties.FederationResources; +using static ApolloGraphQL.HotChocolate.Federation.Constants.WellKnownContextData; namespace HotChocolate.Types; @@ -65,6 +65,7 @@ public static IEntityResolverDescriptor Key( /// of a type that is defined by another service when /// using apollo federation. /// + [Obsolete("Use ExtendsType type instead")] public static IObjectTypeDescriptor ExtendServiceType( this IObjectTypeDescriptor descriptor) { diff --git a/src/Federation/Extensions/ApolloFederationSchemaBuilderExtensions.cs b/src/Federation/Extensions/ApolloFederationSchemaBuilderExtensions.cs index 3b2308e..3f0aa5a 100644 --- a/src/Federation/Extensions/ApolloFederationSchemaBuilderExtensions.cs +++ b/src/Federation/Extensions/ApolloFederationSchemaBuilderExtensions.cs @@ -1,5 +1,6 @@ -using ApolloGraphQL.Federation.HotChocolate; -using AnyType = ApolloGraphQL.Federation.HotChocolate.AnyType; +using ApolloGraphQL.HotChocolate.Federation; +using ApolloGraphQL.HotChocolate.Federation.One; +using AnyType = ApolloGraphQL.HotChocolate.Federation.AnyType; namespace HotChocolate; @@ -32,6 +33,7 @@ public static ISchemaBuilder AddApolloFederation( builder.AddType(); builder.AddType(); builder.AddType(); + builder.AddType(); builder.AddType(); builder.AddType(); builder.AddType(); diff --git a/src/Federation/Extensions/DirectiveTypeDescriptorExtensions.cs b/src/Federation/Extensions/DirectiveTypeDescriptorExtensions.cs index 31e118a..f39442e 100644 --- a/src/Federation/Extensions/DirectiveTypeDescriptorExtensions.cs +++ b/src/Federation/Extensions/DirectiveTypeDescriptorExtensions.cs @@ -1,15 +1,16 @@ -using static ApolloGraphQL.Federation.HotChocolate.Constants.WellKnownArgumentNames; +using static ApolloGraphQL.HotChocolate.Federation.Constants.WellKnownArgumentNames; +using FieldSetTypeV1 = ApolloGraphQL.HotChocolate.Federation.One.FieldSetType; -namespace ApolloGraphQL.Federation.HotChocolate; +namespace ApolloGraphQL.HotChocolate.Federation; internal static class DirectiveTypeDescriptorExtensions { - public static IDirectiveTypeDescriptor FieldsArgument( + public static IDirectiveTypeDescriptor FieldsArgumentV1( this IDirectiveTypeDescriptor descriptor) { descriptor .Argument(Fields) - .Type>(); + .Type>(); return descriptor; } diff --git a/src/Federation/ExternalAttribute.cs b/src/Federation/ExternalAttribute.cs index fc49da8..30fbf43 100644 --- a/src/Federation/ExternalAttribute.cs +++ b/src/Federation/ExternalAttribute.cs @@ -1,7 +1,7 @@ using System.Reflection; using HotChocolate.Types.Descriptors; -namespace ApolloGraphQL.Federation.HotChocolate; +namespace ApolloGraphQL.HotChocolate.Federation; /// /// The @external directive is used to mark a field as owned by another service. diff --git a/src/Federation/FederationTypeInterceptor.cs b/src/Federation/FederationTypeInterceptor.cs index f115668..3453749 100644 --- a/src/Federation/FederationTypeInterceptor.cs +++ b/src/Federation/FederationTypeInterceptor.cs @@ -4,18 +4,18 @@ using System.Reflection; using System.Text; using System.Threading.Tasks; -using ApolloGraphQL.Federation.HotChocolate.Constants; -using ApolloGraphQL.Federation.HotChocolate.Descriptors; -using ApolloGraphQL.Federation.HotChocolate.Helpers; +using ApolloGraphQL.HotChocolate.Federation.Constants; +using ApolloGraphQL.HotChocolate.Federation.Descriptors; +using ApolloGraphQL.HotChocolate.Federation.Helpers; using HotChocolate.Configuration; using HotChocolate.Language; using HotChocolate.Resolvers; using HotChocolate.Types.Descriptors; using HotChocolate.Types.Descriptors.Definitions; -using static ApolloGraphQL.Federation.HotChocolate.ThrowHelper; -using static ApolloGraphQL.Federation.HotChocolate.Constants.WellKnownContextData; +using static ApolloGraphQL.HotChocolate.Federation.ThrowHelper; +using static ApolloGraphQL.HotChocolate.Federation.Constants.WellKnownContextData; -namespace ApolloGraphQL.Federation.HotChocolate; +namespace ApolloGraphQL.HotChocolate.Federation; internal sealed class FederationTypeInterceptor : TypeInterceptor { diff --git a/src/Federation/Helpers/ArgumentParser.cs b/src/Federation/Helpers/ArgumentParser.cs index c90c56c..2016895 100644 --- a/src/Federation/Helpers/ArgumentParser.cs +++ b/src/Federation/Helpers/ArgumentParser.cs @@ -3,7 +3,7 @@ using HotChocolate.Language; using HotChocolate.Utilities; -namespace ApolloGraphQL.Federation.HotChocolate.Helpers; +namespace ApolloGraphQL.HotChocolate.Federation.Helpers; /// /// A helper for getting field values from a representation object. diff --git a/src/Federation/Helpers/EntitiesResolver.cs b/src/Federation/Helpers/EntitiesResolver.cs index 01ba78c..daaf7a4 100644 --- a/src/Federation/Helpers/EntitiesResolver.cs +++ b/src/Federation/Helpers/EntitiesResolver.cs @@ -2,9 +2,9 @@ using System.Collections.Generic; using System.Threading.Tasks; using HotChocolate.Resolvers; -using static ApolloGraphQL.Federation.HotChocolate.Constants.WellKnownContextData; +using static ApolloGraphQL.HotChocolate.Federation.Constants.WellKnownContextData; -namespace ApolloGraphQL.Federation.HotChocolate.Helpers; +namespace ApolloGraphQL.HotChocolate.Federation.Helpers; /// /// This class contains the _entities resolver method. diff --git a/src/Federation/Helpers/ExternalSetterExpressionHelper.cs b/src/Federation/Helpers/ExternalSetterExpressionHelper.cs index 293ef45..92f7ed9 100644 --- a/src/Federation/Helpers/ExternalSetterExpressionHelper.cs +++ b/src/Federation/Helpers/ExternalSetterExpressionHelper.cs @@ -1,14 +1,14 @@ using System.Collections.Generic; using System.Linq.Expressions; using System.Reflection; -using ApolloGraphQL.Federation.HotChocolate.Constants; +using ApolloGraphQL.HotChocolate.Federation.Constants; using HotChocolate.Language; using HotChocolate.Types.Descriptors.Definitions; using static System.Linq.Expressions.Expression; using static System.Reflection.BindingFlags; -using static ApolloGraphQL.Federation.HotChocolate.Constants.WellKnownContextData; +using static ApolloGraphQL.HotChocolate.Federation.Constants.WellKnownContextData; -namespace ApolloGraphQL.Federation.HotChocolate.Helpers; +namespace ApolloGraphQL.HotChocolate.Federation.Helpers; /// /// This class contains helpers to genereate external field setters. diff --git a/src/Federation/Helpers/ReferenceResolverArgumentExpressionBuilder.cs b/src/Federation/Helpers/ReferenceResolverArgumentExpressionBuilder.cs index 595b489..470985e 100644 --- a/src/Federation/Helpers/ReferenceResolverArgumentExpressionBuilder.cs +++ b/src/Federation/Helpers/ReferenceResolverArgumentExpressionBuilder.cs @@ -5,9 +5,9 @@ using HotChocolate.Language; using HotChocolate.Resolvers; using HotChocolate.Utilities; -using static ApolloGraphQL.Federation.HotChocolate.Constants.WellKnownContextData; +using static ApolloGraphQL.HotChocolate.Federation.Constants.WellKnownContextData; -namespace ApolloGraphQL.Federation.HotChocolate.Helpers; +namespace ApolloGraphQL.HotChocolate.Federation.Helpers; // TODO IParameterExpressionBuilder : IParameterHandler are part of HotChocolate.Internal package internal class ReferenceResolverArgumentExpressionBuilder : IParameterExpressionBuilder diff --git a/src/Federation/Helpers/ReferenceResolverHelper.cs b/src/Federation/Helpers/ReferenceResolverHelper.cs index c4cfbda..daf7338 100644 --- a/src/Federation/Helpers/ReferenceResolverHelper.cs +++ b/src/Federation/Helpers/ReferenceResolverHelper.cs @@ -2,9 +2,9 @@ using System.Threading.Tasks; using HotChocolate.Language; using HotChocolate.Resolvers; -using static ApolloGraphQL.Federation.HotChocolate.Constants.WellKnownContextData; +using static ApolloGraphQL.HotChocolate.Federation.Constants.WellKnownContextData; -namespace ApolloGraphQL.Federation.HotChocolate.Helpers; +namespace ApolloGraphQL.HotChocolate.Federation.Helpers; /// /// This class provides helpers for the reference resolver expression generators. diff --git a/src/Federation/KeyAttribute.cs b/src/Federation/KeyAttribute.cs index 48027ab..0fa4564 100644 --- a/src/Federation/KeyAttribute.cs +++ b/src/Federation/KeyAttribute.cs @@ -1,7 +1,7 @@ using HotChocolate.Types.Descriptors; -using static ApolloGraphQL.Federation.HotChocolate.ThrowHelper; +using static ApolloGraphQL.HotChocolate.Federation.ThrowHelper; -namespace ApolloGraphQL.Federation.HotChocolate; +namespace ApolloGraphQL.HotChocolate.Federation; /// /// The @key directive is used to indicate a combination of fields that diff --git a/src/Federation/MapAttribute.cs b/src/Federation/MapAttribute.cs index abc955d..450d73b 100644 --- a/src/Federation/MapAttribute.cs +++ b/src/Federation/MapAttribute.cs @@ -1,4 +1,4 @@ -namespace ApolloGraphQL.Federation.HotChocolate; +namespace ApolloGraphQL.HotChocolate.Federation; /// /// Maps an argument to a representation value. diff --git a/src/Federation/One/ExtendsDirectiveType.cs b/src/Federation/One/ExtendsDirectiveType.cs new file mode 100644 index 0000000..b33a092 --- /dev/null +++ b/src/Federation/One/ExtendsDirectiveType.cs @@ -0,0 +1,26 @@ +using ApolloGraphQL.HotChocolate.Federation.Constants; +using ApolloGraphQL.HotChocolate.Federation.Properties; + +namespace ApolloGraphQL.HotChocolate.Federation.One; + +/// +/// The @external directive is used to mark a field as owned by another service. +/// This allows service A to use fields from service B while also knowing at runtime +/// the types of that field. +/// +/// +/// # extended from the Users service +/// extend type User @key(fields: "email") { +/// email: String @external +/// reviews: [Review] +/// } +/// +/// +public sealed class ExtendsDirectiveType : DirectiveType +{ + protected override void Configure(IDirectiveTypeDescriptor descriptor) + => descriptor + .Name(WellKnownTypeNames.Extends) + .Description(FederationResources.ExtendsDirective_Description) + .Location(DirectiveLocation.Object | DirectiveLocation.Interface); +} diff --git a/src/Federation/ExternalDirectiveType.cs b/src/Federation/One/ExternalDirectiveType.cs similarity index 81% rename from src/Federation/ExternalDirectiveType.cs rename to src/Federation/One/ExternalDirectiveType.cs index 555eb1d..73c6f3e 100644 --- a/src/Federation/ExternalDirectiveType.cs +++ b/src/Federation/One/ExternalDirectiveType.cs @@ -1,7 +1,7 @@ -using ApolloGraphQL.Federation.HotChocolate.Constants; -using ApolloGraphQL.Federation.HotChocolate.Properties; +using ApolloGraphQL.HotChocolate.Federation.Constants; +using ApolloGraphQL.HotChocolate.Federation.Properties; -namespace ApolloGraphQL.Federation.HotChocolate; +namespace ApolloGraphQL.HotChocolate.Federation.One; /// /// The @external directive is used to mark a field as owned by another service. diff --git a/src/Federation/FederationSchemaPrinter.DirectiveType.cs b/src/Federation/One/FederationSchemaPrinter.DirectiveType.cs similarity index 95% rename from src/Federation/FederationSchemaPrinter.DirectiveType.cs rename to src/Federation/One/FederationSchemaPrinter.DirectiveType.cs index da6ce62..5161130 100644 --- a/src/Federation/FederationSchemaPrinter.DirectiveType.cs +++ b/src/Federation/One/FederationSchemaPrinter.DirectiveType.cs @@ -3,7 +3,7 @@ using HotChocolate.Language; using DirectiveLocationType = HotChocolate.Types.DirectiveLocation; -namespace ApolloGraphQL.Federation.HotChocolate; +namespace ApolloGraphQL.HotChocolate.Federation.One; public static partial class FederationSchemaPrinter { diff --git a/src/Federation/FederationSchemaPrinter.InputType.cs b/src/Federation/One/FederationSchemaPrinter.InputType.cs similarity index 95% rename from src/Federation/FederationSchemaPrinter.InputType.cs rename to src/Federation/One/FederationSchemaPrinter.InputType.cs index 253b8d6..afc31f2 100644 --- a/src/Federation/FederationSchemaPrinter.InputType.cs +++ b/src/Federation/One/FederationSchemaPrinter.InputType.cs @@ -1,7 +1,7 @@ using System.Linq; using HotChocolate.Language; -namespace ApolloGraphQL.Federation.HotChocolate; +namespace ApolloGraphQL.HotChocolate.Federation.One; public static partial class FederationSchemaPrinter { diff --git a/src/Federation/FederationSchemaPrinter.LeafType.cs b/src/Federation/One/FederationSchemaPrinter.LeafType.cs similarity index 97% rename from src/Federation/FederationSchemaPrinter.LeafType.cs rename to src/Federation/One/FederationSchemaPrinter.LeafType.cs index 073ff7d..0fa0775 100644 --- a/src/Federation/FederationSchemaPrinter.LeafType.cs +++ b/src/Federation/One/FederationSchemaPrinter.LeafType.cs @@ -3,7 +3,7 @@ using HotChocolate.Language; using static HotChocolate.Types.SpecifiedByDirectiveType.Names; -namespace ApolloGraphQL.Federation.HotChocolate; +namespace ApolloGraphQL.HotChocolate.Federation.One; public static partial class FederationSchemaPrinter { diff --git a/src/Federation/FederationSchemaPrinter.OutputTypes.cs b/src/Federation/One/FederationSchemaPrinter.OutputTypes.cs similarity index 98% rename from src/Federation/FederationSchemaPrinter.OutputTypes.cs rename to src/Federation/One/FederationSchemaPrinter.OutputTypes.cs index fa3894e..ce037e8 100644 --- a/src/Federation/FederationSchemaPrinter.OutputTypes.cs +++ b/src/Federation/One/FederationSchemaPrinter.OutputTypes.cs @@ -1,7 +1,7 @@ using System.Linq; using HotChocolate.Language; -namespace ApolloGraphQL.Federation.HotChocolate; +namespace ApolloGraphQL.HotChocolate.Federation.One; public static partial class FederationSchemaPrinter { diff --git a/src/Federation/FederationSchemaPrinter.cs b/src/Federation/One/FederationSchemaPrinter.cs similarity index 96% rename from src/Federation/FederationSchemaPrinter.cs rename to src/Federation/One/FederationSchemaPrinter.cs index 55d34ce..48d4b51 100644 --- a/src/Federation/FederationSchemaPrinter.cs +++ b/src/Federation/One/FederationSchemaPrinter.cs @@ -1,21 +1,22 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; -using ApolloGraphQL.Federation.HotChocolate.Constants; +using ApolloGraphQL.HotChocolate.Federation.Constants; using HotChocolate.Language; using HotChocolate.Types.Introspection; using HotChocolate.Utilities; using HotChocolate.Utilities.Introspection; -namespace ApolloGraphQL.Federation.HotChocolate; +namespace ApolloGraphQL.HotChocolate.Federation.One; /// -/// The apollo federation schema printer. +/// The Apollo Federation schema printer. /// public static partial class FederationSchemaPrinter { private static readonly HashSet _builtInDirectives = new() { + WellKnownTypeNames.Extends, WellKnownTypeNames.External, WellKnownTypeNames.Requires, WellKnownTypeNames.Provides, diff --git a/src/Federation/FieldSetType.cs b/src/Federation/One/FieldSetType.cs similarity index 92% rename from src/Federation/FieldSetType.cs rename to src/Federation/One/FieldSetType.cs index d1b942d..aa916ec 100644 --- a/src/Federation/FieldSetType.cs +++ b/src/Federation/One/FieldSetType.cs @@ -1,9 +1,9 @@ -using ApolloGraphQL.Federation.HotChocolate.Constants; -using ApolloGraphQL.Federation.HotChocolate.Properties; +using ApolloGraphQL.HotChocolate.Federation.Constants; +using ApolloGraphQL.HotChocolate.Federation.Properties; using HotChocolate.Language; -using static ApolloGraphQL.Federation.HotChocolate.ThrowHelper; +using static ApolloGraphQL.HotChocolate.Federation.ThrowHelper; -namespace ApolloGraphQL.Federation.HotChocolate; +namespace ApolloGraphQL.HotChocolate.Federation.One; /// /// A scalar called _FieldSet is a custom scalar type that is used to @@ -47,7 +47,7 @@ protected override SelectionSetNode ParseLiteral(StringValueNode valueSyntax) } catch (SyntaxException) { - throw FieldSet_InvalidFormat(this); + throw FieldSetV1_InvalidFormat(this); } } diff --git a/src/Federation/KeyDirectiveType.cs b/src/Federation/One/KeyDirectiveType.cs similarity index 76% rename from src/Federation/KeyDirectiveType.cs rename to src/Federation/One/KeyDirectiveType.cs index 114869d..778ead9 100644 --- a/src/Federation/KeyDirectiveType.cs +++ b/src/Federation/One/KeyDirectiveType.cs @@ -1,7 +1,7 @@ -using ApolloGraphQL.Federation.HotChocolate.Constants; -using ApolloGraphQL.Federation.HotChocolate.Properties; +using ApolloGraphQL.HotChocolate.Federation.Constants; +using ApolloGraphQL.HotChocolate.Federation.Properties; -namespace ApolloGraphQL.Federation.HotChocolate; +namespace ApolloGraphQL.HotChocolate.Federation.One; /// /// The @key directive is used to indicate a combination of fields that @@ -21,5 +21,5 @@ protected override void Configure(IDirectiveTypeDescriptor descriptor) .Description(FederationResources.KeyDirective_Description) .Location(DirectiveLocation.Object | DirectiveLocation.Interface) .Repeatable() - .FieldsArgument(); + .FieldsArgumentV1(); } diff --git a/src/Federation/ProvidesDirectiveType.cs b/src/Federation/One/ProvidesDirectiveType.cs similarity index 79% rename from src/Federation/ProvidesDirectiveType.cs rename to src/Federation/One/ProvidesDirectiveType.cs index 2be37b5..2c7ddb7 100644 --- a/src/Federation/ProvidesDirectiveType.cs +++ b/src/Federation/One/ProvidesDirectiveType.cs @@ -1,7 +1,7 @@ -using ApolloGraphQL.Federation.HotChocolate.Constants; -using ApolloGraphQL.Federation.HotChocolate.Properties; +using ApolloGraphQL.HotChocolate.Federation.Constants; +using ApolloGraphQL.HotChocolate.Federation.Properties; -namespace ApolloGraphQL.Federation.HotChocolate; +namespace ApolloGraphQL.HotChocolate.Federation.One; /// /// The @provides directive is used to annotate the expected returned fieldset @@ -25,5 +25,5 @@ protected override void Configure(IDirectiveTypeDescriptor descriptor) .Name(WellKnownTypeNames.Provides) .Description(FederationResources.ProvidesDirective_Description) .Location(DirectiveLocation.FieldDefinition) - .FieldsArgument(); + .FieldsArgumentV1(); } diff --git a/src/Federation/RequiresDirectiveType.cs b/src/Federation/One/RequiresDirectiveType.cs similarity index 81% rename from src/Federation/RequiresDirectiveType.cs rename to src/Federation/One/RequiresDirectiveType.cs index fe4d777..2c67ade 100644 --- a/src/Federation/RequiresDirectiveType.cs +++ b/src/Federation/One/RequiresDirectiveType.cs @@ -1,7 +1,7 @@ -using ApolloGraphQL.Federation.HotChocolate.Constants; -using ApolloGraphQL.Federation.HotChocolate.Properties; +using ApolloGraphQL.HotChocolate.Federation.Constants; +using ApolloGraphQL.HotChocolate.Federation.Properties; -namespace ApolloGraphQL.Federation.HotChocolate; +namespace ApolloGraphQL.HotChocolate.Federation.One; /// /// The @requires directive is used to annotate the required input fieldset @@ -25,5 +25,5 @@ protected override void Configure(IDirectiveTypeDescriptor descriptor) .Name(WellKnownTypeNames.Requires) .Description(FederationResources.RequiresDirective_Description) .Location(DirectiveLocation.FieldDefinition) - .FieldsArgument(); + .FieldsArgumentV1(); } diff --git a/src/Federation/Properties/FederationResources.Designer.cs b/src/Federation/Properties/FederationResources.Designer.cs index a9fb147..c9144bc 100644 --- a/src/Federation/Properties/FederationResources.Designer.cs +++ b/src/Federation/Properties/FederationResources.Designer.cs @@ -7,7 +7,7 @@ // //------------------------------------------------------------------------------ -namespace ApolloGraphQL.Federation.HotChocolate.Properties +namespace ApolloGraphQL.HotChocolate.Federation.Properties { using System; @@ -34,7 +34,7 @@ internal static System.Resources.ResourceManager ResourceManager { if (object.Equals(null, resourceMan)) { - System.Resources.ResourceManager temp = new System.Resources.ResourceManager("ApolloGraphQL.Federation.HotChocolate.Properties.FederationResources", typeof(FederationResources).Assembly); + System.Resources.ResourceManager temp = new System.Resources.ResourceManager("ApolloGraphQL.HotChocolate.Federation.Properties.FederationResources", typeof(FederationResources).Assembly); resourceMan = temp; } return resourceMan; @@ -54,6 +54,15 @@ internal static System.Globalization.CultureInfo Culture } } + internal static string ExtendsDirective_Description + { + get + { + return ResourceManager.GetString("ExtendsDirective_Description", resourceCulture); + } + } + + internal static string ExternalDirective_Description { get diff --git a/src/Federation/Properties/FederationResources.resx b/src/Federation/Properties/FederationResources.resx index 5edeea6..c0c2393 100644 --- a/src/Federation/Properties/FederationResources.resx +++ b/src/Federation/Properties/FederationResources.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Directive to indicate that marks target object as extending part of the federated schema. + Directive to indicate that a field is owned by another service, for example via Apollo federation. diff --git a/src/Federation/ProvidesAttribute.cs b/src/Federation/ProvidesAttribute.cs index 0cd3872..4291bae 100644 --- a/src/Federation/ProvidesAttribute.cs +++ b/src/Federation/ProvidesAttribute.cs @@ -1,8 +1,8 @@ using System.Reflection; using HotChocolate.Types.Descriptors; -using static ApolloGraphQL.Federation.HotChocolate.ThrowHelper; +using static ApolloGraphQL.HotChocolate.Federation.ThrowHelper; -namespace ApolloGraphQL.Federation.HotChocolate; +namespace ApolloGraphQL.HotChocolate.Federation; /// /// The @provides directive is used to annotate the expected returned fieldset diff --git a/src/Federation/ReferenceResolverAttribute.cs b/src/Federation/ReferenceResolverAttribute.cs index 60af46d..617341b 100644 --- a/src/Federation/ReferenceResolverAttribute.cs +++ b/src/Federation/ReferenceResolverAttribute.cs @@ -1,8 +1,8 @@ using System.Reflection; -using ApolloGraphQL.Federation.HotChocolate.Descriptors; +using ApolloGraphQL.HotChocolate.Federation.Descriptors; using HotChocolate.Types.Descriptors; -namespace ApolloGraphQL.Federation.HotChocolate; +namespace ApolloGraphQL.HotChocolate.Federation; /// /// The reference resolver enables your gateway's query planner to resolve a particular diff --git a/src/Federation/Representation.cs b/src/Federation/Representation.cs index 2279d97..8bd1e47 100644 --- a/src/Federation/Representation.cs +++ b/src/Federation/Representation.cs @@ -1,7 +1,7 @@ using HotChocolate.Language; using HotChocolate.Utilities; -namespace ApolloGraphQL.Federation.HotChocolate; +namespace ApolloGraphQL.HotChocolate.Federation; /// /// A representation is a blob of data that is supposed to match diff --git a/src/Federation/RequiresAttribute.cs b/src/Federation/RequiresAttribute.cs index 6d13b2a..7bdb91f 100644 --- a/src/Federation/RequiresAttribute.cs +++ b/src/Federation/RequiresAttribute.cs @@ -1,8 +1,8 @@ using System.Reflection; using HotChocolate.Types.Descriptors; -using static ApolloGraphQL.Federation.HotChocolate.ThrowHelper; +using static ApolloGraphQL.HotChocolate.Federation.ThrowHelper; -namespace ApolloGraphQL.Federation.HotChocolate; +namespace ApolloGraphQL.HotChocolate.Federation; /// /// The @requires directive is used to annotate the required input fieldset diff --git a/src/Federation/ServiceType.cs b/src/Federation/ServiceType.cs index e686cf0..92361eb 100644 --- a/src/Federation/ServiceType.cs +++ b/src/Federation/ServiceType.cs @@ -1,7 +1,8 @@ -using ApolloGraphQL.Federation.HotChocolate.Constants; -using ApolloGraphQL.Federation.HotChocolate.Properties; +using ApolloGraphQL.HotChocolate.Federation.Constants; +using ApolloGraphQL.HotChocolate.Federation.One; +using ApolloGraphQL.HotChocolate.Federation.Properties; -namespace ApolloGraphQL.Federation.HotChocolate; +namespace ApolloGraphQL.HotChocolate.Federation; /// /// A new object type called _Service must be created. diff --git a/src/Federation/ThrowHelper.cs b/src/Federation/ThrowHelper.cs index c1184f4..036e255 100644 --- a/src/Federation/ThrowHelper.cs +++ b/src/Federation/ThrowHelper.cs @@ -1,7 +1,8 @@ using System.Reflection; -using static ApolloGraphQL.Federation.HotChocolate.Properties.FederationResources; +using FieldSetTypeV1 = ApolloGraphQL.HotChocolate.Federation.One.FieldSetType; +using static ApolloGraphQL.HotChocolate.Federation.Properties.FederationResources; -namespace ApolloGraphQL.Federation.HotChocolate; +namespace ApolloGraphQL.HotChocolate.Federation; /// /// This helper class provides a central place where we keep our exceptions so @@ -13,8 +14,8 @@ internal static class ThrowHelper /// Either the syntax node is invalid when parsing the literal or the syntax /// node value has an invalid format. /// - public static SerializationException FieldSet_InvalidFormat( - FieldSetType fieldSetType) => + public static SerializationException FieldSetV1_InvalidFormat( + FieldSetTypeV1 fieldSetType) => new SerializationException( ErrorBuilder.New() .SetMessage(ThrowHelper_FieldSet_HasInvalidFormat) diff --git a/test/Federation.Tests/AnyTypeTests.cs b/test/Federation.Tests/AnyTypeTests.cs index 351f399..e1929eb 100644 --- a/test/Federation.Tests/AnyTypeTests.cs +++ b/test/Federation.Tests/AnyTypeTests.cs @@ -1,9 +1,9 @@ -using ApolloGraphQL.Federation.HotChocolate.Constants; +using ApolloGraphQL.HotChocolate.Federation.Constants; using HotChocolate.Language; using HotChocolate.Types; using Xunit; -namespace ApolloGraphQL.Federation.HotChocolate; +namespace ApolloGraphQL.HotChocolate.Federation; public class AnyTypeTests { diff --git a/test/Federation.Tests/ApolloGraphQL.Federation.HotChocolate.Tests.csproj b/test/Federation.Tests/ApolloGraphQL.HotChocolate.Federation.Tests.csproj similarity index 66% rename from test/Federation.Tests/ApolloGraphQL.Federation.HotChocolate.Tests.csproj rename to test/Federation.Tests/ApolloGraphQL.HotChocolate.Federation.Tests.csproj index 621b68c..f890104 100644 --- a/test/Federation.Tests/ApolloGraphQL.Federation.HotChocolate.Tests.csproj +++ b/test/Federation.Tests/ApolloGraphQL.HotChocolate.Federation.Tests.csproj @@ -2,13 +2,13 @@ net7.0 - ApolloGraphQL.Federation.HotChocolate.Tests - ApolloGraphQL.Federation.HotChocolate + ApolloGraphQL.HotChocolate.Federation.Tests + ApolloGraphQL.HotChocolate.Federation - + diff --git a/test/Federation.Tests/CertificationSchema/AnnotationBased/CertificationTests.cs b/test/Federation.Tests/CertificationSchema/AnnotationBased/CertificationTests.cs index 3c30c74..f7773f9 100644 --- a/test/Federation.Tests/CertificationSchema/AnnotationBased/CertificationTests.cs +++ b/test/Federation.Tests/CertificationSchema/AnnotationBased/CertificationTests.cs @@ -7,7 +7,7 @@ using Snapshooter.Xunit; using Xunit; -namespace ApolloGraphQL.Federation.HotChocolate.CertificationSchema.AnnotationBased; +namespace ApolloGraphQL.HotChocolate.Federation.CertificationSchema.AnnotationBased; public class CertificationTests { diff --git a/test/Federation.Tests/CertificationSchema/AnnotationBased/SchemaSetup.cs b/test/Federation.Tests/CertificationSchema/AnnotationBased/SchemaSetup.cs index f52c3f9..c871991 100644 --- a/test/Federation.Tests/CertificationSchema/AnnotationBased/SchemaSetup.cs +++ b/test/Federation.Tests/CertificationSchema/AnnotationBased/SchemaSetup.cs @@ -1,9 +1,9 @@ using System.Threading.Tasks; -using ApolloGraphQL.Federation.HotChocolate.CertificationSchema.AnnotationBased.Types; +using ApolloGraphQL.HotChocolate.Federation.CertificationSchema.AnnotationBased.Types; using HotChocolate.Execution; using Microsoft.Extensions.DependencyInjection; -namespace ApolloGraphQL.Federation.HotChocolate.CertificationSchema.AnnotationBased; +namespace ApolloGraphQL.HotChocolate.Federation.CertificationSchema.AnnotationBased; public static class SchemaSetup { diff --git a/test/Federation.Tests/CertificationSchema/AnnotationBased/Types/Data.cs b/test/Federation.Tests/CertificationSchema/AnnotationBased/Types/Data.cs index f93f216..cad29f1 100644 --- a/test/Federation.Tests/CertificationSchema/AnnotationBased/Types/Data.cs +++ b/test/Federation.Tests/CertificationSchema/AnnotationBased/Types/Data.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace ApolloGraphQL.Federation.HotChocolate.CertificationSchema.AnnotationBased.Types; +namespace ApolloGraphQL.HotChocolate.Federation.CertificationSchema.AnnotationBased.Types; public class Data { diff --git a/test/Federation.Tests/CertificationSchema/AnnotationBased/Types/Product.cs b/test/Federation.Tests/CertificationSchema/AnnotationBased/Types/Product.cs index 5dd2cbc..0df61a4 100644 --- a/test/Federation.Tests/CertificationSchema/AnnotationBased/Types/Product.cs +++ b/test/Federation.Tests/CertificationSchema/AnnotationBased/Types/Product.cs @@ -1,7 +1,7 @@ using System.Linq; using HotChocolate.Types.Relay; -namespace ApolloGraphQL.Federation.HotChocolate.CertificationSchema.AnnotationBased.Types; +namespace ApolloGraphQL.HotChocolate.Federation.CertificationSchema.AnnotationBased.Types; [Key("id")] [Key("sku package")] diff --git a/test/Federation.Tests/CertificationSchema/AnnotationBased/Types/ProductDimension.cs b/test/Federation.Tests/CertificationSchema/AnnotationBased/Types/ProductDimension.cs index ae620f6..47ef1f3 100644 --- a/test/Federation.Tests/CertificationSchema/AnnotationBased/Types/ProductDimension.cs +++ b/test/Federation.Tests/CertificationSchema/AnnotationBased/Types/ProductDimension.cs @@ -1,4 +1,4 @@ -namespace ApolloGraphQL.Federation.HotChocolate.CertificationSchema.AnnotationBased.Types; +namespace ApolloGraphQL.HotChocolate.Federation.CertificationSchema.AnnotationBased.Types; public class ProductDimension { diff --git a/test/Federation.Tests/CertificationSchema/AnnotationBased/Types/ProductVariation.cs b/test/Federation.Tests/CertificationSchema/AnnotationBased/Types/ProductVariation.cs index b5c0665..e7631e3 100644 --- a/test/Federation.Tests/CertificationSchema/AnnotationBased/Types/ProductVariation.cs +++ b/test/Federation.Tests/CertificationSchema/AnnotationBased/Types/ProductVariation.cs @@ -1,6 +1,6 @@ using HotChocolate.Types.Relay; -namespace ApolloGraphQL.Federation.HotChocolate.CertificationSchema.AnnotationBased.Types; +namespace ApolloGraphQL.HotChocolate.Federation.CertificationSchema.AnnotationBased.Types; public class ProductVariation { diff --git a/test/Federation.Tests/CertificationSchema/AnnotationBased/Types/Query.cs b/test/Federation.Tests/CertificationSchema/AnnotationBased/Types/Query.cs index 2b47142..afab89a 100644 --- a/test/Federation.Tests/CertificationSchema/AnnotationBased/Types/Query.cs +++ b/test/Federation.Tests/CertificationSchema/AnnotationBased/Types/Query.cs @@ -1,7 +1,7 @@ using System.Linq; using HotChocolate.Types.Relay; -namespace ApolloGraphQL.Federation.HotChocolate.CertificationSchema.AnnotationBased.Types; +namespace ApolloGraphQL.HotChocolate.Federation.CertificationSchema.AnnotationBased.Types; [ExtendServiceType] public class Query diff --git a/test/Federation.Tests/CertificationSchema/AnnotationBased/Types/User.cs b/test/Federation.Tests/CertificationSchema/AnnotationBased/Types/User.cs index 9a74b16..2631f9a 100644 --- a/test/Federation.Tests/CertificationSchema/AnnotationBased/Types/User.cs +++ b/test/Federation.Tests/CertificationSchema/AnnotationBased/Types/User.cs @@ -1,6 +1,6 @@ using HotChocolate.Types.Relay; -namespace ApolloGraphQL.Federation.HotChocolate.CertificationSchema.AnnotationBased.Types; +namespace ApolloGraphQL.HotChocolate.Federation.CertificationSchema.AnnotationBased.Types; [Key("email")] [ExtendServiceType] diff --git a/test/Federation.Tests/CertificationSchema/AnnotationBased/__snapshots__/CertificationTests.Schema_Snapshot.snap b/test/Federation.Tests/CertificationSchema/AnnotationBased/__snapshots__/CertificationTests.Schema_Snapshot.snap index 074088f..47a0a55 100644 --- a/test/Federation.Tests/CertificationSchema/AnnotationBased/__snapshots__/CertificationTests.Schema_Snapshot.snap +++ b/test/Federation.Tests/CertificationSchema/AnnotationBased/__snapshots__/CertificationTests.Schema_Snapshot.snap @@ -39,6 +39,9 @@ type _Service { "Union of all types that key directive applied. This information is needed by the Apollo federation gateway." union _Entity = Product | User +"Directive to indicate that marks target object as extending part of the federated schema." +directive @extends on OBJECT | INTERFACE + "Directive to indicate that a field is owned by another service, for example via Apollo federation." directive @external on FIELD_DEFINITION diff --git a/test/Federation.Tests/CertificationSchema/CodeFirst/CertificationTests.cs b/test/Federation.Tests/CertificationSchema/CodeFirst/CertificationTests.cs index d352546..43ac952 100644 --- a/test/Federation.Tests/CertificationSchema/CodeFirst/CertificationTests.cs +++ b/test/Federation.Tests/CertificationSchema/CodeFirst/CertificationTests.cs @@ -7,7 +7,7 @@ using Snapshooter.Xunit; using Xunit; -namespace ApolloGraphQL.Federation.HotChocolate.CertificationSchema.CodeFirst; +namespace ApolloGraphQL.HotChocolate.Federation.CertificationSchema.CodeFirst; public class CertificationTests { diff --git a/test/Federation.Tests/CertificationSchema/CodeFirst/SchemaSetup.cs b/test/Federation.Tests/CertificationSchema/CodeFirst/SchemaSetup.cs index 96d673b..cf3cad6 100644 --- a/test/Federation.Tests/CertificationSchema/CodeFirst/SchemaSetup.cs +++ b/test/Federation.Tests/CertificationSchema/CodeFirst/SchemaSetup.cs @@ -1,9 +1,9 @@ using System.Threading.Tasks; -using ApolloGraphQL.Federation.HotChocolate.CertificationSchema.CodeFirst.Types; +using ApolloGraphQL.HotChocolate.Federation.CertificationSchema.CodeFirst.Types; using HotChocolate.Execution; using Microsoft.Extensions.DependencyInjection; -namespace ApolloGraphQL.Federation.HotChocolate.CertificationSchema.CodeFirst; +namespace ApolloGraphQL.HotChocolate.Federation.CertificationSchema.CodeFirst; public static class SchemaSetup { diff --git a/test/Federation.Tests/CertificationSchema/CodeFirst/Types/Data.cs b/test/Federation.Tests/CertificationSchema/CodeFirst/Types/Data.cs index d1924bf..3b967f8 100644 --- a/test/Federation.Tests/CertificationSchema/CodeFirst/Types/Data.cs +++ b/test/Federation.Tests/CertificationSchema/CodeFirst/Types/Data.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace ApolloGraphQL.Federation.HotChocolate.CertificationSchema.CodeFirst.Types; +namespace ApolloGraphQL.HotChocolate.Federation.CertificationSchema.CodeFirst.Types; public class Data { diff --git a/test/Federation.Tests/CertificationSchema/CodeFirst/Types/Product.cs b/test/Federation.Tests/CertificationSchema/CodeFirst/Types/Product.cs index e172c00..00c6f9a 100644 --- a/test/Federation.Tests/CertificationSchema/CodeFirst/Types/Product.cs +++ b/test/Federation.Tests/CertificationSchema/CodeFirst/Types/Product.cs @@ -1,4 +1,4 @@ -namespace ApolloGraphQL.Federation.HotChocolate.CertificationSchema.CodeFirst.Types; +namespace ApolloGraphQL.HotChocolate.Federation.CertificationSchema.CodeFirst.Types; public class Product { diff --git a/test/Federation.Tests/CertificationSchema/CodeFirst/Types/ProductDimension.cs b/test/Federation.Tests/CertificationSchema/CodeFirst/Types/ProductDimension.cs index 78fec4f..de335cb 100644 --- a/test/Federation.Tests/CertificationSchema/CodeFirst/Types/ProductDimension.cs +++ b/test/Federation.Tests/CertificationSchema/CodeFirst/Types/ProductDimension.cs @@ -1,4 +1,4 @@ -namespace ApolloGraphQL.Federation.HotChocolate.CertificationSchema.CodeFirst.Types; +namespace ApolloGraphQL.HotChocolate.Federation.CertificationSchema.CodeFirst.Types; public class ProductDimension { diff --git a/test/Federation.Tests/CertificationSchema/CodeFirst/Types/ProductType.cs b/test/Federation.Tests/CertificationSchema/CodeFirst/Types/ProductType.cs index b15a807..074d41e 100644 --- a/test/Federation.Tests/CertificationSchema/CodeFirst/Types/ProductType.cs +++ b/test/Federation.Tests/CertificationSchema/CodeFirst/Types/ProductType.cs @@ -1,7 +1,7 @@ using System.Linq; using HotChocolate.Types; -namespace ApolloGraphQL.Federation.HotChocolate.CertificationSchema.CodeFirst.Types; +namespace ApolloGraphQL.HotChocolate.Federation.CertificationSchema.CodeFirst.Types; public class ProductType : ObjectType { diff --git a/test/Federation.Tests/CertificationSchema/CodeFirst/Types/ProductVariation.cs b/test/Federation.Tests/CertificationSchema/CodeFirst/Types/ProductVariation.cs index a456509..7b98fbd 100644 --- a/test/Federation.Tests/CertificationSchema/CodeFirst/Types/ProductVariation.cs +++ b/test/Federation.Tests/CertificationSchema/CodeFirst/Types/ProductVariation.cs @@ -1,6 +1,6 @@ using HotChocolate.Types.Relay; -namespace ApolloGraphQL.Federation.HotChocolate.CertificationSchema.CodeFirst.Types; +namespace ApolloGraphQL.HotChocolate.Federation.CertificationSchema.CodeFirst.Types; public class ProductVariation { diff --git a/test/Federation.Tests/CertificationSchema/CodeFirst/Types/QueryType.cs b/test/Federation.Tests/CertificationSchema/CodeFirst/Types/QueryType.cs index 541909f..7f000d5 100644 --- a/test/Federation.Tests/CertificationSchema/CodeFirst/Types/QueryType.cs +++ b/test/Federation.Tests/CertificationSchema/CodeFirst/Types/QueryType.cs @@ -1,7 +1,7 @@ using System.Linq; using HotChocolate.Types; -namespace ApolloGraphQL.Federation.HotChocolate.CertificationSchema.CodeFirst.Types; +namespace ApolloGraphQL.HotChocolate.Federation.CertificationSchema.CodeFirst.Types; public class QueryType : ObjectType { diff --git a/test/Federation.Tests/CertificationSchema/CodeFirst/Types/User.cs b/test/Federation.Tests/CertificationSchema/CodeFirst/Types/User.cs index 9b78fd2..c855842 100644 --- a/test/Federation.Tests/CertificationSchema/CodeFirst/Types/User.cs +++ b/test/Federation.Tests/CertificationSchema/CodeFirst/Types/User.cs @@ -1,6 +1,6 @@ using HotChocolate.Types.Relay; -namespace ApolloGraphQL.Federation.HotChocolate.CertificationSchema.CodeFirst.Types; +namespace ApolloGraphQL.HotChocolate.Federation.CertificationSchema.CodeFirst.Types; public class User { diff --git a/test/Federation.Tests/CertificationSchema/CodeFirst/Types/UserType.cs b/test/Federation.Tests/CertificationSchema/CodeFirst/Types/UserType.cs index 916f010..2b82e3a 100644 --- a/test/Federation.Tests/CertificationSchema/CodeFirst/Types/UserType.cs +++ b/test/Federation.Tests/CertificationSchema/CodeFirst/Types/UserType.cs @@ -1,6 +1,6 @@ using HotChocolate.Types; -namespace ApolloGraphQL.Federation.HotChocolate.CertificationSchema.CodeFirst.Types; +namespace ApolloGraphQL.HotChocolate.Federation.CertificationSchema.CodeFirst.Types; public class UserType : ObjectType { diff --git a/test/Federation.Tests/CertificationSchema/CodeFirst/__snapshots__/CertificationTests.Schema_Snapshot.snap b/test/Federation.Tests/CertificationSchema/CodeFirst/__snapshots__/CertificationTests.Schema_Snapshot.snap index 2f2d931..fe58770 100644 --- a/test/Federation.Tests/CertificationSchema/CodeFirst/__snapshots__/CertificationTests.Schema_Snapshot.snap +++ b/test/Federation.Tests/CertificationSchema/CodeFirst/__snapshots__/CertificationTests.Schema_Snapshot.snap @@ -39,6 +39,9 @@ type _Service { "Union of all types that key directive applied. This information is needed by the Apollo federation gateway." union _Entity = Product | User +"Directive to indicate that marks target object as extending part of the federated schema." +directive @extends on OBJECT | INTERFACE + "Directive to indicate that a field is owned by another service, for example via Apollo federation." directive @external on FIELD_DEFINITION diff --git a/test/Federation.Tests/Directives/ExternalDirectiveTests.cs b/test/Federation.Tests/Directives/ExternalDirectiveTests.cs index 5fd3b81..dba2335 100644 --- a/test/Federation.Tests/Directives/ExternalDirectiveTests.cs +++ b/test/Federation.Tests/Directives/ExternalDirectiveTests.cs @@ -1,11 +1,12 @@ using System.Linq; -using ApolloGraphQL.Federation.HotChocolate.Constants; +using ApolloGraphQL.HotChocolate.Federation.Constants; +using ApolloGraphQL.HotChocolate.Federation.One; using HotChocolate; using HotChocolate.Types; using HotChocolate.Utilities; using Snapshooter.Xunit; -namespace ApolloGraphQL.Federation.HotChocolate.Directives; +namespace ApolloGraphQL.HotChocolate.Federation.Directives; public class ExternalDirectiveTests : FederationTypesTestBase { diff --git a/test/Federation.Tests/Directives/KeyDirectiveTests.cs b/test/Federation.Tests/Directives/KeyDirectiveTests.cs index b4c559c..8e06ac2 100644 --- a/test/Federation.Tests/Directives/KeyDirectiveTests.cs +++ b/test/Federation.Tests/Directives/KeyDirectiveTests.cs @@ -1,11 +1,12 @@ using System.Linq; -using ApolloGraphQL.Federation.HotChocolate.Constants; +using ApolloGraphQL.HotChocolate.Federation.Constants; +using ApolloGraphQL.HotChocolate.Federation.One; using HotChocolate; using HotChocolate.Types; using HotChocolate.Utilities; using Snapshooter.Xunit; -namespace ApolloGraphQL.Federation.HotChocolate.Directives; +namespace ApolloGraphQL.HotChocolate.Federation.Directives; public class KeyDirectiveTests : FederationTypesTestBase { diff --git a/test/Federation.Tests/Directives/ProvidesDirectiveTests.cs b/test/Federation.Tests/Directives/ProvidesDirectiveTests.cs index 62a31e6..e27803a 100644 --- a/test/Federation.Tests/Directives/ProvidesDirectiveTests.cs +++ b/test/Federation.Tests/Directives/ProvidesDirectiveTests.cs @@ -1,11 +1,12 @@ using System.Linq; -using ApolloGraphQL.Federation.HotChocolate.Constants; +using ApolloGraphQL.HotChocolate.Federation.Constants; +using ApolloGraphQL.HotChocolate.Federation.One; using HotChocolate; using HotChocolate.Types; using HotChocolate.Utilities; using Snapshooter.Xunit; -namespace ApolloGraphQL.Federation.HotChocolate.Directives; +namespace ApolloGraphQL.HotChocolate.Federation.Directives; public class ProvidesDirectiveTests : FederationTypesTestBase { diff --git a/test/Federation.Tests/Directives/RequiresDirectiveTests.cs b/test/Federation.Tests/Directives/RequiresDirectiveTests.cs index 0eb978e..f706ab5 100644 --- a/test/Federation.Tests/Directives/RequiresDirectiveTests.cs +++ b/test/Federation.Tests/Directives/RequiresDirectiveTests.cs @@ -1,11 +1,12 @@ using System.Linq; -using ApolloGraphQL.Federation.HotChocolate.Constants; +using ApolloGraphQL.HotChocolate.Federation.Constants; +using ApolloGraphQL.HotChocolate.Federation.One; using HotChocolate; using HotChocolate.Types; using HotChocolate.Utilities; using Snapshooter.Xunit; -namespace ApolloGraphQL.Federation.HotChocolate.Directives; +namespace ApolloGraphQL.HotChocolate.Federation.Directives; public class RequiresDirectiveTests : FederationTypesTestBase { diff --git a/test/Federation.Tests/Directives/__snapshots__/ExternalDirectiveTests.AnnotateExternalToTypeFieldPureCodeFirst.snap b/test/Federation.Tests/Directives/__snapshots__/ExternalDirectiveTests.AnnotateExternalToTypeFieldPureCodeFirst.snap index 9a53253..b650381 100644 --- a/test/Federation.Tests/Directives/__snapshots__/ExternalDirectiveTests.AnnotateExternalToTypeFieldPureCodeFirst.snap +++ b/test/Federation.Tests/Directives/__snapshots__/ExternalDirectiveTests.AnnotateExternalToTypeFieldPureCodeFirst.snap @@ -21,6 +21,9 @@ type _Service { "Union of all types that key directive applied. This information is needed by the Apollo federation gateway." union _Entity = User +"Directive to indicate that marks target object as extending part of the federated schema." +directive @extends on OBJECT | INTERFACE + "Directive to indicate that a field is owned by another service, for example via Apollo federation." directive @external on FIELD_DEFINITION diff --git a/test/Federation.Tests/Directives/__snapshots__/KeyDirectiveTests.AnnotateKeyToClassAttributePureCodeFirst.snap b/test/Federation.Tests/Directives/__snapshots__/KeyDirectiveTests.AnnotateKeyToClassAttributePureCodeFirst.snap index c55357b..fdd2816 100644 --- a/test/Federation.Tests/Directives/__snapshots__/KeyDirectiveTests.AnnotateKeyToClassAttributePureCodeFirst.snap +++ b/test/Federation.Tests/Directives/__snapshots__/KeyDirectiveTests.AnnotateKeyToClassAttributePureCodeFirst.snap @@ -20,6 +20,9 @@ type _Service { "Union of all types that key directive applied. This information is needed by the Apollo federation gateway." union _Entity = TestTypePropertyDirective +"Directive to indicate that marks target object as extending part of the federated schema." +directive @extends on OBJECT | INTERFACE + "Directive to indicate that a field is owned by another service, for example via Apollo federation." directive @external on FIELD_DEFINITION diff --git a/test/Federation.Tests/Directives/__snapshots__/KeyDirectiveTests.AnnotateKeyToClassAttributesPureCodeFirst.snap b/test/Federation.Tests/Directives/__snapshots__/KeyDirectiveTests.AnnotateKeyToClassAttributesPureCodeFirst.snap index 288d99d..0451516 100644 --- a/test/Federation.Tests/Directives/__snapshots__/KeyDirectiveTests.AnnotateKeyToClassAttributesPureCodeFirst.snap +++ b/test/Federation.Tests/Directives/__snapshots__/KeyDirectiveTests.AnnotateKeyToClassAttributesPureCodeFirst.snap @@ -21,6 +21,9 @@ type _Service { "Union of all types that key directive applied. This information is needed by the Apollo federation gateway." union _Entity = TestTypePropertyDirectives +"Directive to indicate that marks target object as extending part of the federated schema." +directive @extends on OBJECT | INTERFACE + "Directive to indicate that a field is owned by another service, for example via Apollo federation." directive @external on FIELD_DEFINITION diff --git a/test/Federation.Tests/Directives/__snapshots__/KeyDirectiveTests.AnnotateKeyToObjectTypePureCodeFirst.snap b/test/Federation.Tests/Directives/__snapshots__/KeyDirectiveTests.AnnotateKeyToObjectTypePureCodeFirst.snap index 467ac77..e74f8f6 100644 --- a/test/Federation.Tests/Directives/__snapshots__/KeyDirectiveTests.AnnotateKeyToObjectTypePureCodeFirst.snap +++ b/test/Federation.Tests/Directives/__snapshots__/KeyDirectiveTests.AnnotateKeyToObjectTypePureCodeFirst.snap @@ -20,6 +20,9 @@ type _Service { "Union of all types that key directive applied. This information is needed by the Apollo federation gateway." union _Entity = TestTypeClassDirective +"Directive to indicate that marks target object as extending part of the federated schema." +directive @extends on OBJECT | INTERFACE + "Directive to indicate that a field is owned by another service, for example via Apollo federation." directive @external on FIELD_DEFINITION diff --git a/test/Federation.Tests/Directives/__snapshots__/ProvidesDirectiveTests.AnnotateProvidesToClassAttributePureCodeFirst.snap b/test/Federation.Tests/Directives/__snapshots__/ProvidesDirectiveTests.AnnotateProvidesToClassAttributePureCodeFirst.snap index 552813e..2aedee1 100644 --- a/test/Federation.Tests/Directives/__snapshots__/ProvidesDirectiveTests.AnnotateProvidesToClassAttributePureCodeFirst.snap +++ b/test/Federation.Tests/Directives/__snapshots__/ProvidesDirectiveTests.AnnotateProvidesToClassAttributePureCodeFirst.snap @@ -25,6 +25,9 @@ type _Service { "Union of all types that key directive applied. This information is needed by the Apollo federation gateway." union _Entity = Review +"Directive to indicate that marks target object as extending part of the federated schema." +directive @extends on OBJECT | INTERFACE + "Directive to indicate that a field is owned by another service, for example via Apollo federation." directive @external on FIELD_DEFINITION diff --git a/test/Federation.Tests/Directives/__snapshots__/RequiresDirectiveTests.AnnotateProvidesToClassAttributePureCodeFirst.snap b/test/Federation.Tests/Directives/__snapshots__/RequiresDirectiveTests.AnnotateProvidesToClassAttributePureCodeFirst.snap index 87d8341..bbacf02 100644 --- a/test/Federation.Tests/Directives/__snapshots__/RequiresDirectiveTests.AnnotateProvidesToClassAttributePureCodeFirst.snap +++ b/test/Federation.Tests/Directives/__snapshots__/RequiresDirectiveTests.AnnotateProvidesToClassAttributePureCodeFirst.snap @@ -25,6 +25,9 @@ type _Service { "Union of all types that key directive applied. This information is needed by the Apollo federation gateway." union _Entity = Review +"Directive to indicate that marks target object as extending part of the federated schema." +directive @extends on OBJECT | INTERFACE + "Directive to indicate that a field is owned by another service, for example via Apollo federation." directive @external on FIELD_DEFINITION diff --git a/test/Federation.Tests/EntitiesResolverTests.cs b/test/Federation.Tests/EntitiesResolverTests.cs index 1ab8344..31d41c7 100644 --- a/test/Federation.Tests/EntitiesResolverTests.cs +++ b/test/Federation.Tests/EntitiesResolverTests.cs @@ -3,13 +3,13 @@ using System.Threading; using System.Threading.Tasks; using GreenDonut; -using ApolloGraphQL.Federation.HotChocolate.Helpers; +using ApolloGraphQL.HotChocolate.Federation.Helpers; using HotChocolate; using HotChocolate.Language; using Xunit; -using static ApolloGraphQL.Federation.HotChocolate.TestHelper; +using static ApolloGraphQL.HotChocolate.Federation.TestHelper; -namespace ApolloGraphQL.Federation.HotChocolate; +namespace ApolloGraphQL.HotChocolate.Federation; public class EntitiesResolverTests { diff --git a/test/Federation.Tests/EntityTypeTests.cs b/test/Federation.Tests/EntityTypeTests.cs index 35763be..a1c2496 100644 --- a/test/Federation.Tests/EntityTypeTests.cs +++ b/test/Federation.Tests/EntityTypeTests.cs @@ -1,8 +1,8 @@ using Xunit; using HotChocolate; -using static ApolloGraphQL.Federation.HotChocolate.Properties.FederationResources; +using static ApolloGraphQL.HotChocolate.Federation.Properties.FederationResources; -namespace ApolloGraphQL.Federation.HotChocolate; +namespace ApolloGraphQL.HotChocolate.Federation; public class EntityTypeTests { diff --git a/test/Federation.Tests/FederationTypesTestBase.cs b/test/Federation.Tests/FederationTypesTestBase.cs index 687e838..221f9d7 100644 --- a/test/Federation.Tests/FederationTypesTestBase.cs +++ b/test/Federation.Tests/FederationTypesTestBase.cs @@ -1,9 +1,10 @@ using System; +using ApolloGraphQL.HotChocolate.Federation.One; using HotChocolate; using HotChocolate.Types; using Xunit; -namespace ApolloGraphQL.Federation.HotChocolate; +namespace ApolloGraphQL.HotChocolate.Federation; public class FederationTypesTestBase { diff --git a/test/Federation.Tests/FieldSetTypeTests.cs b/test/Federation.Tests/FieldSetTypeTests.cs index 11c7f57..2dc7b96 100644 --- a/test/Federation.Tests/FieldSetTypeTests.cs +++ b/test/Federation.Tests/FieldSetTypeTests.cs @@ -1,10 +1,11 @@ -using ApolloGraphQL.Federation.HotChocolate.Constants; +using ApolloGraphQL.HotChocolate.Federation.Constants; +using ApolloGraphQL.HotChocolate.Federation.One; using HotChocolate.Language; using HotChocolate.Types; using Xunit; using static HotChocolate.Language.Utf8GraphQLParser; -namespace ApolloGraphQL.Federation.HotChocolate; +namespace ApolloGraphQL.HotChocolate.Federation; public class FieldSetTypeTests { diff --git a/test/Federation.Tests/ManualBatchScheduler.cs b/test/Federation.Tests/ManualBatchScheduler.cs index 9131c52..f8bb455 100644 --- a/test/Federation.Tests/ManualBatchScheduler.cs +++ b/test/Federation.Tests/ManualBatchScheduler.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using GreenDonut; -namespace ApolloGraphQL.Federation.HotChocolate; +namespace ApolloGraphQL.HotChocolate.Federation; // copied over from GreenDonut public class ManualBatchScheduler : IBatchScheduler diff --git a/test/Federation.Tests/FederationSchemaPrinterTests.cs b/test/Federation.Tests/One/FederationSchemaPrinterTests.cs similarity index 99% rename from test/Federation.Tests/FederationSchemaPrinterTests.cs rename to test/Federation.Tests/One/FederationSchemaPrinterTests.cs index 6b54498..5387a77 100644 --- a/test/Federation.Tests/FederationSchemaPrinterTests.cs +++ b/test/Federation.Tests/One/FederationSchemaPrinterTests.cs @@ -6,7 +6,7 @@ using Snapshooter.Xunit; using Xunit; -namespace ApolloGraphQL.Federation.HotChocolate; +namespace ApolloGraphQL.HotChocolate.Federation.One; public class FederationSchemaPrinterTests { diff --git a/test/Federation.Tests/One/__snapshots__/FederationSchemaPrinterTests.CustomDirective.snap b/test/Federation.Tests/One/__snapshots__/FederationSchemaPrinterTests.CustomDirective.snap new file mode 100644 index 0000000..7b6f92f --- /dev/null +++ b/test/Federation.Tests/One/__snapshots__/FederationSchemaPrinterTests.CustomDirective.snap @@ -0,0 +1,11 @@ +enum EnumWithDeprecatedValue { + DEPRECATED1 @deprecated + DEPRECATED2 @deprecated + ACTIVE +} + +type Query { + foo: String + deprecated1: EnumWithDeprecatedValue @deprecated(reason: "deprecated") + deprecated2: EnumWithDeprecatedValue @deprecated(reason: "deprecated") +} diff --git a/test/Federation.Tests/One/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterApolloDirectivesPureCodeFirst.snap b/test/Federation.Tests/One/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterApolloDirectivesPureCodeFirst.snap new file mode 100644 index 0000000..350d1e4 --- /dev/null +++ b/test/Federation.Tests/One/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterApolloDirectivesPureCodeFirst.snap @@ -0,0 +1,14 @@ +type Address { + zipcode: String! @external +} + +type QueryRootOfUser { + entity(id: Int!): User! +} + +type User @key(fields: "id") { + id: Int! + idCode: String! @external + idCodeShort: String! @requires(fields: "idCode") + address: Address! @provides(fields: "zipcode") +} diff --git a/test/Federation.Tests/One/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterApolloDirectivesSchemaFirst.snap b/test/Federation.Tests/One/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterApolloDirectivesSchemaFirst.snap new file mode 100644 index 0000000..a92c3f1 --- /dev/null +++ b/test/Federation.Tests/One/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterApolloDirectivesSchemaFirst.snap @@ -0,0 +1,8 @@ +type Query { + someField(a: Int): TestType +} + +type TestType @key(fields: "id") { + id: Int! + name: String! +} diff --git a/test/Federation.Tests/One/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterSchemaFirst.snap b/test/Federation.Tests/One/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterSchemaFirst.snap new file mode 100644 index 0000000..c0d2af4 --- /dev/null +++ b/test/Federation.Tests/One/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterSchemaFirst.snap @@ -0,0 +1,39 @@ +type Mutation { + doSomething(input: SomeInput): Boolean +} + +type Query implements iQuery { + someField(a: Int): TestType +} + +enum SomeEnum { + FOO + BAR +} + +input SomeInput { + name: String! + description: String + someEnum: SomeEnum +} + +type TestType @key(fields: "id") { + id: Int! + name: String! + enum: SomeEnum +} + +type TestTypeTwo { + id: Int! +} + +union TestTypes = TestType | TestTypeTwo + +interface iQuery { + someField(a: Int): TestType +} + +interface iTestType @key(fields: "id") { + id: Int! + external: String! @external +} diff --git a/test/Federation.Tests/One/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterSchemaFirst_With_DateTime.snap b/test/Federation.Tests/One/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterSchemaFirst_With_DateTime.snap new file mode 100644 index 0000000..d126d3d --- /dev/null +++ b/test/Federation.Tests/One/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterSchemaFirst_With_DateTime.snap @@ -0,0 +1,43 @@ +"The `DateTime` scalar represents an ISO-8601 compliant date time type." +scalar DateTime @specifiedBy(url: "https:\/\/www.graphql-scalars.com\/date-time") + +type Mutation { + doSomething(input: SomeInput): Boolean +} + +type Query implements iQuery { + someField(a: Int): TestType +} + +enum SomeEnum { + FOO + BAR +} + +input SomeInput { + name: String! + description: String + someEnum: SomeEnum + time: DateTime +} + +type TestType @key(fields: "id") { + id: Int! + name: String! + enum: SomeEnum +} + +type TestTypeTwo { + id: Int! +} + +union TestTypes = TestType | TestTypeTwo + +interface iQuery { + someField(a: Int): TestType +} + +interface iTestType @key(fields: "id") { + id: Int! + external: String! @external +} diff --git a/test/Federation.Tests/One/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterTypeExtensionPureCodeFirst.snap b/test/Federation.Tests/One/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterTypeExtensionPureCodeFirst.snap new file mode 100644 index 0000000..da3afb2 --- /dev/null +++ b/test/Federation.Tests/One/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterTypeExtensionPureCodeFirst.snap @@ -0,0 +1,7 @@ +extend type Product @key(fields: "upc") { + upc: String! +} + +type QueryRootOfProduct { + entity(id: Int!): Product! +} diff --git a/test/Federation.Tests/ReferenceResolverAttributeTests.cs b/test/Federation.Tests/ReferenceResolverAttributeTests.cs index 943b054..f581496 100644 --- a/test/Federation.Tests/ReferenceResolverAttributeTests.cs +++ b/test/Federation.Tests/ReferenceResolverAttributeTests.cs @@ -5,10 +5,10 @@ using HotChocolate.Resolvers; using HotChocolate.Types; using Xunit; -using static ApolloGraphQL.Federation.HotChocolate.Constants.WellKnownContextData; -using static ApolloGraphQL.Federation.HotChocolate.TestHelper; +using static ApolloGraphQL.HotChocolate.Federation.Constants.WellKnownContextData; +using static ApolloGraphQL.HotChocolate.Federation.TestHelper; -namespace ApolloGraphQL.Federation.HotChocolate; +namespace ApolloGraphQL.HotChocolate.Federation; public class ReferenceResolverAttributeTests { diff --git a/test/Federation.Tests/ServiceTypeTests.cs b/test/Federation.Tests/ServiceTypeTests.cs index 237e76d..2464645 100644 --- a/test/Federation.Tests/ServiceTypeTests.cs +++ b/test/Federation.Tests/ServiceTypeTests.cs @@ -1,11 +1,11 @@ using System.Threading.Tasks; -using ApolloGraphQL.Federation.HotChocolate.Constants; +using ApolloGraphQL.HotChocolate.Federation.Constants; using HotChocolate; using Snapshooter.Xunit; using Xunit; -using static ApolloGraphQL.Federation.HotChocolate.TestHelper; +using static ApolloGraphQL.HotChocolate.Federation.TestHelper; -namespace ApolloGraphQL.Federation.HotChocolate; +namespace ApolloGraphQL.HotChocolate.Federation; public class ServiceTypeTests { diff --git a/test/Federation.Tests/TestHelper.cs b/test/Federation.Tests/TestHelper.cs index 1850bfb..e254f68 100644 --- a/test/Federation.Tests/TestHelper.cs +++ b/test/Federation.Tests/TestHelper.cs @@ -7,7 +7,7 @@ using HotChocolate.Types; using Moq; -namespace ApolloGraphQL.Federation.HotChocolate; +namespace ApolloGraphQL.HotChocolate.Federation; public static class TestHelper { diff --git a/test/Federation.Tests/packages.lock.json b/test/Federation.Tests/packages.lock.json index a19bbb6..c4013d2 100644 --- a/test/Federation.Tests/packages.lock.json +++ b/test/Federation.Tests/packages.lock.json @@ -1426,7 +1426,7 @@ "System.IO.Hashing": "7.0.0" } }, - "apollographql.federation.hotchocolate": { + "ApolloGraphQL.HotChocolate.Federation": { "type": "Project", "dependencies": { "HotChocolate": "[13.5.1, )"