diff --git a/src/HotChocolate/Core/src/Types/Configuration/BuiltInDirectiveTypeReferences.cs b/src/HotChocolate/Core/src/Types/Configuration/BuiltInDirectiveTypeReferences.cs index d0d33d76332..6f7196524e2 100644 --- a/src/HotChocolate/Core/src/Types/Configuration/BuiltInDirectiveTypeReferences.cs +++ b/src/HotChocolate/Core/src/Types/Configuration/BuiltInDirectiveTypeReferences.cs @@ -12,11 +12,6 @@ internal static void Enqueue( { var typeInspector = context.TypeInspector; - if (context.Options.EnableOneOf) - { - EnqueueTypeRef(backlog, typeInspector.GetTypeRef(typeof(OneOfDirectiveType)), nextIndex++); - } - if (context.Options.EnableDefer) { EnqueueTypeRef(backlog, typeInspector.GetTypeRef(typeof(DeferDirectiveType)), nextIndex++); @@ -40,6 +35,7 @@ internal static void Enqueue( EnqueueTypeRef(backlog, typeInspector.GetTypeRef(typeof(SkipDirectiveType)), nextIndex++); EnqueueTypeRef(backlog, typeInspector.GetTypeRef(typeof(IncludeDirectiveType)), nextIndex++); EnqueueTypeRef(backlog, typeInspector.GetTypeRef(typeof(DeprecatedDirectiveType)), nextIndex++); + EnqueueTypeRef(backlog, typeInspector.GetTypeRef(typeof(OneOfDirectiveType)), nextIndex++); static void EnqueueTypeRef( PriorityQueue backlog, diff --git a/src/HotChocolate/Core/src/Types/IReadOnlySchemaOptions.cs b/src/HotChocolate/Core/src/Types/IReadOnlySchemaOptions.cs index db4daafdb76..f698d05dd25 100644 --- a/src/HotChocolate/Core/src/Types/IReadOnlySchemaOptions.cs +++ b/src/HotChocolate/Core/src/Types/IReadOnlySchemaOptions.cs @@ -106,11 +106,6 @@ public interface IReadOnlySchemaOptions /// IsOfTypeFallback? DefaultIsOfTypeCheck { get; } - /// - /// Defines if the one-of feature shall be enabled. - /// - bool EnableOneOf { get; } - /// /// Defines if flag enums should be inferred as object value nodes /// diff --git a/src/HotChocolate/Core/src/Types/SchemaOptions.cs b/src/HotChocolate/Core/src/Types/SchemaOptions.cs index d7959c09f57..3fea27f13a9 100644 --- a/src/HotChocolate/Core/src/Types/SchemaOptions.cs +++ b/src/HotChocolate/Core/src/Types/SchemaOptions.cs @@ -94,9 +94,6 @@ public FieldBindingFlags DefaultFieldBindingFlags /// public IsOfTypeFallback? DefaultIsOfTypeCheck { get; set; } - /// - public bool EnableOneOf { get; set; } = true; - /// public bool EnableFlagEnums { get; set; } @@ -214,7 +211,6 @@ public static SchemaOptions FromOptions(IReadOnlySchemaOptions options) RemoveUnusedTypeSystemDirectives = options.RemoveUnusedTypeSystemDirectives, SortFieldsByName = options.SortFieldsByName, DefaultIsOfTypeCheck = options.DefaultIsOfTypeCheck, - EnableOneOf = options.EnableOneOf, EnableFlagEnums = options.EnableFlagEnums, EnableDefer = options.EnableDefer, EnableStream = options.EnableStream, diff --git a/src/HotChocolate/Core/src/Types/Types/Introspection/__Type.cs b/src/HotChocolate/Core/src/Types/Types/Introspection/__Type.cs index f2d699d9730..0b01ec7659c 100644 --- a/src/HotChocolate/Core/src/Types/Types/Introspection/__Type.cs +++ b/src/HotChocolate/Core/src/Types/Types/Introspection/__Type.cs @@ -77,17 +77,11 @@ protected override ObjectTypeConfiguration CreateConfiguration(ITypeDiscoveryCon new(Names.SpecifiedByUrl, TypeResources.Type_SpecifiedByUrl_Description, stringType, - pureResolver: Resolvers.SpecifiedBy) + pureResolver: Resolvers.SpecifiedBy), + new(Names.IsOneOf, type: booleanType, pureResolver: Resolvers.IsOneOf) } }; - if (context.DescriptorContext.Options.EnableOneOf) - { - def.Fields.Add(new(Names.IsOneOf, - type: booleanType, - pureResolver: Resolvers.IsOneOf)); - } - if (context.DescriptorContext.Options.EnableDirectiveIntrospection) { def.Fields.Add(new(Names.AppliedDirectives, diff --git a/src/HotChocolate/Core/test/Types.Tests/Configuration/__snapshots__/TypeDiscovererTests.Register_ClrType_InferSchemaTypes.snap b/src/HotChocolate/Core/test/Types.Tests/Configuration/__snapshots__/TypeDiscovererTests.Register_ClrType_InferSchemaTypes.snap index f2e9db536ac..6afcbcd9ee4 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Configuration/__snapshots__/TypeDiscovererTests.Register_ClrType_InferSchemaTypes.snap +++ b/src/HotChocolate/Core/test/Types.Tests/Configuration/__snapshots__/TypeDiscovererTests.Register_ClrType_InferSchemaTypes.snap @@ -72,14 +72,6 @@ "EnumType" ] }, - { - "type": "HotChocolate.Types.OneOfDirectiveType", - "runtimeType": "System.Object", - "references": [ - "HotChocolate.Types.OneOfDirectiveType", - "OneOfDirectiveType" - ] - }, { "type": "HotChocolate.Types.SkipDirectiveType", "runtimeType": "System.Object", @@ -106,6 +98,14 @@ "@DeprecatedDirective" ] }, + { + "type": "HotChocolate.Types.OneOfDirectiveType", + "runtimeType": "System.Object", + "references": [ + "HotChocolate.Types.OneOfDirectiveType", + "OneOfDirectiveType" + ] + }, { "type": "HotChocolate.Types.StringType", "runtimeType": "System.String", diff --git a/src/HotChocolate/Core/test/Types.Tests/Configuration/__snapshots__/TypeDiscovererTests.Register_SchemaType_ClrTypeExists.snap b/src/HotChocolate/Core/test/Types.Tests/Configuration/__snapshots__/TypeDiscovererTests.Register_SchemaType_ClrTypeExists.snap index 7e401168240..c2fe8f54ab4 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Configuration/__snapshots__/TypeDiscovererTests.Register_SchemaType_ClrTypeExists.snap +++ b/src/HotChocolate/Core/test/Types.Tests/Configuration/__snapshots__/TypeDiscovererTests.Register_SchemaType_ClrTypeExists.snap @@ -72,14 +72,6 @@ "EnumType" ] }, - { - "type": "HotChocolate.Types.OneOfDirectiveType", - "runtimeType": "System.Object", - "references": [ - "HotChocolate.Types.OneOfDirectiveType", - "OneOfDirectiveType" - ] - }, { "type": "HotChocolate.Types.SkipDirectiveType", "runtimeType": "System.Object", @@ -106,6 +98,14 @@ "@DeprecatedDirective" ] }, + { + "type": "HotChocolate.Types.OneOfDirectiveType", + "runtimeType": "System.Object", + "references": [ + "HotChocolate.Types.OneOfDirectiveType", + "OneOfDirectiveType" + ] + }, { "type": "HotChocolate.Configuration.TypeDiscovererTests.FooType", "runtimeType": "HotChocolate.Configuration.TypeDiscovererTests.Foo", diff --git a/src/HotChocolate/Core/test/Types.Tests/Configuration/__snapshots__/TypeDiscovererTests.Upgrade_Type_From_GenericType.snap b/src/HotChocolate/Core/test/Types.Tests/Configuration/__snapshots__/TypeDiscovererTests.Upgrade_Type_From_GenericType.snap index 34e5de6356b..f8ac6d32db3 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Configuration/__snapshots__/TypeDiscovererTests.Upgrade_Type_From_GenericType.snap +++ b/src/HotChocolate/Core/test/Types.Tests/Configuration/__snapshots__/TypeDiscovererTests.Upgrade_Type_From_GenericType.snap @@ -72,14 +72,6 @@ "EnumType" ] }, - { - "type": "HotChocolate.Types.OneOfDirectiveType", - "runtimeType": "System.Object", - "references": [ - "HotChocolate.Types.OneOfDirectiveType", - "OneOfDirectiveType" - ] - }, { "type": "HotChocolate.Types.SkipDirectiveType", "runtimeType": "System.Object", @@ -106,6 +98,14 @@ "@DeprecatedDirective" ] }, + { + "type": "HotChocolate.Types.OneOfDirectiveType", + "runtimeType": "System.Object", + "references": [ + "HotChocolate.Types.OneOfDirectiveType", + "OneOfDirectiveType" + ] + }, { "type": "HotChocolate.Configuration.TypeDiscovererTests.FooType", "runtimeType": "HotChocolate.Configuration.TypeDiscovererTests.Foo", diff --git a/website/src/docs/hotchocolate/v16/defining-a-schema/input-object-types.md b/website/src/docs/hotchocolate/v16/defining-a-schema/input-object-types.md index e82a489272a..810253f9340 100644 --- a/website/src/docs/hotchocolate/v16/defining-a-schema/input-object-types.md +++ b/website/src/docs/hotchocolate/v16/defining-a-schema/input-object-types.md @@ -697,8 +697,7 @@ builder.Services ") .BindRuntimeType() .BindRuntimeType() - .BindRuntimeType() - .ModifyOptions(o => o.EnableOneOf = true); + .BindRuntimeType(); ``` diff --git a/website/src/docs/hotchocolate/v16/migrating/migrate-from-15-to-16.md b/website/src/docs/hotchocolate/v16/migrating/migrate-from-15-to-16.md index c8f73d77269..059a063ef22 100644 --- a/website/src/docs/hotchocolate/v16/migrating/migrate-from-15-to-16.md +++ b/website/src/docs/hotchocolate/v16/migrating/migrate-from-15-to-16.md @@ -379,6 +379,10 @@ In an effort to standardize our abstractions, we've renamed `IHasRuntimeType` to The conversion from GUID to string in the default type converter has been updated to format with hyphens (format "D") instead of without (format "N"), to follow the documented behavior. +## EnableOneOf option removed + +The `EnableOneOf` option has been removed, as the `@oneOf` directive is now built in. + # Deprecations Things that will continue to function this release, but we encourage you to move away from.