diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Extensions/ApolloFederationRequestExecutorBuilderExtensions.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Extensions/ApolloFederationRequestExecutorBuilderExtensions.cs
index 9f26adba262..5d6ddf5f0b5 100644
--- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Extensions/ApolloFederationRequestExecutorBuilderExtensions.cs
+++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Extensions/ApolloFederationRequestExecutorBuilderExtensions.cs
@@ -28,7 +28,7 @@ public static IRequestExecutorBuilder AddApolloFederation(
{
throw new ArgumentNullException(nameof(builder));
}
-
- return builder.ConfigureSchema(s => ApolloFederationSchemaBuilderExtensions.AddApolloFederation(s));
+
+ return builder.ConfigureSchema(s => s.AddApolloFederation());
}
}
diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Extensions/ApolloFederationSchemaBuilderExtensions.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Extensions/ApolloFederationSchemaBuilderExtensions.cs
index 613b2c664ea..a112a1b5d93 100644
--- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Extensions/ApolloFederationSchemaBuilderExtensions.cs
+++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Extensions/ApolloFederationSchemaBuilderExtensions.cs
@@ -20,7 +20,7 @@ public static class ApolloFederationSchemaBuilderExtensions
///
/// The is null.
///
- public static ISchemaBuilder AddApolloFederation(
+ internal static ISchemaBuilder AddApolloFederation(
this ISchemaBuilder builder)
{
if (builder is null)
diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationTypeInterceptor.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationTypeInterceptor.cs
index 915b4495342..1a26cfe0302 100644
--- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationTypeInterceptor.cs
+++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationTypeInterceptor.cs
@@ -14,6 +14,7 @@
using HotChocolate.Types.Descriptors.Definitions;
using static HotChocolate.ApolloFederation.ThrowHelper;
using static HotChocolate.ApolloFederation.Constants.WellKnownContextData;
+using static HotChocolate.Types.TagHelper;
namespace HotChocolate.ApolloFederation;
@@ -53,6 +54,7 @@ internal override void InitializeContext(
{
_context = context;
_typeInspector = context.TypeInspector;
+ ModifyOptions(context, o => o.Mode = TagMode.ApolloFederation);
}
public override void OnAfterInitialize(
diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/AnnotationBased/__snapshots__/CertificationTests.Schema_Snapshot.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/AnnotationBased/__snapshots__/CertificationTests.Schema_Snapshot.snap
index c0e54030d67..9b9cb64619b 100644
--- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/AnnotationBased/__snapshots__/CertificationTests.Schema_Snapshot.snap
+++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/AnnotationBased/__snapshots__/CertificationTests.Schema_Snapshot.snap
@@ -51,7 +51,7 @@ directive @provides(fields: _FieldSet!) on FIELD_DEFINITION
"Used to annotate the required input fieldset from a base type for a resolver."
directive @requires(fields: _FieldSet!) on FIELD_DEFINITION
-directive @tag(name: String!) repeatable on SCHEMA | SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
+directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
"The _Any scalar is used to pass representations of entities from external services into the root _entities field for execution. Validation of the _Any scalar is done by matching the __typename and @external fields defined in the schema."
scalar _Any
diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/AnnotationBased/__snapshots__/CertificationTests.Subgraph_SDL.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/AnnotationBased/__snapshots__/CertificationTests.Subgraph_SDL.snap
index 19adcbd9c40..2c1776b5d78 100644
--- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/AnnotationBased/__snapshots__/CertificationTests.Subgraph_SDL.snap
+++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/AnnotationBased/__snapshots__/CertificationTests.Subgraph_SDL.snap
@@ -25,4 +25,4 @@ extend type User @key(fields: "email") {
totalProductsCreated: Int @external
}
-directive @tag(name: String!) repeatable on SCHEMA | SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
+directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/CodeFirst/__snapshots__/CertificationTests.Schema_Snapshot.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/CodeFirst/__snapshots__/CertificationTests.Schema_Snapshot.snap
index fa56b53ed82..a9bfe8fcd78 100644
--- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/CodeFirst/__snapshots__/CertificationTests.Schema_Snapshot.snap
+++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/CodeFirst/__snapshots__/CertificationTests.Schema_Snapshot.snap
@@ -51,7 +51,7 @@ directive @provides(fields: _FieldSet!) on FIELD_DEFINITION
"Used to annotate the required input fieldset from a base type for a resolver."
directive @requires(fields: _FieldSet!) on FIELD_DEFINITION
-directive @tag(name: String!) repeatable on SCHEMA | SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
+directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
"The _Any scalar is used to pass representations of entities from external services into the root _entities field for execution. Validation of the _Any scalar is done by matching the __typename and @external fields defined in the schema."
scalar _Any
diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/CodeFirst/__snapshots__/CertificationTests.Subgraph_SDL.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/CodeFirst/__snapshots__/CertificationTests.Subgraph_SDL.snap
index 04deb0c6138..8714e99c175 100644
--- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/CodeFirst/__snapshots__/CertificationTests.Subgraph_SDL.snap
+++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/CertificationSchema/CodeFirst/__snapshots__/CertificationTests.Subgraph_SDL.snap
@@ -25,4 +25,4 @@ extend type User @key(fields: "email") {
totalProductsCreated: Int @external
}
-directive @tag(name: String!) repeatable on SCHEMA | SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
+directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/ExternalDirectiveTests.AnnotateExternalToTypeFieldPureCodeFirst.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/ExternalDirectiveTests.AnnotateExternalToTypeFieldPureCodeFirst.snap
index d5193ca4da8..182499da204 100644
--- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/ExternalDirectiveTests.AnnotateExternalToTypeFieldPureCodeFirst.snap
+++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/ExternalDirectiveTests.AnnotateExternalToTypeFieldPureCodeFirst.snap
@@ -33,7 +33,7 @@ directive @provides(fields: _FieldSet!) on FIELD_DEFINITION
"Used to annotate the required input fieldset from a base type for a resolver."
directive @requires(fields: _FieldSet!) on FIELD_DEFINITION
-directive @tag(name: String!) repeatable on SCHEMA | SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
+directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
"The _Any scalar is used to pass representations of entities from external services into the root _entities field for execution. Validation of the _Any scalar is done by matching the __typename and @external fields defined in the schema."
scalar _Any
diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/KeyDirectiveTests.AnnotateKeyToClassAttributePureCodeFirst.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/KeyDirectiveTests.AnnotateKeyToClassAttributePureCodeFirst.snap
index 2f847907de2..d32365bb650 100644
--- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/KeyDirectiveTests.AnnotateKeyToClassAttributePureCodeFirst.snap
+++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/KeyDirectiveTests.AnnotateKeyToClassAttributePureCodeFirst.snap
@@ -32,7 +32,7 @@ directive @provides(fields: _FieldSet!) on FIELD_DEFINITION
"Used to annotate the required input fieldset from a base type for a resolver."
directive @requires(fields: _FieldSet!) on FIELD_DEFINITION
-directive @tag(name: String!) repeatable on SCHEMA | SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
+directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
"The _Any scalar is used to pass representations of entities from external services into the root _entities field for execution. Validation of the _Any scalar is done by matching the __typename and @external fields defined in the schema."
scalar _Any
diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/KeyDirectiveTests.AnnotateKeyToClassAttributesPureCodeFirst.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/KeyDirectiveTests.AnnotateKeyToClassAttributesPureCodeFirst.snap
index 3edefd5d109..4992de0cfe7 100644
--- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/KeyDirectiveTests.AnnotateKeyToClassAttributesPureCodeFirst.snap
+++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/KeyDirectiveTests.AnnotateKeyToClassAttributesPureCodeFirst.snap
@@ -33,7 +33,7 @@ directive @provides(fields: _FieldSet!) on FIELD_DEFINITION
"Used to annotate the required input fieldset from a base type for a resolver."
directive @requires(fields: _FieldSet!) on FIELD_DEFINITION
-directive @tag(name: String!) repeatable on SCHEMA | SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
+directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
"The _Any scalar is used to pass representations of entities from external services into the root _entities field for execution. Validation of the _Any scalar is done by matching the __typename and @external fields defined in the schema."
scalar _Any
diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/KeyDirectiveTests.AnnotateKeyToObjectTypePureCodeFirst.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/KeyDirectiveTests.AnnotateKeyToObjectTypePureCodeFirst.snap
index 296acaa15a7..1ba58003b4f 100644
--- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/KeyDirectiveTests.AnnotateKeyToObjectTypePureCodeFirst.snap
+++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/KeyDirectiveTests.AnnotateKeyToObjectTypePureCodeFirst.snap
@@ -32,7 +32,7 @@ directive @provides(fields: _FieldSet!) on FIELD_DEFINITION
"Used to annotate the required input fieldset from a base type for a resolver."
directive @requires(fields: _FieldSet!) on FIELD_DEFINITION
-directive @tag(name: String!) repeatable on SCHEMA | SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
+directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
"The _Any scalar is used to pass representations of entities from external services into the root _entities field for execution. Validation of the _Any scalar is done by matching the __typename and @external fields defined in the schema."
scalar _Any
diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/ProvidesDirectiveTests.AnnotateProvidesToClassAttributePureCodeFirst.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/ProvidesDirectiveTests.AnnotateProvidesToClassAttributePureCodeFirst.snap
index 4b2647cbef6..e05f197b703 100644
--- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/ProvidesDirectiveTests.AnnotateProvidesToClassAttributePureCodeFirst.snap
+++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/ProvidesDirectiveTests.AnnotateProvidesToClassAttributePureCodeFirst.snap
@@ -37,7 +37,7 @@ directive @provides(fields: _FieldSet!) on FIELD_DEFINITION
"Used to annotate the required input fieldset from a base type for a resolver."
directive @requires(fields: _FieldSet!) on FIELD_DEFINITION
-directive @tag(name: String!) repeatable on SCHEMA | SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
+directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
"The _Any scalar is used to pass representations of entities from external services into the root _entities field for execution. Validation of the _Any scalar is done by matching the __typename and @external fields defined in the schema."
scalar _Any
diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/RequiresDirectiveTests.AnnotateProvidesToClassAttributePureCodeFirst.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/RequiresDirectiveTests.AnnotateProvidesToClassAttributePureCodeFirst.snap
index 3c003e79253..ad2a60ca156 100644
--- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/RequiresDirectiveTests.AnnotateProvidesToClassAttributePureCodeFirst.snap
+++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Directives/__snapshots__/RequiresDirectiveTests.AnnotateProvidesToClassAttributePureCodeFirst.snap
@@ -37,7 +37,7 @@ directive @provides(fields: _FieldSet!) on FIELD_DEFINITION
"Used to annotate the required input fieldset from a base type for a resolver."
directive @requires(fields: _FieldSet!) on FIELD_DEFINITION
-directive @tag(name: String!) repeatable on SCHEMA | SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
+directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
"The _Any scalar is used to pass representations of entities from external services into the root _entities field for execution. Validation of the _Any scalar is done by matching the __typename and @external fields defined in the schema."
scalar _Any
diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterApolloDirectivesPureCodeFirst.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterApolloDirectivesPureCodeFirst.snap
index def53f17792..b506d0efdbc 100644
--- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterApolloDirectivesPureCodeFirst.snap
+++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterApolloDirectivesPureCodeFirst.snap
@@ -13,4 +13,4 @@ type User @key(fields: "id") {
address: Address! @provides(fields: "zipcode")
}
-directive @tag(name: String!) repeatable on SCHEMA | SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
+directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterApolloDirectivesSchemaFirst.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterApolloDirectivesSchemaFirst.snap
index 187d28b705e..7cfec784c15 100644
--- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterApolloDirectivesSchemaFirst.snap
+++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterApolloDirectivesSchemaFirst.snap
@@ -7,4 +7,4 @@ type TestType @key(fields: "id") {
name: String!
}
-directive @tag(name: String!) repeatable on SCHEMA | SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
+directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterSchemaFirst.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterSchemaFirst.snap
index 222d8d8eb0f..b7aaf9b0010 100644
--- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterSchemaFirst.snap
+++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterSchemaFirst.snap
@@ -38,4 +38,4 @@ interface iTestType @key(fields: "id") {
external: String! @external
}
-directive @tag(name: String!) repeatable on SCHEMA | SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
+directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterSchemaFirst_With_DateTime.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterSchemaFirst_With_DateTime.snap
index d4696c8faf4..069f740f4bd 100644
--- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterSchemaFirst_With_DateTime.snap
+++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterSchemaFirst_With_DateTime.snap
@@ -42,4 +42,4 @@ interface iTestType @key(fields: "id") {
external: String! @external
}
-directive @tag(name: String!) repeatable on SCHEMA | SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
+directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterTypeExtensionPureCodeFirst.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterTypeExtensionPureCodeFirst.snap
index 969a634fa20..89fadea1acd 100644
--- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterTypeExtensionPureCodeFirst.snap
+++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/FederationSchemaPrinterTests.TestFederationPrinterTypeExtensionPureCodeFirst.snap
@@ -6,4 +6,4 @@ type QueryRootOfProduct {
entity(id: Int!): Product!
}
-directive @tag(name: String!) repeatable on SCHEMA | SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
+directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/ServiceTypeTests.TestServiceTypeEmptyQueryTypePureCodeFirst.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/ServiceTypeTests.TestServiceTypeEmptyQueryTypePureCodeFirst.snap
index eeba5f48b45..e591b055740 100644
--- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/ServiceTypeTests.TestServiceTypeEmptyQueryTypePureCodeFirst.snap
+++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/ServiceTypeTests.TestServiceTypeEmptyQueryTypePureCodeFirst.snap
@@ -2,4 +2,4 @@
matchCode: String
}
-directive @tag(name: String!) repeatable on SCHEMA | SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
+directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/ServiceTypeTests.TestServiceTypeEmptyQueryTypeSchemaFirst.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/ServiceTypeTests.TestServiceTypeEmptyQueryTypeSchemaFirst.snap
index 1dfa6e8d4d2..3fb2e9fad18 100644
--- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/ServiceTypeTests.TestServiceTypeEmptyQueryTypeSchemaFirst.snap
+++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/ServiceTypeTests.TestServiceTypeEmptyQueryTypeSchemaFirst.snap
@@ -2,4 +2,4 @@
matchCode: String!
}
-directive @tag(name: String!) repeatable on SCHEMA | SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
+directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/ServiceTypeTests.TestServiceTypeTypePureCodeFirst.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/ServiceTypeTests.TestServiceTypeTypePureCodeFirst.snap
index 57d0345d832..fe186e573eb 100644
--- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/ServiceTypeTests.TestServiceTypeTypePureCodeFirst.snap
+++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/ServiceTypeTests.TestServiceTypeTypePureCodeFirst.snap
@@ -6,4 +6,4 @@ type Query {
address(id: Int!): Address!
}
-directive @tag(name: String!) repeatable on SCHEMA | SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
+directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/ServiceTypeTests.TestServiceTypeTypeSchemaFirst.snap b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/ServiceTypeTests.TestServiceTypeTypeSchemaFirst.snap
index d8cc9bf01ae..a2124204af5 100644
--- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/ServiceTypeTests.TestServiceTypeTypeSchemaFirst.snap
+++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/__snapshots__/ServiceTypeTests.TestServiceTypeTypeSchemaFirst.snap
@@ -6,4 +6,4 @@ type Query {
address: Address!
}
-directive @tag(name: String!) repeatable on SCHEMA | SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
+directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
diff --git a/src/HotChocolate/Core/src/Abstractions/WellKnownContextData.cs b/src/HotChocolate/Core/src/Abstractions/WellKnownContextData.cs
index a5575f9bdd8..6b241e70dca 100644
--- a/src/HotChocolate/Core/src/Abstractions/WellKnownContextData.cs
+++ b/src/HotChocolate/Core/src/Abstractions/WellKnownContextData.cs
@@ -279,4 +279,9 @@ public static class WellKnownContextData
/// The key to access the true nullability flag on the execution context.
///
public const string EnableTrueNullability = "HotChocolate.Types.EnableTrueNullability";
+
+ ///
+ /// The key to access the tag options object.
+ ///
+ public const string TagOptions = "HotChocolate.Types.TagOptions";
}
diff --git a/src/HotChocolate/Core/src/Types/Types/Directives/Tag.cs b/src/HotChocolate/Core/src/Types/Types/Directives/Tag.cs
index e5053f14a8d..91563348d08 100644
--- a/src/HotChocolate/Core/src/Types/Types/Directives/Tag.cs
+++ b/src/HotChocolate/Core/src/Types/Types/Directives/Tag.cs
@@ -34,6 +34,7 @@ namespace HotChocolate.Types;
DirectiveLocation.EnumValue |
DirectiveLocation.Schema,
IsRepeatable = true)]
+[TagDirectiveConfig]
public sealed class Tag
{
///
@@ -56,9 +57,9 @@ public Tag(string name)
Name = name;
}
-
+
///
/// The name of the tag.
///
public string Name { get; }
-}
+}
\ No newline at end of file
diff --git a/src/HotChocolate/Core/src/Types/Types/Directives/TagDirectiveConfigAttribute.cs b/src/HotChocolate/Core/src/Types/Types/Directives/TagDirectiveConfigAttribute.cs
new file mode 100644
index 00000000000..afdd127b7e7
--- /dev/null
+++ b/src/HotChocolate/Core/src/Types/Types/Directives/TagDirectiveConfigAttribute.cs
@@ -0,0 +1,30 @@
+#nullable enable
+using System;
+using HotChocolate.Types.Descriptors;
+
+namespace HotChocolate.Types;
+
+internal sealed class TagDirectiveConfigAttribute : DirectiveTypeDescriptorAttribute
+{
+ protected override void OnConfigure(
+ IDescriptorContext context,
+ IDirectiveTypeDescriptor descriptor,
+ Type type)
+ {
+ if (context.ContextData.TryGetValue(WellKnownContextData.TagOptions, out var value) &&
+ value is TagOptions { Mode: TagMode.ApolloFederation })
+ {
+ descriptor.Extend().Definition.Locations =
+ DirectiveLocation.Object |
+ DirectiveLocation.Interface |
+ DirectiveLocation.Union |
+ DirectiveLocation.InputObject |
+ DirectiveLocation.Enum |
+ DirectiveLocation.Scalar |
+ DirectiveLocation.FieldDefinition |
+ DirectiveLocation.InputFieldDefinition |
+ DirectiveLocation.ArgumentDefinition |
+ DirectiveLocation.EnumValue;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/HotChocolate/Core/src/Types/Types/Directives/TagHelper.cs b/src/HotChocolate/Core/src/Types/Types/Directives/TagHelper.cs
new file mode 100644
index 00000000000..c0edade7eff
--- /dev/null
+++ b/src/HotChocolate/Core/src/Types/Types/Directives/TagHelper.cs
@@ -0,0 +1,24 @@
+#nullable enable
+using System;
+using HotChocolate.Types.Descriptors;
+
+namespace HotChocolate.Types;
+
+internal static class TagHelper
+{
+ public static void ModifyOptions(IDescriptorContext context, Action configure)
+ {
+ TagOptions? options = null;
+
+ if (context.ContextData.TryGetValue(WellKnownContextData.TagOptions, out var value) &&
+ value is TagOptions opt)
+ {
+ options = opt;
+ }
+
+ options ??= new TagOptions();
+ context.ContextData[WellKnownContextData.TagOptions] = options;
+ configure(options);
+ }
+
+}
\ No newline at end of file
diff --git a/src/HotChocolate/Core/src/Types/Types/Directives/TagMode.cs b/src/HotChocolate/Core/src/Types/Types/Directives/TagMode.cs
new file mode 100644
index 00000000000..8c670c45e79
--- /dev/null
+++ b/src/HotChocolate/Core/src/Types/Types/Directives/TagMode.cs
@@ -0,0 +1,7 @@
+namespace HotChocolate.Types;
+
+internal enum TagMode
+{
+ GraphQLFusion,
+ ApolloFederation
+}
\ No newline at end of file
diff --git a/src/HotChocolate/Core/src/Types/Types/Directives/TagOptions.cs b/src/HotChocolate/Core/src/Types/Types/Directives/TagOptions.cs
new file mode 100644
index 00000000000..4afd839bdfe
--- /dev/null
+++ b/src/HotChocolate/Core/src/Types/Types/Directives/TagOptions.cs
@@ -0,0 +1,7 @@
+#nullable enable
+namespace HotChocolate.Types;
+
+internal sealed class TagOptions
+{
+ public TagMode Mode { get; set; } = TagMode.GraphQLFusion;
+}
\ No newline at end of file
diff --git a/temp.txt b/temp.txt
deleted file mode 100644
index c1266e88eb5..00000000000
--- a/temp.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-DIRECTIVE_DEFINITION_INVALID: Invalid definition for directive "@tag": argument "name" should have type "String!" but found type "String"
-DIRECTIVE_DEFINITION_INVALID: Invalid definition for directive "@tag": "@tag" should have locations FIELD_DEFINITION, OBJECT, INTERFACE, UNION, ARGUMENT_DEFINITION, SCALAR, ENUM, ENUM_VALUE, INPUT_OBJECT, INPUT_FIELD_DEFINITION, but found (non-subset) SCHEMA, SCALAR, OBJECT, FIELD_DEFINITION, ARGUMENT_DEFINITION, INTERFACE, UNION, ENUM, ENUM_VALUE, INPUT_OBJECT, INPUT_FIELD_DEFINITION