From 82a7c2f48ff40b7f6f2bbba251adf2b990482bc0 Mon Sep 17 00:00:00 2001 From: Michael Staib Date: Tue, 15 Apr 2025 13:46:11 +0200 Subject: [PATCH 1/9] Started Type System Refactoring --- .../Extensions/FederationVersionExtensions.cs | 2 +- .../FederationTypeInterceptor.cs | 22 +++--- .../Resolvers/ArgumentParser.cs | 2 +- .../Descriptors/EntityResolverDefinition.cs | 2 +- .../Directives/PolicyDescriptorExtensions.cs | 2 +- .../RequiresScopesDescriptorExtensions.cs | 2 +- .../ApolloFederation/Types/ServerFields.cs | 4 +- .../Caching/CacheControlTypeInterceptor.cs | 14 ++-- .../CacheControlValidationTypeInterceptor.cs | 2 +- .../HotChocolate.Abstractions.csproj | 9 +-- .../src/Abstractions/Types/IOutputType.cs | 7 -- .../AllowAnonymousDirectiveType.cs | 8 +-- .../AuthorizationTypeInterceptor.TypeInfo.cs | 2 +- .../AuthorizationTypeInterceptor.cs | 22 +++--- .../Authorization/AuthorizeDirectiveType.cs | 6 +- ...estExecutorBuilderExtensions.Middleware.cs | 4 +- .../src/Execution/RequestExecutorResolver.cs | 2 +- .../RequirementsTypeInterceptor.cs | 4 +- .../DataLoaderRootFieldTypeInterceptor.cs | 6 +- .../ObjectFieldDataLoaderExtensions.cs | 8 +-- .../src/Types.Abstractions/Types/ListType.cs | 4 +- .../Types.Abstractions/Types/NonNullType.cs | 4 +- .../Types.CursorPagination/ConnectionType.cs | 8 +-- .../PagingObjectFieldDescriptorExtensions.cs | 4 +- .../Extensions/UseConnectionAttribute.cs | 8 +-- .../Core/src/Types.Errors/ErrorTypeHelper.cs | 4 +- .../ErrorObjectFieldDefinitionExtensions.cs | 4 +- .../src/Types.Errors/MutationErrorHandler.cs | 2 +- .../MutationErrorTypeInterceptor.cs | 2 +- .../src/Types.Json/FromJsonSchemaDirective.cs | 8 +-- .../Types.Json/JsonObjectTypeExtensions.cs | 4 +- .../Types.Mutations/MutationContextData.cs | 4 +- .../MutationConventionTypeInterceptor.cs | 32 ++++----- .../src/Types.Mutations/MutationDirective.cs | 10 +-- .../CollectionSegmentType~1.cs | 4 +- .../QueryConventionTypeInterceptor.cs | 4 +- .../Configuration/AggregateTypeInterceptor.cs | 24 +++---- .../src/Types/Configuration/OnCompleteType.cs | 2 +- .../Types/Configuration/OnCompleteType~1.cs | 2 +- .../Types/Configuration/OnInitializeType.cs | 2 +- .../Types/Configuration/OnInitializeType~1.cs | 2 +- .../Types/Configuration/TypeInitializer.cs | 8 +-- .../Types/Configuration/TypeInterceptor.cs | 26 +++---- .../InputObjectTypeValidationRule.cs | 2 +- .../src/Types/Internal/FieldInitHelper.cs | 8 +-- .../Types/Internal/TypeDependencyHelper.cs | 20 +++--- .../src/Types/Internal/TypeExtensionHelper.cs | 30 ++++---- .../Core/src/Types/Schema.Initialization.cs | 2 +- .../Types/SemanticNonNullTypeInterceptor.cs | 8 +-- ...StoreGlobalPagingOptionsTypeInterceptor.cs | 2 +- .../Core/src/Types/Types/Argument.cs | 26 +++---- .../Types/Attributes/SubscribeAttribute.cs | 2 +- .../Types/Descriptors/ArgumentDescriptor.cs | 8 +-- .../Descriptors/ArgumentDescriptorBase~1.cs | 4 +- .../Contracts/IArgumentDescriptor.cs | 2 +- .../Contracts/IDescriptorExtension.cs | 8 +-- .../Contracts/IDescriptorExtension~1.cs | 2 +- .../Descriptors/Contracts/IDescriptor~1.cs | 2 +- .../Contracts/IDirectiveArgumentDescriptor.cs | 2 +- .../Contracts/IDirectiveTypeDescriptor.cs | 2 +- .../Contracts/IDirectiveTypeDescriptor~1.cs | 2 +- .../Contracts/IEnumTypeDescriptor.cs | 2 +- .../Contracts/IEnumTypeDescriptor~1.cs | 2 +- .../Contracts/IEnumValueDescriptor.cs | 2 +- .../Contracts/IInputFieldDescriptor.cs | 2 +- .../Contracts/IInputObjectTypeDescriptor.cs | 2 +- .../Contracts/IInputObjectTypeDescriptor~1.cs | 2 +- .../Contracts/IInterfaceFieldDescriptor.cs | 2 +- .../Contracts/IInterfaceTypeDescriptor.cs | 2 +- .../Contracts/IInterfaceTypeDescriptor~1.cs | 2 +- .../Contracts/IObjectFieldDescriptor.cs | 2 +- ...Definition.cs => ArgumentConfiguration.cs} | 16 ++--- .../Definitions/CompleteConfiguration.cs | 21 +++--- .../Definitions/CreateConfiguration.cs | 12 ++-- ...n.cs => DirectiveArgumentConfiguration.cs} | 10 +-- ...efinition.cs => DirectiveConfiguration.cs} | 10 +-- ...ition.cs => DirectiveTypeConfiguration.cs} | 22 +++--- ...Definition.cs => EnumTypeConfiguration.cs} | 20 +++--- ...efinition.cs => EnumValueConfiguration.cs} | 14 ++-- ...efinitionBase.cs => FieldConfiguration.cs} | 20 +++--- ...ion.cs => FieldMiddlewareConfiguration.cs} | 6 +- .../IComplexOutputTypeConfiguration.cs | 29 ++++++++ .../IComplexOutputTypeDefinition.cs | 14 ---- .../Definitions/IDefinitionFactory.cs | 2 +- .../Definitions/IDefinitionFactory~1.cs | 2 +- ...ecated.cs => IDeprecationConfiguration.cs} | 2 +- ....cs => IDirectiveConfigurationProvider.cs} | 6 +- ...dsType.cs => IExtendsTypeConfiguration.cs} | 5 +- ...{IHasIgnore.cs => IIgnoreConfiguration.cs} | 2 +- ...inition.cs => IRepeatableConfiguration.cs} | 2 +- .../Definitions/ITypeDefinition.cs | 6 +- ...inition.cs => ITypeSystemConfiguration.cs} | 12 ++-- ...ion.cs => ITypeSystemConfigurationTask.cs} | 7 +- ...finition.cs => InputFieldConfiguration.cs} | 16 ++--- ...ion.cs => InputObjectTypeConfiguration.cs} | 26 +++---- ...tion.cs => InterfaceFieldConfiguration.cs} | 71 +++++++++---------- ...ition.cs => InterfaceTypeConfiguration.cs} | 20 +++--- ...inition.cs => ObjectFieldConfiguration.cs} | 32 ++++----- .../Definitions/ObjectTypeDefinition.cs | 18 ++--- ...ionBase.cs => OutputFieldConfiguration.cs} | 18 ++--- ...ion.cs => ResultFormatterConfiguration.cs} | 6 +- .../Definitions/SchemaTypeDefinition.cs | 18 ++--- .../Definitions/TypeDefinitionBase~1.cs | 8 +-- .../Descriptors/Definitions/TypeDependency.cs | 4 +- ...tionBase.cs => TypeSystemConfiguration.cs} | 34 ++++----- .../Descriptors/DependencyDescriptorBase~1.cs | 4 +- .../Types/Descriptors/DescriptorBase~1.cs | 12 ++-- .../DirectiveArgumentDescriptor.cs | 8 +-- .../Descriptors/DirectiveTypeDescriptor.cs | 16 ++--- .../Descriptors/DirectiveTypeDescriptor~1.cs | 4 +- .../Types/Descriptors/EnumTypeDescriptor.cs | 16 ++--- .../Types/Descriptors/EnumTypeDescriptor~1.cs | 2 +- .../Types/Descriptors/EnumValueDescriptor.cs | 10 +-- .../Extensions/DescriptorExtensions.cs | 10 +-- .../Types/Descriptors/InputFieldDescriptor.cs | 8 +-- .../Descriptors/InputObjectTypeDescriptor.cs | 16 ++--- .../InputObjectTypeDescriptor~1.cs | 4 +- .../Descriptors/InterfaceFieldDescriptor.cs | 12 ++-- .../Descriptors/InterfaceTypeDescriptor.cs | 16 ++--- .../Descriptors/InterfaceTypeDescriptor~1.cs | 4 +- .../Descriptors/ObjectFieldDescriptor.cs | 12 ++-- .../Types/Descriptors/ObjectTypeDescriptor.cs | 4 +- .../Descriptors/ObjectTypeDescriptorBase~1.cs | 2 +- .../Descriptors/OutputFieldDescriptorBase.cs | 2 +- .../Core/src/Types/Types/DirectiveArgument.cs | 2 +- .../src/Types/Types/DirectiveCollection.cs | 4 +- .../Types/DirectiveType.Initialization.cs | 26 +++---- .../Core/src/Types/Types/DirectiveType.cs | 4 +- .../Core/src/Types/Types/DirectiveType~1.cs | 2 +- .../Directives/DirectiveTypeInterceptor.cs | 2 +- .../Types/Types/EnumType.Initialization.cs | 12 ++-- .../Core/src/Types/Types/EnumType.cs | 2 +- .../Core/src/Types/Types/EnumTypeExtension.cs | 12 ++-- .../Core/src/Types/Types/EnumType~1.cs | 2 +- .../Core/src/Types/Types/EnumValue.cs | 4 +- .../Types/Types/Extensions/TypeExtensions.cs | 2 +- .../Types/Factories/DirectiveTypeFactory.cs | 8 +-- .../Types/Types/Factories/EnumTypeFactory.cs | 10 +-- .../Types/Factories/InputObjectTypeFactory.cs | 10 +-- .../Types/Factories/InterfaceTypeFactory.cs | 16 ++--- .../Types/Factories/ObjectTypeFactory.cs | 10 +-- .../SchemaBuildingDirectiveHelper.cs | 6 +- .../Factories/SchemaFirstTypeInterceptor.cs | 2 +- .../Types/Factories/SdlToTypeSystemHelper.cs | 4 +- .../Core/src/Types/Types/FieldBase.cs | 12 ++-- .../Types/Types/Helpers/DescriptorHelpers.cs | 4 +- .../src/Types/Types/Helpers/DirectiveUtils.cs | 10 +-- .../Types/Helpers/FieldDescriptorUtilities.cs | 8 +-- .../Types/Helpers/FieldMiddlewareCompiler.cs | 16 ++--- .../src/Types/Types/Helpers/TypeMemHelper.cs | 24 +++---- .../src/Types/Types/Helpers/TypeNameHelper.cs | 4 +- .../Core/src/Types/Types/ISchemaDirective.cs | 4 +- .../Core/src/Types/Types/InputField.cs | 26 +++---- .../Types/InputObjectType.Initialization.cs | 22 +++--- .../Core/src/Types/Types/InputObjectType.cs | 4 +- .../Types/Types/InputObjectTypeExtension.cs | 8 +-- .../Core/src/Types/Types/InputObjectType~1.cs | 2 +- .../Core/src/Types/Types/InputParser.cs | 4 +- .../Interceptors/FlagEnumTypeInterceptor.cs | 20 +++--- .../InterfaceCompletionTypeInterceptor.cs | 20 +++--- .../MiddlewareValidationTypeInterceptor.cs | 6 +- .../Interceptors/ResolverTypeInterceptor.cs | 18 ++--- .../TypeValidationTypeInterceptor.cs | 14 ++-- .../Core/src/Types/Types/InterfaceField.cs | 2 +- .../Types/InterfaceType.Initialization.cs | 16 ++--- .../Core/src/Types/Types/InterfaceType.cs | 4 +- .../src/Types/Types/InterfaceTypeExtension.cs | 8 +-- .../Core/src/Types/Types/InterfaceType~1.cs | 2 +- .../Introspection/IntrospectionFields.cs | 8 +-- .../IntrospectionTypeInterceptor.cs | 2 +- .../Introspection/__DirectiveLocation.cs | 40 +++++------ .../Types/Types/Introspection/__TypeKind.cs | 2 +- .../Core/src/Types/Types/ListType.cs | 14 ---- .../Core/src/Types/Types/ListType~1.cs | 10 ++- .../Core/src/Types/Types/NamedTypeBase.cs | 2 +- .../src/Types/Types/NamedTypeExtensionBase.cs | 4 +- .../Core/src/Types/Types/NonNamedType.cs | 38 ---------- .../Core/src/Types/Types/NonNullType.cs | 22 ------ .../Core/src/Types/Types/NonNullType~1.cs | 14 ++-- .../Core/src/Types/Types/ObjectField.cs | 14 ++-- .../Types/Types/ObjectType.Initialization.cs | 4 +- .../src/Types/Types/ObjectTypeExtension.cs | 2 +- .../Core/src/Types/Types/OutputFieldBase.cs | 30 ++++---- .../Types/Types/Pagination/PagingHelper.cs | 10 +-- .../Types/Relay/Descriptors/NodeDefinition.cs | 4 +- .../Relay/Descriptors/NodeDescriptorBase.cs | 10 +-- .../Relay/Descriptors/NodeDescriptor~2.cs | 6 +- .../Relay/Extensions/RelayIdFieldHelpers.cs | 26 +++---- .../Types/Relay/NodeFieldTypeInterceptor.cs | 16 ++--- .../Relay/NodeIdSerializerTypeInterceptor.cs | 2 +- .../Types/Relay/QueryFieldTypeInterceptor.cs | 6 +- .../src/Types/Types/TypeSystemObjectBase~1.cs | 26 +++---- .../Core/src/Types/Utilities/ErrorHelper.cs | 2 +- .../AnnotationBasedMutations.cs | 6 +- .../TypeInitializationOrderTests.cs | 2 +- .../TypeScopeInterceptorTests.cs | 4 +- .../test/Types.Tests/SchemaBuilderTests.cs | 4 +- .../Core/test/Types.Tests/SchemaFirstTests.cs | 6 +- .../test/Types.Tests/Types/EnumTypeTests.cs | 2 +- .../Types.Tests/Types/EnumTypeUnsafeTests.cs | 2 +- .../Types/Relay/IdAttributeTests.cs | 4 +- .../src/CostAnalysis/CostTypeInterceptor.cs | 10 +-- .../Types/ListSizeDirectiveType.cs | 4 +- .../Convention/DataTypeExtensionHelper.cs | 34 ++++----- .../Convention/FilterTypeInterceptor.cs | 10 +-- .../FilterObjectFieldDescriptorExtensions.cs | 12 ++-- .../Data/src/Data/Filters/Fields/AndField.cs | 2 +- .../src/Data/Filters/Fields/FilterField.cs | 2 +- .../Data/src/Data/Filters/Fields/OrField.cs | 2 +- .../src/Data/Filters/FilterFieldDefinition.cs | 2 +- .../src/Data/Filters/FilterFieldDescriptor.cs | 2 +- .../Data/src/Data/Filters/FilterInputType.cs | 8 +-- .../Data/Filters/FilterInputTypeDefinition.cs | 2 +- .../src/Data/Filters/FilterInputType`1.cs | 2 +- .../Filters/FilterOperationFieldDescriptor.cs | 2 +- .../Data/Filters/IFilterFieldDefinition.cs | 6 +- ...ojectionObjectFieldDescriptorExtensions.cs | 8 +-- ...rDefaultObjectFieldDescriptorExtensions.cs | 8 +-- .../Projections/ProjectionTypeInterceptor.cs | 4 +- .../Sorting/Convention/ISortConvention.cs | 2 +- .../Data/Sorting/Convention/SortConvention.cs | 2 +- .../Sorting/Convention/SortTypeInterceptor.cs | 6 +- .../Handlers/QueryableOperationHandlerBase.cs | 2 +- .../SortingObjectFieldDescriptorExtensions.cs | 16 ++--- .../Data/src/Data/Sorting/Fields/SortField.cs | 2 +- .../src/Data/Sorting/ISortFieldDefinition.cs | 6 +- .../Data/src/Data/Sorting/SortEnumType.cs | 4 +- .../Data/Sorting/SortEnumTypeDefinition.cs | 2 +- .../Data/Sorting/SortEnumValueDefinition.cs | 2 +- .../Data/Sorting/SortEnumValueDescriptor.cs | 2 +- .../src/Data/Sorting/SortFieldDefinition.cs | 2 +- .../src/Data/Sorting/SortFieldDescriptor.cs | 2 +- .../Data/src/Data/Sorting/SortInputType.cs | 8 +-- .../Data/Sorting/SortInputTypeDefinition.cs | 2 +- .../Data/src/Data/Sorting/SortInputType`1.cs | 2 +- .../Sorting/Visitor/ISortOperationHandler.cs | 2 +- .../Sorting/Visitor/SortOperationHandler.cs | 2 +- src/HotChocolate/Data/src/Data/ThrowHelper.cs | 2 +- .../Mock/MatchAnyQueryableOperationHandler.cs | 2 +- .../MongoDbSortOperationHandlerBase.cs | 2 +- .../src/Primitives}/Types/IInputType.cs | 7 +- .../src/Primitives/Types/IOutputType.cs | 11 +++ .../src/Primitives/Types/IWrapperType.cs | 12 ++++ ...DocumentStoreParameterExpressionBuilder.cs | 2 +- .../Spatial/src/Types/GeoJsonInputType.cs | 4 +- .../GeometryTransformerInterceptor.cs | 10 +-- .../TransformationIntegrationTests.cs | 2 +- .../Utilities/EntityTypeInterceptor.cs | 2 +- .../Utilities/LeafTypeInterceptor.cs | 2 +- 249 files changed, 1043 insertions(+), 1070 deletions(-) delete mode 100644 src/HotChocolate/Core/src/Abstractions/Types/IOutputType.cs rename src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/{ArgumentDefinition.cs => ArgumentConfiguration.cs} (83%) rename src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/{DirectiveArgumentDefinition.cs => DirectiveArgumentConfiguration.cs} (74%) rename src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/{DirectiveDefinition.cs => DirectiveConfiguration.cs} (79%) rename src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/{DirectiveTypeDefinition.cs => DirectiveTypeConfiguration.cs} (82%) rename src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/{EnumTypeDefinition.cs => EnumTypeConfiguration.cs} (74%) rename src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/{EnumValueDefinition.cs => EnumValueConfiguration.cs} (79%) rename src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/{FieldDefinitionBase.cs => FieldConfiguration.cs} (87%) rename src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/{FieldMiddlewareDefinition.cs => FieldMiddlewareConfiguration.cs} (91%) create mode 100644 src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IComplexOutputTypeConfiguration.cs delete mode 100644 src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IComplexOutputTypeDefinition.cs rename src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/{ICanBeDeprecated.cs => IDeprecationConfiguration.cs} (75%) rename src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/{IHasDirectiveDefinition.cs => IDirectiveConfigurationProvider.cs} (73%) rename src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/{IHasExtendsType.cs => IExtendsTypeConfiguration.cs} (51%) rename src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/{IHasIgnore.cs => IIgnoreConfiguration.cs} (88%) rename src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/{IMiddlewareDefinition.cs => IRepeatableConfiguration.cs} (92%) rename src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/{IDefinition.cs => ITypeSystemConfiguration.cs} (77%) rename src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/{ITypeSystemMemberConfiguration.cs => ITypeSystemConfigurationTask.cs} (87%) rename src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/{InputFieldDefinition.cs => InputFieldConfiguration.cs} (65%) rename src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/{InputObjectTypeDefinition.cs => InputObjectTypeConfiguration.cs} (74%) rename src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/{InterfaceFieldDefinition.cs => InterfaceFieldConfiguration.cs} (84%) rename src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/{InterfaceTypeDefinition.cs => InterfaceTypeConfiguration.cs} (77%) rename src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/{ObjectFieldDefinition.cs => ObjectFieldConfiguration.cs} (92%) rename src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/{OutputFieldDefinitionBase.cs => OutputFieldConfiguration.cs} (73%) rename src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/{ResultFormatterDefinition.cs => ResultFormatterConfiguration.cs} (87%) rename src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/{DefinitionBase.cs => TypeSystemConfiguration.cs} (82%) delete mode 100644 src/HotChocolate/Core/src/Types/Types/ListType.cs delete mode 100644 src/HotChocolate/Core/src/Types/Types/NonNamedType.cs delete mode 100644 src/HotChocolate/Core/src/Types/Types/NonNullType.cs rename src/HotChocolate/{Core/src/Abstractions => Primitives/src/Primitives}/Types/IInputType.cs (77%) create mode 100644 src/HotChocolate/Primitives/src/Primitives/Types/IOutputType.cs create mode 100644 src/HotChocolate/Primitives/src/Primitives/Types/IWrapperType.cs diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Extensions/FederationVersionExtensions.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Extensions/FederationVersionExtensions.cs index 2a53eb6ff6a..a55a437905f 100644 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Extensions/FederationVersionExtensions.cs +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Extensions/FederationVersionExtensions.cs @@ -31,7 +31,7 @@ [new Uri(FederationVersionUrls.Federation27)] = FederationVersion.Federation27, public static FederationVersion GetFederationVersion( this IDescriptor descriptor) - where T : DefinitionBase + where T : TypeSystemConfiguration { var contextData = descriptor.Extend().Context.ContextData; if (contextData.TryGetValue(FederationContextData.FederationVersion, out var value) && diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationTypeInterceptor.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationTypeInterceptor.cs index 76cb9259fe3..f562639cde2 100644 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationTypeInterceptor.cs +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationTypeInterceptor.cs @@ -63,7 +63,7 @@ internal override void InitializeContext( public override void OnAfterInitialize( ITypeDiscoveryContext discoveryContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { if (discoveryContext.Type is ObjectType objectType && definition is ObjectTypeDefinition objectTypeDefinition) @@ -114,7 +114,7 @@ public override IEnumerable RegisterMoreTypes( public override void OnBeforeCompleteName( ITypeCompletionContext completionContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { if (definition is SchemaTypeDefinition schemaDef) { @@ -125,10 +125,10 @@ public override void OnBeforeCompleteName( public override void OnAfterCompleteName( ITypeCompletionContext completionContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { if (_context.GetFederationVersion() == FederationVersion.Federation10 - || definition is not ITypeDefinition and not DirectiveTypeDefinition) + || definition is not ITypeDefinition and not DirectiveTypeConfiguration) { return; } @@ -142,7 +142,7 @@ public override void OnAfterCompleteName( if (fieldDef.Directives.All(t => t.Value is not ShareableDirective)) { var typeRef = TypeReference.CreateDirective(_typeInspector.GetType(typeof(ShareableDirective))); - fieldDef.Directives.Add(new DirectiveDefinition(ShareableDirective.Default, typeRef)); + fieldDef.Directives.Add(new DirectiveConfiguration(ShareableDirective.Default, typeRef)); } } } @@ -327,7 +327,7 @@ public override void OnAfterResolveRootType( public override void OnBeforeCompleteType( ITypeCompletionContext completionContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { AddMemberTypesToTheEntityUnionType( completionContext, @@ -340,7 +340,7 @@ public override void OnBeforeCompleteType( public override void OnAfterMakeExecutable( ITypeCompletionContext completionContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { if (completionContext.Type is ObjectType type && definition is ObjectTypeDefinition typeDef) @@ -411,7 +411,7 @@ private void CompleteReferenceResolver(ObjectTypeDefinition typeDef) private void AddServiceTypeToQueryType( ITypeCompletionContext completionContext, - DefinitionBase? definition) + TypeSystemConfiguration? definition) { if (!ReferenceEquals(completionContext.Type, _queryType)) { @@ -497,7 +497,7 @@ private void AggregatePropertyLevelKeyDirectives( } } - IReadOnlyList fields = objectTypeDefinition.Fields; + IReadOnlyList fields = objectTypeDefinition.Fields; var fieldSet = new StringBuilder(); bool? resolvable = null; @@ -549,7 +549,7 @@ private void AggregatePropertyLevelKeyDirectives( private void AddMemberTypesToTheEntityUnionType( ITypeCompletionContext completionContext, - DefinitionBase? definition) + TypeSystemConfiguration? definition) { if (completionContext.Type is _EntityType && definition is UnionTypeDefinition unionTypeDefinition) @@ -567,7 +567,7 @@ private void AddKeyDirective( bool resolvable) { objectTypeDefinition.Directives.Add( - new DirectiveDefinition( + new DirectiveConfiguration( new KeyDirective(fieldSet, resolvable), _keyDirectiveReference)); } diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Resolvers/ArgumentParser.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Resolvers/ArgumentParser.cs index 0262125cd79..6069274c8de 100644 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Resolvers/ArgumentParser.cs +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Resolvers/ArgumentParser.cs @@ -30,7 +30,7 @@ private static bool TryGetValue( int i, out T? value) { - type = type is NonNullType nonNullType ? nonNullType.Type : type; + type = type is NonNullType nonNullType ? nonNullType.NullableType : type; switch (valueNode.Kind) { case SyntaxKind.ObjectValue: diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Descriptors/EntityResolverDefinition.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Descriptors/EntityResolverDefinition.cs index 5d0f5a33238..e658ec3daf4 100644 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Descriptors/EntityResolverDefinition.cs +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Descriptors/EntityResolverDefinition.cs @@ -5,7 +5,7 @@ namespace HotChocolate.ApolloFederation.Types; /// /// The entity definition allows to specify a reference resolver. /// -public sealed class EntityResolverDefinition : DefinitionBase +public sealed class EntityResolverDefinition : TypeSystemConfiguration { /// /// The runtime type of the entity. diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/PolicyDescriptorExtensions.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/PolicyDescriptorExtensions.cs index f38287f213c..fdae8eafea2 100644 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/PolicyDescriptorExtensions.cs +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/PolicyDescriptorExtensions.cs @@ -208,7 +208,7 @@ public static IObjectTypeDescriptor Policy( private static void AddPolicies( IReadOnlyList policies, - IHasDirectiveDefinition definition, + IDirectiveConfigurationProvider definition, ITypeInspector typeInspector) { var directive = definition diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/RequiresScopesDescriptorExtensions.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/RequiresScopesDescriptorExtensions.cs index 162c5de8043..9dfe0050727 100644 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/RequiresScopesDescriptorExtensions.cs +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/RequiresScopesDescriptorExtensions.cs @@ -207,7 +207,7 @@ public static IObjectTypeDescriptor RequiresScopes( private static void AddScopes( IReadOnlyList scopes, - IHasDirectiveDefinition definition, + IDirectiveConfigurationProvider definition, ITypeInspector typeInspector) { var directive = definition diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/ServerFields.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/ServerFields.cs index 359c70308ec..60967e53713 100644 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/ServerFields.cs +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/ServerFields.cs @@ -9,7 +9,7 @@ public static class ServerFields { private static readonly _Service _service = new(); - internal static ObjectFieldDefinition CreateServiceField(IDescriptorContext context) + internal static ObjectFieldConfiguration CreateServiceField(IDescriptorContext context) { var descriptor = ObjectFieldDescriptor.New(context, WellKnownFieldNames.Service); descriptor.Type>>().Resolve(_service); @@ -21,7 +21,7 @@ static _Service Resolve(IResolverContext ctx) return descriptor.CreateDefinition(); } - internal static ObjectFieldDefinition CreateEntitiesField(IDescriptorContext context) + internal static ObjectFieldConfiguration CreateEntitiesField(IDescriptorContext context) { var descriptor = ObjectFieldDescriptor.New(context, WellKnownFieldNames.Entities); diff --git a/src/HotChocolate/Caching/src/Caching/CacheControlTypeInterceptor.cs b/src/HotChocolate/Caching/src/Caching/CacheControlTypeInterceptor.cs index 4cdac93ac4d..586aa9f626b 100644 --- a/src/HotChocolate/Caching/src/Caching/CacheControlTypeInterceptor.cs +++ b/src/HotChocolate/Caching/src/Caching/CacheControlTypeInterceptor.cs @@ -18,7 +18,7 @@ internal sealed class CacheControlTypeInterceptor( public override void OnBeforeCompleteName( ITypeCompletionContext completionContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { if (!_cacheControlOptions.Enable || !_cacheControlOptions.ApplyDefaults) { @@ -62,7 +62,7 @@ private void TryApplyDefaults(RegisteredType type, ObjectTypeDefinition objectDe var length = objectDef.Fields.Count; var appliedDefaults = false; - var fields = ((BindableList)objectDef.Fields).AsSpan(); + var fields = ((BindableList)objectDef.Fields).AsSpan(); for (var i = 0; i < length; i++) { @@ -97,7 +97,7 @@ private void TryApplyDefaults(RegisteredType type, ObjectTypeDefinition objectDe } private void ApplyCacheControlWithDefaults( - OutputFieldDefinitionBase field) + OutputFieldConfiguration field) { var isNotDefaultScope = _cacheControlOptions.DefaultScope != CacheControlDefaults.Scope; @@ -114,16 +114,16 @@ private void ApplyCacheControlWithDefaults( } field.Directives.Add( - new DirectiveDefinition( + new DirectiveConfiguration( new DirectiveNode( CacheControlDirectiveType.Names.DirectiveName, arguments))); } - private static bool HasCacheControlDirective(ObjectFieldDefinition field) + private static bool HasCacheControlDirective(ObjectFieldConfiguration field) => field.Directives.Any(static d => IsCacheControlDirective(d)); - private static bool IsCacheControlDirective(DirectiveDefinition directive) + private static bool IsCacheControlDirective(DirectiveConfiguration directive) { if (directive.Type is NameDirectiveReference directiveReference && directiveReference.Name.EqualsOrdinal(CacheControlDirectiveType.Names.DirectiveName)) @@ -143,7 +143,7 @@ private static bool IsCacheControlDirective(DirectiveDefinition directive) /// /// Defines if a resolver is possible fetching data and causing higher impact on the system. /// - internal static bool IsDataResolver(ObjectFieldDefinition field) + internal static bool IsDataResolver(ObjectFieldConfiguration field) { if (field.PureResolver is not null && field.MiddlewareDefinitions.Count == 0) { diff --git a/src/HotChocolate/Caching/src/Caching/CacheControlValidationTypeInterceptor.cs b/src/HotChocolate/Caching/src/Caching/CacheControlValidationTypeInterceptor.cs index 44e3b46ef8c..66d25133c9e 100644 --- a/src/HotChocolate/Caching/src/Caching/CacheControlValidationTypeInterceptor.cs +++ b/src/HotChocolate/Caching/src/Caching/CacheControlValidationTypeInterceptor.cs @@ -23,7 +23,7 @@ public override void OnAfterResolveRootType( public override void OnValidateType( ITypeSystemObjectContext validationContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { if (validationContext.IsIntrospectionType) { diff --git a/src/HotChocolate/Core/src/Abstractions/HotChocolate.Abstractions.csproj b/src/HotChocolate/Core/src/Abstractions/HotChocolate.Abstractions.csproj index 434fc1b059d..fd71eee2e94 100644 --- a/src/HotChocolate/Core/src/Abstractions/HotChocolate.Abstractions.csproj +++ b/src/HotChocolate/Core/src/Abstractions/HotChocolate.Abstractions.csproj @@ -24,10 +24,6 @@ - - - - True @@ -49,4 +45,9 @@ + + + + + diff --git a/src/HotChocolate/Core/src/Abstractions/Types/IOutputType.cs b/src/HotChocolate/Core/src/Abstractions/Types/IOutputType.cs deleted file mode 100644 index 65b63015df9..00000000000 --- a/src/HotChocolate/Core/src/Abstractions/Types/IOutputType.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace HotChocolate.Types; - -public interface IOutputType - : IType - , IHasRuntimeType -{ -} diff --git a/src/HotChocolate/Core/src/Authorization/AllowAnonymousDirectiveType.cs b/src/HotChocolate/Core/src/Authorization/AllowAnonymousDirectiveType.cs index 8d63be684db..668d9727064 100644 --- a/src/HotChocolate/Core/src/Authorization/AllowAnonymousDirectiveType.cs +++ b/src/HotChocolate/Core/src/Authorization/AllowAnonymousDirectiveType.cs @@ -27,12 +27,12 @@ protected override void Configure(IDirectiveTypeDescriptor descriptor) public void ApplyConfiguration( IDescriptorContext context, DirectiveNode directiveNode, - IDefinition definition, - Stack path) + ITypeSystemConfiguration definition, + Stack path) { - ((IHasDirectiveDefinition)definition).Directives.Add(new(directiveNode)); + ((IDirectiveConfigurationProvider)definition).Directives.Add(new(directiveNode)); - if (definition is ObjectFieldDefinition fieldDef) + if (definition is ObjectFieldConfiguration fieldDef) { fieldDef.ContextData[WellKnownContextData.AllowAnonymous] = true; } diff --git a/src/HotChocolate/Core/src/Authorization/AuthorizationTypeInterceptor.TypeInfo.cs b/src/HotChocolate/Core/src/Authorization/AuthorizationTypeInterceptor.TypeInfo.cs index e0a6fedfb1d..382eceb9a07 100644 --- a/src/HotChocolate/Core/src/Authorization/AuthorizationTypeInterceptor.TypeInfo.cs +++ b/src/HotChocolate/Core/src/Authorization/AuthorizationTypeInterceptor.TypeInfo.cs @@ -5,7 +5,7 @@ namespace HotChocolate.Authorization; internal sealed partial class AuthorizationTypeInterceptor { - private abstract class TypeInfo : IEquatable> where TDef : DefinitionBase + private abstract class TypeInfo : IEquatable> where TDef : TypeSystemConfiguration { protected TypeInfo(ITypeCompletionContext context, TDef typeDef) { diff --git a/src/HotChocolate/Core/src/Authorization/AuthorizationTypeInterceptor.cs b/src/HotChocolate/Core/src/Authorization/AuthorizationTypeInterceptor.cs index 53232f18d80..dbc5b9a2f4f 100644 --- a/src/HotChocolate/Core/src/Authorization/AuthorizationTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Authorization/AuthorizationTypeInterceptor.cs @@ -58,7 +58,7 @@ internal override void OnBeforeCreateSchemaInternal( public override void OnBeforeCompleteName( ITypeCompletionContext completionContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { switch (completionContext.Type) { @@ -123,7 +123,7 @@ public override void OnBeforeCompleteMetadata() public override void OnBeforeCompleteMetadata( ITypeCompletionContext completionContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { // last in the initialization we need to intercept the query type and ensure that // authorization configuration is applied to the special introspection and node fields. @@ -365,7 +365,7 @@ private void CheckForValidationAuth(ObjectTypeInfo type) private void ApplyAuthMiddleware( string typeName, - ObjectFieldDefinition fieldDef, + ObjectFieldConfiguration fieldDef, State state) { // if the field contains the AnonymousAllowed flag we will not apply authorization @@ -412,7 +412,7 @@ private void ApplyAuthMiddleware( } private void ApplyAuthMiddleware( - ObjectFieldDefinition fieldDef, + ObjectFieldConfiguration fieldDef, RegisteredType authTypeReg, bool isNodeField) { @@ -471,9 +471,9 @@ private void ApplyAuthMiddleware( } } - private static FieldMiddlewareDefinition CreateAuthMiddleware( + private static FieldMiddlewareConfiguration CreateAuthMiddleware( AuthorizeDirective directive) - => new FieldMiddlewareDefinition( + => new FieldMiddlewareConfiguration( next => { // we capture the auth middleware instance on the outer factory delegate. @@ -513,7 +513,7 @@ private DirectiveCollection GetOrCreateDirectives(RegisteredType registration) return (DirectiveCollection)directives; } - private void CompleteDirectiveTypes(IReadOnlyList directives) + private void CompleteDirectiveTypes(IReadOnlyList directives) { foreach (var directiveDef in directives) { @@ -521,7 +521,7 @@ private void CompleteDirectiveTypes(IReadOnlyList directive } } - private void CompleteDirectiveType(DirectiveDefinition directive) + private void CompleteDirectiveType(DirectiveConfiguration directive) { if (!_completedTypeRefs.Add(directive.Type)) { @@ -597,14 +597,14 @@ private RegisteredType GetTypeRegistration(TypeReference typeReference) } private static bool IsAuthorizedType(T definition) - where T : IHasDirectiveDefinition + where T : IDirectiveConfigurationProvider { if (!definition.HasDirectives) { return false; } - var directives = (List)definition.Directives; + var directives = (List)definition.Directives; var length = directives.Count; ref var start = ref MemoryMarshal.GetReference(CollectionsMarshal.AsSpan(directives)); @@ -642,7 +642,7 @@ private State CreateState() file static class AuthorizationTypeInterceptorExtensions { - public static bool IsNodeField(this ObjectFieldDefinition fieldDef) + public static bool IsNodeField(this ObjectFieldConfiguration fieldDef) { var contextData = fieldDef.GetContextData(); diff --git a/src/HotChocolate/Core/src/Authorization/AuthorizeDirectiveType.cs b/src/HotChocolate/Core/src/Authorization/AuthorizeDirectiveType.cs index 31efd27074d..771abaaffce 100644 --- a/src/HotChocolate/Core/src/Authorization/AuthorizeDirectiveType.cs +++ b/src/HotChocolate/Core/src/Authorization/AuthorizeDirectiveType.cs @@ -56,10 +56,10 @@ protected override void Configure(IDirectiveTypeDescriptor d public void ApplyConfiguration( IDescriptorContext context, DirectiveNode directiveNode, - IDefinition definition, - Stack path) + ITypeSystemConfiguration definition, + Stack path) { - ((IHasDirectiveDefinition)definition).Directives.Add(new(directiveNode)); + ((IDirectiveConfigurationProvider)definition).Directives.Add(new(directiveNode)); if (IsValidationAuthRule(directiveNode)) { diff --git a/src/HotChocolate/Core/src/Execution/DependencyInjection/SchemaRequestExecutorBuilderExtensions.Middleware.cs b/src/HotChocolate/Core/src/Execution/DependencyInjection/SchemaRequestExecutorBuilderExtensions.Middleware.cs index eb3a97047fd..2f464321dd1 100644 --- a/src/HotChocolate/Core/src/Execution/DependencyInjection/SchemaRequestExecutorBuilderExtensions.Middleware.cs +++ b/src/HotChocolate/Core/src/Execution/DependencyInjection/SchemaRequestExecutorBuilderExtensions.Middleware.cs @@ -136,7 +136,7 @@ value is FieldMiddlewareLookup lookup && public override void OnAfterCompleteName( ITypeCompletionContext completionContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { if (!CanHandle(completionContext)) { @@ -162,7 +162,7 @@ public override void OnAfterCompleteName( { if (middlewareRef.Reference.FieldName.Equals(field.Name)) { - var middlewareDefinition = new FieldMiddlewareDefinition( + var middlewareDefinition = new FieldMiddlewareConfiguration( middlewareRef.Middleware); field.MiddlewareDefinitions.Add(middlewareDefinition); } diff --git a/src/HotChocolate/Core/src/Execution/RequestExecutorResolver.cs b/src/HotChocolate/Core/src/Execution/RequestExecutorResolver.cs index b288c056b71..51d8ee2f455 100644 --- a/src/HotChocolate/Core/src/Execution/RequestExecutorResolver.cs +++ b/src/HotChocolate/Core/src/Execution/RequestExecutorResolver.cs @@ -562,7 +562,7 @@ private sealed class SetSchemaNameInterceptor(string schemaName) : TypeIntercept { public override void OnBeforeCompleteName( ITypeCompletionContext completionContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { if (completionContext.IsSchema) { diff --git a/src/HotChocolate/Core/src/Execution/Requirements/RequirementsTypeInterceptor.cs b/src/HotChocolate/Core/src/Execution/Requirements/RequirementsTypeInterceptor.cs index 323c97d2982..0ed9b7a0f70 100644 --- a/src/HotChocolate/Core/src/Execution/Requirements/RequirementsTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Execution/Requirements/RequirementsTypeInterceptor.cs @@ -11,7 +11,7 @@ internal sealed class RequirementsTypeInterceptor : TypeInterceptor public override void OnBeforeCompleteName( ITypeCompletionContext completionContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { if (definition is SchemaTypeDefinition schema) { @@ -21,7 +21,7 @@ public override void OnBeforeCompleteName( public override void OnBeforeCompleteType( ITypeCompletionContext completionContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { if (definition is not ObjectTypeDefinition typeDef) { diff --git a/src/HotChocolate/Core/src/Fetching/DataLoaderRootFieldTypeInterceptor.cs b/src/HotChocolate/Core/src/Fetching/DataLoaderRootFieldTypeInterceptor.cs index f2a5c417b97..75a219efc75 100644 --- a/src/HotChocolate/Core/src/Fetching/DataLoaderRootFieldTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Fetching/DataLoaderRootFieldTypeInterceptor.cs @@ -42,7 +42,7 @@ public override void OnAfterResolveRootType( public override void OnBeforeCompleteType( ITypeCompletionContext completionContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { if (completionContext.Type == _queryType && definition is ObjectTypeDefinition typeDef) @@ -68,7 +68,7 @@ public override void OnBeforeCompleteType( { field.MiddlewareDefinitions.Insert( 0, - new FieldMiddlewareDefinition( + new FieldMiddlewareConfiguration( static next => context => { var options = context.RequestServices.GetRequiredService(); @@ -88,7 +88,7 @@ public override void OnBeforeCompleteType( } } - private static bool IsUsableFieldConnection(ObjectFieldDefinition field) + private static bool IsUsableFieldConnection(ObjectFieldConfiguration field) { var isConnection = (field.Flags & FieldFlags.Connection) == FieldFlags.Connection; var usesProjection = (field.Flags & FieldFlags.UsesProjections) == FieldFlags.UsesProjections; diff --git a/src/HotChocolate/Core/src/Fetching/Extensions/ObjectFieldDataLoaderExtensions.cs b/src/HotChocolate/Core/src/Fetching/Extensions/ObjectFieldDataLoaderExtensions.cs index d4b2706ce44..ddb8da03f48 100644 --- a/src/HotChocolate/Core/src/Fetching/Extensions/ObjectFieldDataLoaderExtensions.cs +++ b/src/HotChocolate/Core/src/Fetching/Extensions/ObjectFieldDataLoaderExtensions.cs @@ -22,7 +22,7 @@ public static IObjectFieldDescriptor UseDataLoader( this IObjectFieldDescriptor descriptor, Type dataLoaderType) { - FieldMiddlewareDefinition placeholder = new(_ => _ => default, key: DataLoader); + FieldMiddlewareConfiguration placeholder = new(_ => _ => default, key: DataLoader); if (!TryGetDataLoaderTypes(dataLoaderType, out var keyType, out var valueType)) { @@ -53,7 +53,7 @@ public static IObjectFieldDescriptor UseDataLoader( definition.Type = TypeReference.Create(schemaType, TypeContext.Output); definition.Configurations.Add( - new CompleteConfiguration( + new CompleteConfiguration( (_, def) => { CompileMiddleware( @@ -71,8 +71,8 @@ public static IObjectFieldDescriptor UseDataLoader( } private static void CompileMiddleware( - ObjectFieldDefinition definition, - FieldMiddlewareDefinition placeholder, + ObjectFieldConfiguration definition, + FieldMiddlewareConfiguration placeholder, Type keyType, Type valueType, Type dataLoaderType) diff --git a/src/HotChocolate/Core/src/Types.Abstractions/Types/ListType.cs b/src/HotChocolate/Core/src/Types.Abstractions/Types/ListType.cs index 583cc5ae1f5..4d2a27efcfc 100644 --- a/src/HotChocolate/Core/src/Types.Abstractions/Types/ListType.cs +++ b/src/HotChocolate/Core/src/Types.Abstractions/Types/ListType.cs @@ -6,7 +6,7 @@ namespace HotChocolate.Types; /// /// Represents a GraphQL list type. /// -public sealed class ListType : IType +public sealed class ListType : IWrapperType { /// /// Represents a GraphQL list type definition. @@ -25,6 +25,8 @@ public ListType(IType elementType) /// public IType ElementType { get; } + IType IWrapperType.InnerType => ElementType; + /// /// Gets the string representation of this instance. /// diff --git a/src/HotChocolate/Core/src/Types.Abstractions/Types/NonNullType.cs b/src/HotChocolate/Core/src/Types.Abstractions/Types/NonNullType.cs index 5b475179378..424c849d1e1 100644 --- a/src/HotChocolate/Core/src/Types.Abstractions/Types/NonNullType.cs +++ b/src/HotChocolate/Core/src/Types.Abstractions/Types/NonNullType.cs @@ -4,7 +4,7 @@ namespace HotChocolate.Types; -public sealed class NonNullType : IType +public sealed class NonNullType : IWrapperType { public NonNullType(IType nullableType) { @@ -24,6 +24,8 @@ public NonNullType(IType nullableType) public IType NullableType { get; } + IType IWrapperType.InnerType => NullableType; + public override string ToString() => FormatTypeRef(this).ToString(true); diff --git a/src/HotChocolate/Core/src/Types.CursorPagination/ConnectionType.cs b/src/HotChocolate/Core/src/Types.CursorPagination/ConnectionType.cs index acbf60a1005..723589fbc97 100644 --- a/src/HotChocolate/Core/src/Types.CursorPagination/ConnectionType.cs +++ b/src/HotChocolate/Core/src/Types.CursorPagination/ConnectionType.cs @@ -139,7 +139,7 @@ internal ConnectionType(TypeReference nodeType, bool includeTotalCount, bool inc protected override void OnBeforeRegisterDependencies( ITypeDiscoveryContext context, - DefinitionBase definition) + TypeSystemConfiguration definition) { context.Dependencies.Add(new( context.TypeInspector.GetOutputTypeRef(typeof(PageInfoType)))); @@ -147,7 +147,7 @@ protected override void OnBeforeRegisterDependencies( base.OnBeforeRegisterDependencies(context, definition); } - protected override void OnBeforeCompleteType(ITypeCompletionContext context, DefinitionBase definition) + protected override void OnBeforeCompleteType(ITypeCompletionContext context, TypeSystemConfiguration definition) { Definition!.IsOfType = IsOfTypeWithRuntimeType; base.OnBeforeCompleteType(context, definition); @@ -205,10 +205,10 @@ private static ObjectTypeDefinition CreateTypeDefinition( return definition; } - private static bool IsEdgesField(ObjectFieldDefinition field) + private static bool IsEdgesField(ObjectFieldConfiguration field) => (field.Flags & FieldFlags.ConnectionEdgesField) == FieldFlags.ConnectionEdgesField; - private static bool IsNodesField(ObjectFieldDefinition field) + private static bool IsNodesField(ObjectFieldConfiguration field) => (field.Flags & FieldFlags.ConnectionNodesField) == FieldFlags.ConnectionNodesField; private static IPageInfo GetPagingInfo(IResolverContext context) diff --git a/src/HotChocolate/Core/src/Types.CursorPagination/Extensions/PagingObjectFieldDescriptorExtensions.cs b/src/HotChocolate/Core/src/Types.CursorPagination/Extensions/PagingObjectFieldDescriptorExtensions.cs index 5e085d5e4ce..b19f9c05e25 100644 --- a/src/HotChocolate/Core/src/Types.CursorPagination/Extensions/PagingObjectFieldDescriptorExtensions.cs +++ b/src/HotChocolate/Core/src/Types.CursorPagination/Extensions/PagingObjectFieldDescriptorExtensions.cs @@ -288,7 +288,7 @@ public static IInterfaceFieldDescriptor AddPagingArguments( } private static void CreatePagingArguments( - IList arguments, + IList arguments, bool allowBackwardPagination) { var intType = TypeReference.Parse(ScalarNames.Int); @@ -305,7 +305,7 @@ private static void CreatePagingArguments( } private static void AddOrUpdate( - this IList arguments, + this IList arguments, string name, string description, TypeReference type) diff --git a/src/HotChocolate/Core/src/Types.CursorPagination/Extensions/UseConnectionAttribute.cs b/src/HotChocolate/Core/src/Types.CursorPagination/Extensions/UseConnectionAttribute.cs index a319cc8f1a1..e911e88580d 100644 --- a/src/HotChocolate/Core/src/Types.CursorPagination/Extensions/UseConnectionAttribute.cs +++ b/src/HotChocolate/Core/src/Types.CursorPagination/Extensions/UseConnectionAttribute.cs @@ -129,14 +129,14 @@ protected internal override void TryConfigure( new CreateConfiguration( (_, d) => { - ((ObjectFieldDefinition)d).State = - ((ObjectFieldDefinition)d).State.SetItem( + ((ObjectFieldConfiguration)d).State = + ((ObjectFieldConfiguration)d).State.SetItem( WellKnownContextData.PagingOptions, options); }, definition)); definition.Configurations.Add( - new CompleteConfiguration( + new CompleteConfiguration( (c, d) => ApplyPagingOptions(c.DescriptorContext, d, options), definition, ApplyConfigurationOn.BeforeCompletion)); @@ -144,7 +144,7 @@ protected internal override void TryConfigure( static void ApplyPagingOptions( IDescriptorContext context, - ObjectFieldDefinition definition, + ObjectFieldConfiguration definition, PagingOptions options) { options = context.GetPagingOptions(options); diff --git a/src/HotChocolate/Core/src/Types.Errors/ErrorTypeHelper.cs b/src/HotChocolate/Core/src/Types.Errors/ErrorTypeHelper.cs index 22c34613421..42beaf59e99 100644 --- a/src/HotChocolate/Core/src/Types.Errors/ErrorTypeHelper.cs +++ b/src/HotChocolate/Core/src/Types.Errors/ErrorTypeHelper.cs @@ -22,7 +22,7 @@ public ExtendedTypeReference ErrorTypeInterfaceRef } public IReadOnlyList GetErrorDefinitions( - ObjectFieldDefinition field) + ObjectFieldConfiguration field) { var errorTypes = GetErrorResultTypes(field); @@ -94,7 +94,7 @@ static void CreateErrorDefinitions( } } - private static Type[] GetErrorResultTypes(ObjectFieldDefinition mutation) + private static Type[] GetErrorResultTypes(ObjectFieldConfiguration mutation) { var resultType = mutation.ResultType; diff --git a/src/HotChocolate/Core/src/Types.Errors/Extensions/ErrorObjectFieldDefinitionExtensions.cs b/src/HotChocolate/Core/src/Types.Errors/Extensions/ErrorObjectFieldDefinitionExtensions.cs index 4e851696ec3..329bf7fae4b 100644 --- a/src/HotChocolate/Core/src/Types.Errors/Extensions/ErrorObjectFieldDefinitionExtensions.cs +++ b/src/HotChocolate/Core/src/Types.Errors/Extensions/ErrorObjectFieldDefinitionExtensions.cs @@ -4,7 +4,7 @@ namespace HotChocolate.Types; /// -/// Provides extensions to the for the mutation convention. +/// Provides extensions to the for the mutation convention. /// public static class ErrorObjectFieldDefinitionExtensions { @@ -19,7 +19,7 @@ public static class ErrorObjectFieldDefinitionExtensions /// as the argument. See the examples in . /// public static void AddErrorType( - this ObjectFieldDefinition fieldDefinition, + this ObjectFieldConfiguration fieldDefinition, IDescriptorContext descriptorContext, Type errorType) { diff --git a/src/HotChocolate/Core/src/Types.Errors/MutationErrorHandler.cs b/src/HotChocolate/Core/src/Types.Errors/MutationErrorHandler.cs index 3add9baf04d..166c9d8ff9b 100644 --- a/src/HotChocolate/Core/src/Types.Errors/MutationErrorHandler.cs +++ b/src/HotChocolate/Core/src/Types.Errors/MutationErrorHandler.cs @@ -29,5 +29,5 @@ public virtual IEnumerable OnResolveDependencies( /// public abstract void OnConfigure( IDescriptorContext context, - ObjectFieldDefinition mutationField); + ObjectFieldConfiguration mutationField); } diff --git a/src/HotChocolate/Core/src/Types.Errors/MutationErrorTypeInterceptor.cs b/src/HotChocolate/Core/src/Types.Errors/MutationErrorTypeInterceptor.cs index 207bbe9b0b1..98eaac0c55f 100644 --- a/src/HotChocolate/Core/src/Types.Errors/MutationErrorTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types.Errors/MutationErrorTypeInterceptor.cs @@ -24,6 +24,6 @@ public override IEnumerable RegisterMoreTypes( public override void OnBeforeCompleteMutationField( ITypeCompletionContext completionContext, - ObjectFieldDefinition mutationField) + ObjectFieldConfiguration mutationField) => errorRegistrar.OnConfigure(completionContext.DescriptorContext, mutationField); } diff --git a/src/HotChocolate/Core/src/Types.Json/FromJsonSchemaDirective.cs b/src/HotChocolate/Core/src/Types.Json/FromJsonSchemaDirective.cs index 2812c097857..2d01de16197 100644 --- a/src/HotChocolate/Core/src/Types.Json/FromJsonSchemaDirective.cs +++ b/src/HotChocolate/Core/src/Types.Json/FromJsonSchemaDirective.cs @@ -12,13 +12,13 @@ internal sealed class FromJsonSchemaDirective : ISchemaDirective public void ApplyConfiguration( IDescriptorContext context, DirectiveNode directiveNode, - IDefinition definition, - Stack path) + ITypeSystemConfiguration definition, + Stack path) { - if (definition is ObjectFieldDefinition fieldDef) + if (definition is ObjectFieldConfiguration fieldDef) { fieldDef.Configurations.Add( - new CompleteConfiguration( + new CompleteConfiguration( (ctx, def) => { var propertyName = GetPropertyName(directiveNode); diff --git a/src/HotChocolate/Core/src/Types.Json/JsonObjectTypeExtensions.cs b/src/HotChocolate/Core/src/Types.Json/JsonObjectTypeExtensions.cs index 7c2776c80df..3d41cb1e1fb 100644 --- a/src/HotChocolate/Core/src/Types.Json/JsonObjectTypeExtensions.cs +++ b/src/HotChocolate/Core/src/Types.Json/JsonObjectTypeExtensions.cs @@ -98,14 +98,14 @@ public static IObjectFieldDescriptor FromJson( return descriptor; } - internal static void InferListResolver(ObjectFieldDefinition def) + internal static void InferListResolver(ObjectFieldConfiguration def) { def.PureResolver = ctx => new ValueTask(ctx.ToEnumerable()); } internal static void InferResolver( ITypeSystemObject type, - ObjectFieldDefinition def, + ObjectFieldConfiguration def, ScalarType scalarType, string propertyName) { diff --git a/src/HotChocolate/Core/src/Types.Mutations/MutationContextData.cs b/src/HotChocolate/Core/src/Types.Mutations/MutationContextData.cs index c220ac71df8..d61e0913944 100644 --- a/src/HotChocolate/Core/src/Types.Mutations/MutationContextData.cs +++ b/src/HotChocolate/Core/src/Types.Mutations/MutationContextData.cs @@ -5,7 +5,7 @@ namespace HotChocolate.Types; /// on the context so that the type interceptor can access them. /// internal sealed class MutationContextData( - ObjectFieldDefinition definition, + ObjectFieldConfiguration definition, string? inputTypeName, string? inputArgumentName, string? payloadTypeName, @@ -16,7 +16,7 @@ internal sealed class MutationContextData( { public string Name => Definition.Name; - public ObjectFieldDefinition Definition { get; } = definition; + public ObjectFieldConfiguration Definition { get; } = definition; public string? InputTypeName { get; } = inputTypeName; diff --git a/src/HotChocolate/Core/src/Types.Mutations/MutationConventionTypeInterceptor.cs b/src/HotChocolate/Core/src/Types.Mutations/MutationConventionTypeInterceptor.cs index 192e13a07bb..4add84d5110 100644 --- a/src/HotChocolate/Core/src/Types.Mutations/MutationConventionTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types.Mutations/MutationConventionTypeInterceptor.cs @@ -20,7 +20,7 @@ internal sealed class MutationConventionTypeInterceptor : TypeInterceptor private List _mutations = default!; private ITypeCompletionContext _completionContext = default!; private ObjectTypeDefinition? _mutationTypeDef; - private FieldMiddlewareDefinition? _errorNullMiddleware; + private FieldMiddlewareConfiguration? _errorNullMiddleware; private TypeInterceptor[] _siblings = []; internal override void InitializeContext( @@ -62,7 +62,7 @@ internal override void SetSiblings(TypeInterceptor[] all) public override void OnBeforeRegisterDependencies( ITypeDiscoveryContext discoveryContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { // we will use the error interface and implement it with each error type. if (definition is ObjectTypeDefinition objectTypeDef) @@ -143,9 +143,9 @@ internal override void OnBeforeCompleteMutation( } } - private static void ApplyResultMiddleware(ObjectFieldDefinition mutation) + private static void ApplyResultMiddleware(ObjectFieldConfiguration mutation) { - var middlewareDef = new FieldMiddlewareDefinition( + var middlewareDef = new FieldMiddlewareConfiguration( next => async context => { await next(context).ConfigureAwait(false); @@ -177,7 +177,7 @@ private static void ApplyResultMiddleware(ObjectFieldDefinition mutation) private void TryApplyInputConvention( IResolverCompiler resolverCompiler, - ObjectFieldDefinition mutation, + ObjectFieldConfiguration mutation, Options options) { if (mutation.Arguments.Count is 0) @@ -257,7 +257,7 @@ private void TryApplyInputConvention( } var argumentMiddleware = - new FieldMiddlewareDefinition( + new FieldMiddlewareConfiguration( Create( (typeof(string), options.InputArgumentName), (typeof(IReadOnlyList), resolverArguments)), @@ -270,7 +270,7 @@ private void TryApplyInputConvention( } private void TryApplyPayloadConvention( - ObjectFieldDefinition mutation, + ObjectFieldConfiguration mutation, string? payloadFieldName, Options options) { @@ -350,7 +350,7 @@ private void TryApplyPayloadConvention( // next we create a null middleware which will return null for any payload // field that we have on the payload type if a mutation error was returned. var nullMiddleware = _errorNullMiddleware ??= - new FieldMiddlewareDefinition( + new FieldMiddlewareConfiguration( Create(), key: MutationErrorNull, isRepeatable: false); @@ -392,7 +392,7 @@ private void TryApplyPayloadConvention( RegisterErrorType(CreateErrorType(errorTypeName, errorDefinitions), mutation.Name); var errorListTypeRef = Parse($"[{errorTypeName}!]"); payloadTypeDef.Fields.Add( - new ObjectFieldDefinition( + new ObjectFieldConfiguration( options.PayloadErrorsFieldName, type: errorListTypeRef, pureResolver: ctx => @@ -406,7 +406,7 @@ private void TryApplyPayloadConvention( // create middleware var errorMiddleware = - new FieldMiddlewareDefinition( + new FieldMiddlewareConfiguration( Create( (typeof(IReadOnlyList), errorFactories)), key: MutationErrors, @@ -436,7 +436,7 @@ private void TryApplyPayloadConvention( // create middleware var errorMiddleware = - new FieldMiddlewareDefinition( + new FieldMiddlewareConfiguration( Create( (typeof(IReadOnlyList), errorFactories)), key: MutationErrors, @@ -464,13 +464,13 @@ private void TryApplyPayloadConvention( private static InputObjectType CreateInputType( string typeName, - ObjectFieldDefinition fieldDef) + ObjectFieldConfiguration fieldDef) { - var inputObjectDef = new InputObjectTypeDefinition(typeName); + var inputObjectDef = new InputObjectTypeConfiguration(typeName); foreach (var argumentDef in fieldDef.Arguments) { - var inputFieldDef = new InputFieldDefinition(); + var inputFieldDef = new InputFieldConfiguration(); argumentDef.CopyTo(inputFieldDef); inputFieldDef.RuntimeType = @@ -490,7 +490,7 @@ private static ObjectType CreatePayloadType( { var objectDef = new ObjectTypeDefinition(typeName); - var dataFieldDef = new ObjectFieldDefinition( + var dataFieldDef = new ObjectFieldConfiguration( data.Name, type: data.Type, pureResolver: ctx => @@ -512,7 +512,7 @@ private static ObjectType CreatePayloadType( // field to the payload type. if (error is not null) { - var errorFieldDef = new ObjectFieldDefinition( + var errorFieldDef = new ObjectFieldConfiguration( error.Value.Name, type: error.Value.Type, pureResolver: ctx => diff --git a/src/HotChocolate/Core/src/Types.Mutations/MutationDirective.cs b/src/HotChocolate/Core/src/Types.Mutations/MutationDirective.cs index 7db562d346c..541210cd86e 100644 --- a/src/HotChocolate/Core/src/Types.Mutations/MutationDirective.cs +++ b/src/HotChocolate/Core/src/Types.Mutations/MutationDirective.cs @@ -10,16 +10,16 @@ internal sealed class MutationDirective : ISchemaDirective public void ApplyConfiguration( IDescriptorContext context, DirectiveNode directiveNode, - IDefinition definition, - Stack path) + ITypeSystemConfiguration definition, + Stack path) { - if (definition is not ObjectFieldDefinition fieldDef) + if (definition is not ObjectFieldConfiguration fieldDef) { throw ThrowHelper.MutationConventionDirective_In_Wrong_Location(directiveNode); } fieldDef.Configurations.Add( - new CompleteConfiguration( + new CompleteConfiguration( (c, d) => { c.ContextData @@ -32,7 +32,7 @@ public void ApplyConfiguration( private static MutationContextData CreateMutationContextData( DirectiveNode directiveNode, - ObjectFieldDefinition fieldDef) + ObjectFieldConfiguration fieldDef) { var data = new MutationDirectiveData { Enabled = true, }; var args = directiveNode.Arguments; diff --git a/src/HotChocolate/Core/src/Types.OffsetPagination/CollectionSegmentType~1.cs b/src/HotChocolate/Core/src/Types.OffsetPagination/CollectionSegmentType~1.cs index 89e11731cb0..003812df7e2 100644 --- a/src/HotChocolate/Core/src/Types.OffsetPagination/CollectionSegmentType~1.cs +++ b/src/HotChocolate/Core/src/Types.OffsetPagination/CollectionSegmentType~1.cs @@ -65,7 +65,7 @@ internal CollectionSegmentType( protected override void OnBeforeRegisterDependencies( ITypeDiscoveryContext context, - DefinitionBase definition) + TypeSystemConfiguration definition) { var typeRef = context.TypeInspector.GetOutputTypeRef(typeof(CollectionSegmentInfoType)); context.Dependencies.Add(new(typeRef)); @@ -116,7 +116,7 @@ private static IPageInfo GetPagingInfo(IResolverContext context) private static object GetTotalCount(IResolverContext context) => context.Parent().TotalCount; - private static bool IsItemsField(ObjectFieldDefinition field) + private static bool IsItemsField(ObjectFieldConfiguration field) => (field.Flags & FieldFlags.ItemsField) == FieldFlags.ItemsField; internal static class Names diff --git a/src/HotChocolate/Core/src/Types.Queries/QueryConventionTypeInterceptor.cs b/src/HotChocolate/Core/src/Types.Queries/QueryConventionTypeInterceptor.cs index 100f4081f8d..3796f460c51 100644 --- a/src/HotChocolate/Core/src/Types.Queries/QueryConventionTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types.Queries/QueryConventionTypeInterceptor.cs @@ -39,7 +39,7 @@ public override void OnAfterResolveRootType( public override void OnAfterCompleteName( ITypeCompletionContext completionContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { if (completionContext.Type is ObjectType && definition is ObjectTypeDefinition typeDef) { @@ -144,7 +144,7 @@ public override void OnBeforeCompleteTypes() // create middleware var errorMiddleware = - new FieldMiddlewareDefinition( + new FieldMiddlewareConfiguration( FieldClassMiddlewareFactory.Create( (typeof(IReadOnlyList), errorFactories)), key: "Query Results", diff --git a/src/HotChocolate/Core/src/Types/Configuration/AggregateTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/Configuration/AggregateTypeInterceptor.cs index 9c06d970885..fccd92e52c0 100644 --- a/src/HotChocolate/Core/src/Types/Configuration/AggregateTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/Configuration/AggregateTypeInterceptor.cs @@ -162,7 +162,7 @@ public override void OnBeforeInitialize( public override void OnAfterInitialize( ITypeDiscoveryContext discoveryContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { ref var first = ref GetReference(); var length = _typeInterceptors.Length; @@ -214,7 +214,7 @@ public override void OnTypesInitialized() public override void OnAfterRegisterDependencies( ITypeDiscoveryContext discoveryContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { ref var first = ref GetReference(); var length = _typeInterceptors.Length; @@ -227,7 +227,7 @@ public override void OnAfterRegisterDependencies( public override void OnBeforeRegisterDependencies( ITypeDiscoveryContext discoveryContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { ref var first = ref GetReference(); var length = _typeInterceptors.Length; @@ -262,7 +262,7 @@ public override void OnAfterCompleteTypeNames() public override void OnBeforeCompleteName( ITypeCompletionContext completionContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { ref var first = ref GetReference(); var length = _typeInterceptors.Length; @@ -275,7 +275,7 @@ public override void OnBeforeCompleteName( public override void OnAfterCompleteName( ITypeCompletionContext completionContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { ref var first = ref GetReference(); var length = _typeInterceptors.Length; @@ -379,7 +379,7 @@ public override void OnAfterCompleteTypes() public override void OnBeforeCompleteType( ITypeCompletionContext completionContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { ref var first = ref GetReference(); var length = _typeInterceptors.Length; @@ -392,7 +392,7 @@ public override void OnBeforeCompleteType( public override void OnAfterCompleteType( ITypeCompletionContext completionContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { ref var first = ref GetReference(); var length = _typeInterceptors.Length; @@ -427,7 +427,7 @@ public override void OnAfterCompleteMetadata() public override void OnBeforeCompleteMetadata( ITypeCompletionContext context, - DefinitionBase definition) + TypeSystemConfiguration definition) { ref var first = ref GetReference(); var length = _typeInterceptors.Length; @@ -440,7 +440,7 @@ public override void OnBeforeCompleteMetadata( public override void OnAfterCompleteMetadata( ITypeCompletionContext context, - DefinitionBase definition) + TypeSystemConfiguration definition) { ref var first = ref GetReference(); var length = _typeInterceptors.Length; @@ -475,7 +475,7 @@ public override void OnAfterMakeExecutable() public override void OnBeforeMakeExecutable( ITypeCompletionContext context, - DefinitionBase definition) + TypeSystemConfiguration definition) { ref var first = ref GetReference(); var length = _typeInterceptors.Length; @@ -488,7 +488,7 @@ public override void OnBeforeMakeExecutable( public override void OnAfterMakeExecutable( ITypeCompletionContext context, - DefinitionBase definition) + TypeSystemConfiguration definition) { ref var first = ref GetReference(); var length = _typeInterceptors.Length; @@ -501,7 +501,7 @@ public override void OnAfterMakeExecutable( public override void OnValidateType( ITypeSystemObjectContext validationContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { ref var first = ref GetReference(); var length = _typeInterceptors.Length; diff --git a/src/HotChocolate/Core/src/Types/Configuration/OnCompleteType.cs b/src/HotChocolate/Core/src/Types/Configuration/OnCompleteType.cs index 68a98666139..ab02512fd43 100644 --- a/src/HotChocolate/Core/src/Types/Configuration/OnCompleteType.cs +++ b/src/HotChocolate/Core/src/Types/Configuration/OnCompleteType.cs @@ -9,5 +9,5 @@ namespace HotChocolate.Configuration; /// public delegate void OnCompleteType( ITypeCompletionContext context, - DefinitionBase? definition, + TypeSystemConfiguration? definition, IDictionary contextData); diff --git a/src/HotChocolate/Core/src/Types/Configuration/OnCompleteType~1.cs b/src/HotChocolate/Core/src/Types/Configuration/OnCompleteType~1.cs index dd27700b82a..843e3d8f6de 100644 --- a/src/HotChocolate/Core/src/Types/Configuration/OnCompleteType~1.cs +++ b/src/HotChocolate/Core/src/Types/Configuration/OnCompleteType~1.cs @@ -12,4 +12,4 @@ public delegate void OnCompleteType( ITypeCompletionContext context, T? definition, IDictionary contextData) - where T : DefinitionBase; + where T : TypeSystemConfiguration; diff --git a/src/HotChocolate/Core/src/Types/Configuration/OnInitializeType.cs b/src/HotChocolate/Core/src/Types/Configuration/OnInitializeType.cs index 78f01be0e1e..30a6f3587cc 100644 --- a/src/HotChocolate/Core/src/Types/Configuration/OnInitializeType.cs +++ b/src/HotChocolate/Core/src/Types/Configuration/OnInitializeType.cs @@ -9,5 +9,5 @@ namespace HotChocolate.Configuration; /// public delegate void OnInitializeType( ITypeDiscoveryContext context, - DefinitionBase? definition, + TypeSystemConfiguration? definition, IDictionary contextData); diff --git a/src/HotChocolate/Core/src/Types/Configuration/OnInitializeType~1.cs b/src/HotChocolate/Core/src/Types/Configuration/OnInitializeType~1.cs index 565a10b914d..24fb141b239 100644 --- a/src/HotChocolate/Core/src/Types/Configuration/OnInitializeType~1.cs +++ b/src/HotChocolate/Core/src/Types/Configuration/OnInitializeType~1.cs @@ -12,4 +12,4 @@ public delegate void OnInitializeType( ITypeDiscoveryContext context, T? definition, IDictionary contextData) - where T : DefinitionBase; + where T : TypeSystemConfiguration; diff --git a/src/HotChocolate/Core/src/Types/Configuration/TypeInitializer.cs b/src/HotChocolate/Core/src/Types/Configuration/TypeInitializer.cs index fdd7bc5d4d6..b3761ee35c4 100644 --- a/src/HotChocolate/Core/src/Types/Configuration/TypeInitializer.cs +++ b/src/HotChocolate/Core/src/Types/Configuration/TypeInitializer.cs @@ -458,7 +458,7 @@ internal void CompileResolvers(RegisteredType registeredType) } private static FieldResolverDelegates CompileResolver( - ObjectFieldDefinition definition, + ObjectFieldConfiguration definition, IResolverCompiler resolverCompiler) { var resolvers = definition.Resolvers; @@ -509,7 +509,7 @@ private static FieldResolverDelegates CompileResolver( return resolvers; static void BuildArgumentLookup( - ObjectFieldDefinition definition, + ObjectFieldConfiguration definition, Dictionary argumentNames) { foreach (var argument in definition.Arguments) @@ -523,7 +523,7 @@ static void BuildArgumentLookup( } private static FieldResolverDelegates CompileResolver( - InterfaceFieldDefinition definition, + InterfaceFieldConfiguration definition, IResolverCompiler resolverCompiler) { var resolvers = definition.Resolvers; @@ -566,7 +566,7 @@ private static FieldResolverDelegates CompileResolver( return resolvers; static void BuildArgumentLookup( - InterfaceFieldDefinition definition, + InterfaceFieldConfiguration definition, Dictionary argumentNames) { foreach (var argument in definition.Arguments) diff --git a/src/HotChocolate/Core/src/Types/Configuration/TypeInterceptor.cs b/src/HotChocolate/Core/src/Types/Configuration/TypeInterceptor.cs index be1d108b089..e1a04968536 100644 --- a/src/HotChocolate/Core/src/Types/Configuration/TypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/Configuration/TypeInterceptor.cs @@ -102,7 +102,7 @@ public virtual void OnBeforeInitialize( /// public virtual void OnAfterInitialize( ITypeDiscoveryContext discoveryContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { } @@ -144,7 +144,7 @@ public virtual void OnTypesInitialized() { } /// public virtual void OnBeforeRegisterDependencies( ITypeDiscoveryContext discoveryContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { } @@ -160,7 +160,7 @@ public virtual void OnBeforeRegisterDependencies( /// public virtual void OnAfterRegisterDependencies( ITypeDiscoveryContext discoveryContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { } @@ -185,7 +185,7 @@ public virtual void OnAfterCompleteTypeNames() { } /// public virtual void OnBeforeCompleteName( ITypeCompletionContext completionContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { } @@ -200,7 +200,7 @@ public virtual void OnBeforeCompleteName( /// public virtual void OnAfterCompleteName( ITypeCompletionContext completionContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { } @@ -253,7 +253,7 @@ internal virtual void OnBeforeCompleteMutation( public virtual void OnBeforeCompleteMutationField( ITypeCompletionContext completionContext, - ObjectFieldDefinition mutationField) + ObjectFieldConfiguration mutationField) { } @@ -283,7 +283,7 @@ public virtual void OnAfterCompleteTypes() { } /// public virtual void OnBeforeCompleteType( ITypeCompletionContext completionContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { } @@ -298,7 +298,7 @@ public virtual void OnBeforeCompleteType( /// public virtual void OnAfterCompleteType( ITypeCompletionContext completionContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { } @@ -323,7 +323,7 @@ public virtual void OnAfterCompleteMetadata() { } /// public virtual void OnBeforeCompleteMetadata( ITypeCompletionContext context, - DefinitionBase definition) + TypeSystemConfiguration definition) { } @@ -338,7 +338,7 @@ public virtual void OnBeforeCompleteMetadata( /// public virtual void OnAfterCompleteMetadata( ITypeCompletionContext context, - DefinitionBase definition) + TypeSystemConfiguration definition) { } @@ -363,7 +363,7 @@ public virtual void OnAfterMakeExecutable() { } /// public virtual void OnBeforeMakeExecutable( ITypeCompletionContext context, - DefinitionBase definition) + TypeSystemConfiguration definition) { } @@ -378,7 +378,7 @@ public virtual void OnBeforeMakeExecutable( /// public virtual void OnAfterMakeExecutable( ITypeCompletionContext context, - DefinitionBase definition) + TypeSystemConfiguration definition) { } @@ -395,7 +395,7 @@ public virtual void OnAfterMakeExecutable( /// public virtual void OnValidateType( ITypeSystemObjectContext validationContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { } diff --git a/src/HotChocolate/Core/src/Types/Configuration/Validation/InputObjectTypeValidationRule.cs b/src/HotChocolate/Core/src/Types/Configuration/Validation/InputObjectTypeValidationRule.cs index b5a5bdb3a2f..4540cef30f5 100644 --- a/src/HotChocolate/Core/src/Types/Configuration/Validation/InputObjectTypeValidationRule.cs +++ b/src/HotChocolate/Core/src/Types/Configuration/Validation/InputObjectTypeValidationRule.cs @@ -97,7 +97,7 @@ private static void TryReachCycleRecursively( { if (type.Kind == TypeKind.NonNull) { - type = ((NonNullType)type).Type; + type = ((NonNullType)type).NullableType; } else { diff --git a/src/HotChocolate/Core/src/Types/Internal/FieldInitHelper.cs b/src/HotChocolate/Core/src/Types/Internal/FieldInitHelper.cs index c114c84834c..ae5e9322a00 100644 --- a/src/HotChocolate/Core/src/Types/Internal/FieldInitHelper.cs +++ b/src/HotChocolate/Core/src/Types/Internal/FieldInitHelper.cs @@ -14,7 +14,7 @@ public static class FieldInitHelper { internal static IValueNode? CompleteDefaultValue( ITypeCompletionContext context, - ArgumentDefinition argumentDefinition, + ArgumentConfiguration argumentDefinition, IInputType argumentType, SchemaCoordinate argumentCoordinate) { @@ -52,7 +52,7 @@ public static FieldCollection CompleteFields( ITypeSystemMember declaringMember, IReadOnlyList fieldDefs, Func fieldFactory) - where TFieldDefinition : FieldDefinitionBase + where TFieldDefinition : FieldConfiguration where TField : class, IField { if (context is null) @@ -89,7 +89,7 @@ public static FieldCollection CompleteFields( IEnumerable fieldDefs, Func fieldFactory, int maxFieldCount) - where TFieldDefinition : FieldDefinitionBase + where TFieldDefinition : FieldConfiguration where TField : class, IField { if (context is null) @@ -158,7 +158,7 @@ public static FieldCollection CompleteFieldsInternal fieldDefinitions, Func fieldFactory, int fieldCount) - where TFieldDefinition : FieldDefinitionBase + where TFieldDefinition : FieldConfiguration where TField : class, IField { var fieldDefs = fieldDefinitions.Where(t => !t.Ignore); diff --git a/src/HotChocolate/Core/src/Types/Internal/TypeDependencyHelper.cs b/src/HotChocolate/Core/src/Types/Internal/TypeDependencyHelper.cs index b971dbf076c..5ccfb99cf71 100644 --- a/src/HotChocolate/Core/src/Types/Internal/TypeDependencyHelper.cs +++ b/src/HotChocolate/Core/src/Types/Internal/TypeDependencyHelper.cs @@ -8,7 +8,7 @@ namespace HotChocolate.Internal; public static class TypeDependencyHelper { public static void CollectDependencies( - InterfaceTypeDefinition definition, + InterfaceTypeConfiguration definition, ICollection dependencies) { if (definition is null) @@ -76,7 +76,7 @@ public static void CollectDependencies( } public static void CollectDependencies( - InputObjectTypeDefinition definition, + InputObjectTypeConfiguration definition, ICollection dependencies) { if (definition is null) @@ -119,7 +119,7 @@ public static void CollectDependencies( } public static void CollectDependencies( - EnumTypeDefinition definition, + EnumTypeConfiguration definition, ICollection dependencies) { if (definition is null) @@ -157,7 +157,7 @@ public static void CollectDependencies( } public static void CollectDependencies( - DirectiveTypeDefinition definition, + DirectiveTypeConfiguration definition, ICollection dependencies) { if (definition.HasDependencies) @@ -202,7 +202,7 @@ internal static void CollectDirectiveDependencies( } private static void CollectDirectiveDependencies( - FieldDefinitionBase definition, + FieldConfiguration definition, ICollection dependencies) { if (definition.HasDirectives) @@ -215,7 +215,7 @@ private static void CollectDirectiveDependencies( } private static void CollectFieldDependencies( - IReadOnlyList fields, + IReadOnlyList fields, ICollection dependencies) { foreach (var field in fields) @@ -243,7 +243,7 @@ private static void CollectFieldDependencies( } private static void CollectArgumentDependencies( - IReadOnlyList fields, + IReadOnlyList fields, ICollection dependencies) { foreach (var field in fields) @@ -284,7 +284,7 @@ public static void RegisterDependencies( public static void RegisterDependencies( this ITypeDiscoveryContext context, - InterfaceTypeDefinition definition) + InterfaceTypeConfiguration definition) { if (context is null) { @@ -301,7 +301,7 @@ public static void RegisterDependencies( public static void RegisterDependencies( this ITypeDiscoveryContext context, - EnumTypeDefinition definition) + EnumTypeConfiguration definition) { if (context is null) { @@ -318,7 +318,7 @@ public static void RegisterDependencies( public static void RegisterDependencies( this ITypeDiscoveryContext context, - InputObjectTypeDefinition definition) + InputObjectTypeConfiguration definition) { if (context is null) { diff --git a/src/HotChocolate/Core/src/Types/Internal/TypeExtensionHelper.cs b/src/HotChocolate/Core/src/Types/Internal/TypeExtensionHelper.cs index dd8503a583f..581f1b81108 100644 --- a/src/HotChocolate/Core/src/Types/Internal/TypeExtensionHelper.cs +++ b/src/HotChocolate/Core/src/Types/Internal/TypeExtensionHelper.cs @@ -12,8 +12,8 @@ public static class TypeExtensionHelper { public static void MergeInterfaceFields( ITypeCompletionContext context, - IList extensionFields, - IList typeFields) + IList extensionFields, + IList typeFields) { MergeOutputFields(context, extensionFields, typeFields, (_, _, _) => { }); @@ -21,8 +21,8 @@ public static void MergeInterfaceFields( public static void MergeInputObjectFields( ITypeCompletionContext context, - IList extensionFields, - IList typeFields) + IList extensionFields, + IList typeFields) { MergeFields(context, extensionFields, typeFields, (_, extensionField, typeField) => @@ -40,7 +40,7 @@ private static void MergeOutputFields( IList typeFields, Action, T, T> action, Action? onBeforeAdd = null) - where T : OutputFieldDefinitionBase + where T : OutputFieldConfiguration { MergeFields(context, extensionFields, typeFields, (fields, extensionField, typeField) => @@ -68,7 +68,7 @@ private static void MergeFields( IList typeFields, Action, T, T> action, Action? onBeforeAdd = null) - where T : FieldDefinitionBase + where T : FieldConfiguration { foreach (var extensionField in extensionFields) { @@ -96,10 +96,10 @@ private static void MergeFields( public static void MergeDirectives( ITypeCompletionContext context, - IList extension, - IList type) + IList extension, + IList type) { - var directives = new List<(DirectiveType type, DirectiveDefinition def)>(); + var directives = new List<(DirectiveType type, DirectiveConfiguration def)>(); foreach (var directive in type) { @@ -124,8 +124,8 @@ public static void MergeDirectives( private static void MergeDirective( ITypeCompletionContext context, - IList<(DirectiveType type, DirectiveDefinition def)> directives, - DirectiveDefinition directive) + IList<(DirectiveType type, DirectiveConfiguration def)> directives, + DirectiveConfiguration directive) { if (context.TryGetDirectiveType(directive.Type, out var directiveType)) { @@ -150,8 +150,8 @@ private static void MergeDirective( } public static void MergeContextData( - DefinitionBase extension, - DefinitionBase type) + TypeSystemConfiguration extension, + TypeSystemConfiguration type) { if (extension.GetContextData().Count > 0) { @@ -194,8 +194,8 @@ public static void MergeTypes( } public static void MergeConfigurations( - ICollection extensionConfigurations, - ICollection typeConfigurations) + ICollection extensionConfigurations, + ICollection typeConfigurations) { foreach (var configuration in extensionConfigurations) { diff --git a/src/HotChocolate/Core/src/Types/Schema.Initialization.cs b/src/HotChocolate/Core/src/Types/Schema.Initialization.cs index dc4613e4a42..183355bae09 100644 --- a/src/HotChocolate/Core/src/Types/Schema.Initialization.cs +++ b/src/HotChocolate/Core/src/Types/Schema.Initialization.cs @@ -37,7 +37,7 @@ protected sealed override SchemaTypeDefinition CreateDefinition(ITypeDiscoveryCo protected override void OnAfterInitialize( ITypeDiscoveryContext context, - DefinitionBase definition) + TypeSystemConfiguration definition) { base.OnAfterInitialize(context, definition); diff --git a/src/HotChocolate/Core/src/Types/SemanticNonNullTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/SemanticNonNullTypeInterceptor.cs index d474790b4a8..340f18b2603 100644 --- a/src/HotChocolate/Core/src/Types/SemanticNonNullTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/SemanticNonNullTypeInterceptor.cs @@ -38,7 +38,7 @@ public override void OnAfterResolveRootType(ITypeCompletionContext completionCon } } - public override void OnBeforeCompleteType(ITypeCompletionContext completionContext, DefinitionBase definition) + public override void OnBeforeCompleteType(ITypeCompletionContext completionContext, TypeSystemConfiguration definition) { if (completionContext.IsIntrospectionType) { @@ -89,7 +89,7 @@ public override void OnBeforeCompleteType(ITypeCompletionContext completionConte field.FormatterDefinitions.Add(CreateSemanticNonNullResultFormatterDefinition(levels)); } } - else if (definition is InterfaceTypeDefinition interfaceDef) + else if (definition is InterfaceTypeConfiguration interfaceDef) { if (interfaceDef.Name == "Node") { @@ -117,7 +117,7 @@ public override void OnBeforeCompleteType(ITypeCompletionContext completionConte } private void ApplySemanticNonNullDirective( - OutputFieldDefinitionBase field, + OutputFieldConfiguration field, ITypeCompletionContext completionContext, HashSet levels) { @@ -296,7 +296,7 @@ private static ITypeNode BuildNullableTypeStructure(ITypeNode typeNode) return typeNode; } - private static ResultFormatterDefinition CreateSemanticNonNullResultFormatterDefinition(HashSet levels) + private static ResultFormatterConfiguration CreateSemanticNonNullResultFormatterDefinition(HashSet levels) => new((context, result) => { CheckResultForSemanticNonNullViolations(result, context, context.Path, levels, 0); diff --git a/src/HotChocolate/Core/src/Types/StoreGlobalPagingOptionsTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/StoreGlobalPagingOptionsTypeInterceptor.cs index 42e1eb9bb43..defceae8c64 100644 --- a/src/HotChocolate/Core/src/Types/StoreGlobalPagingOptionsTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/StoreGlobalPagingOptionsTypeInterceptor.cs @@ -10,7 +10,7 @@ internal sealed class StoreGlobalPagingOptionsTypeInterceptor : TypeInterceptor { public override void OnBeforeCompleteType( ITypeCompletionContext completionContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { if(definition is SchemaTypeDefinition schemaDef) { diff --git a/src/HotChocolate/Core/src/Types/Types/Argument.cs b/src/HotChocolate/Core/src/Types/Types/Argument.cs index 340a8cfe0c5..590d07015d9 100644 --- a/src/HotChocolate/Core/src/Types/Types/Argument.cs +++ b/src/HotChocolate/Core/src/Types/Types/Argument.cs @@ -24,7 +24,7 @@ public class Argument : FieldBase, IInputField /// /// The position of this argument within its field collection. /// - public Argument(ArgumentDefinition definition, int index) + public Argument(ArgumentConfiguration definition, int index) : base(definition, index) { DefaultValue = definition.DefaultValue; @@ -79,13 +79,13 @@ public Argument(ArgumentDefinition definition, int index) protected sealed override void OnCompleteField( ITypeCompletionContext context, ITypeSystemMember declaringMember, - FieldDefinitionBase definition) - => OnCompleteField(context, declaringMember, (ArgumentDefinition)definition); + FieldConfiguration definition) + => OnCompleteField(context, declaringMember, (ArgumentConfiguration)definition); protected virtual void OnCompleteField( ITypeCompletionContext context, ITypeSystemMember declaringMember, - ArgumentDefinition definition) + ArgumentConfiguration definition) { if (definition.Type is null) { @@ -110,13 +110,13 @@ protected virtual void OnCompleteField( protected sealed override void OnCompleteMetadata( ITypeCompletionContext context, ITypeSystemMember declaringMember, - FieldDefinitionBase definition) - => OnCompleteMetadata(context, declaringMember, (ArgumentDefinition)definition); + FieldConfiguration definition) + => OnCompleteMetadata(context, declaringMember, (ArgumentConfiguration)definition); protected virtual void OnCompleteMetadata( ITypeCompletionContext context, ITypeSystemMember declaringMember, - ArgumentDefinition definition) + ArgumentConfiguration definition) { DefaultValue = CompleteDefaultValue(context, definition, Type, Coordinate); base.OnCompleteMetadata(context, declaringMember, definition); @@ -125,25 +125,25 @@ protected virtual void OnCompleteMetadata( protected sealed override void OnMakeExecutable( ITypeCompletionContext context, ITypeSystemMember declaringMember, - FieldDefinitionBase definition) - => OnMakeExecutable(context, declaringMember, (ArgumentDefinition)definition); + FieldConfiguration definition) + => OnMakeExecutable(context, declaringMember, (ArgumentConfiguration)definition); protected virtual void OnMakeExecutable( ITypeCompletionContext context, ITypeSystemMember declaringMember, - ArgumentDefinition definition) => + ArgumentConfiguration definition) => base.OnMakeExecutable(context, declaringMember, definition); protected sealed override void OnFinalizeField( ITypeCompletionContext context, ITypeSystemMember declaringMember, - FieldDefinitionBase definition) - => OnFinalizeField(context, declaringMember, (ArgumentDefinition)definition); + FieldConfiguration definition) + => OnFinalizeField(context, declaringMember, (ArgumentConfiguration)definition); protected virtual void OnFinalizeField( ITypeCompletionContext context, ITypeSystemMember declaringMember, - ArgumentDefinition definition) => + ArgumentConfiguration definition) => base.OnFinalizeField(context, declaringMember, definition); /// diff --git a/src/HotChocolate/Core/src/Types/Types/Attributes/SubscribeAttribute.cs b/src/HotChocolate/Core/src/Types/Types/Attributes/SubscribeAttribute.cs index 142984a29a5..ffd708710f7 100644 --- a/src/HotChocolate/Core/src/Types/Types/Attributes/SubscribeAttribute.cs +++ b/src/HotChocolate/Core/src/Types/Types/Attributes/SubscribeAttribute.cs @@ -106,7 +106,7 @@ private static string ResolveTopicString(MethodInfo method) } private static void SubscribeFactory( - ObjectFieldDefinition fieldDef, + ObjectFieldConfiguration fieldDef, string topicString) { var arg = false; diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/ArgumentDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/ArgumentDescriptor.cs index 2de3f44a33b..50e358bf1c7 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/ArgumentDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/ArgumentDescriptor.cs @@ -10,7 +10,7 @@ namespace HotChocolate.Types.Descriptors; /// A fluent configuration API for GraphQL arguments. /// public class ArgumentDescriptor - : ArgumentDescriptorBase + : ArgumentDescriptorBase , IArgumentDescriptor { /// @@ -70,14 +70,14 @@ protected internal ArgumentDescriptor( /// protected internal ArgumentDescriptor( IDescriptorContext context, - ArgumentDefinition definition) + ArgumentConfiguration definition) : base(context) { Definition = definition ?? throw new ArgumentNullException(nameof(definition)); } /// - protected override void OnCreateDefinition(ArgumentDefinition definition) + protected override void OnCreateDefinition(ArgumentConfiguration definition) { Context.Descriptors.Push(this); @@ -228,6 +228,6 @@ public static ArgumentDescriptor New( /// An instance of public static ArgumentDescriptor From( IDescriptorContext context, - ArgumentDefinition argumentDefinition) => + ArgumentConfiguration argumentDefinition) => new(context, argumentDefinition); } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/ArgumentDescriptorBase~1.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/ArgumentDescriptorBase~1.cs index 31ff38cf5c7..16bd65be7a2 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/ArgumentDescriptorBase~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/ArgumentDescriptorBase~1.cs @@ -10,8 +10,8 @@ namespace HotChocolate.Types.Descriptors; /// /// A fluent configuration API for GraphQL arguments. /// -/// The type of the -public class ArgumentDescriptorBase : DescriptorBase where T : ArgumentDefinition, new() +/// The type of the +public class ArgumentDescriptorBase : DescriptorBase where T : ArgumentConfiguration, new() { /// /// Creates a new instance of diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IArgumentDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IArgumentDescriptor.cs index 7e68888ca40..9c886176808 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IArgumentDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IArgumentDescriptor.cs @@ -4,7 +4,7 @@ namespace HotChocolate.Types; public interface IArgumentDescriptor - : IDescriptor + : IDescriptor , IFluent { /// diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IDescriptorExtension.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IDescriptorExtension.cs index ae1b27161cc..076a73c4e37 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IDescriptorExtension.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IDescriptorExtension.cs @@ -8,13 +8,13 @@ namespace HotChocolate.Types; public interface IDescriptorExtension : IHasDescriptorContext { - void OnBeforeCreate(Action configure); + void OnBeforeCreate(Action configure); - void OnBeforeCreate(Action configure); + void OnBeforeCreate(Action configure); INamedDependencyDescriptor OnBeforeNaming( - Action configure); + Action configure); ICompletedDependencyDescriptor OnBeforeCompletion( - Action configure); + Action configure); } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IDescriptorExtension~1.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IDescriptorExtension~1.cs index 092a2d4f384..7d5b5a5ffac 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IDescriptorExtension~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IDescriptorExtension~1.cs @@ -11,7 +11,7 @@ namespace HotChocolate.Types; /// /// The type definition. public interface IDescriptorExtension : IHasDescriptorContext - where T : DefinitionBase + where T : TypeSystemConfiguration { /// /// The type definition. diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IDescriptor~1.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IDescriptor~1.cs index 552f3f1067a..5883d13e674 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IDescriptor~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IDescriptor~1.cs @@ -12,7 +12,7 @@ namespace HotChocolate.Types; /// /// The type definition. /// -public interface IDescriptor : IDescriptor where T : DefinitionBase +public interface IDescriptor : IDescriptor where T : TypeSystemConfiguration { /// /// Provides access to the underlying configuration. This is useful for extensions. diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IDirectiveArgumentDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IDirectiveArgumentDescriptor.cs index 2d22e60f81e..0b3c552b7a4 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IDirectiveArgumentDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IDirectiveArgumentDescriptor.cs @@ -4,7 +4,7 @@ namespace HotChocolate.Types; public interface IDirectiveArgumentDescriptor - : IDescriptor + : IDescriptor , IFluent { /// diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IDirectiveTypeDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IDirectiveTypeDescriptor.cs index 8563fba20f1..fb7ffba8691 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IDirectiveTypeDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IDirectiveTypeDescriptor.cs @@ -4,7 +4,7 @@ namespace HotChocolate.Types; public interface IDirectiveTypeDescriptor - : IDescriptor + : IDescriptor , IFluent { /// diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IDirectiveTypeDescriptor~1.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IDirectiveTypeDescriptor~1.cs index 735b3e14320..e642bb67390 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IDirectiveTypeDescriptor~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IDirectiveTypeDescriptor~1.cs @@ -5,7 +5,7 @@ namespace HotChocolate.Types; public interface IDirectiveTypeDescriptor - : IDescriptor + : IDescriptor , IFluent { /// diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IEnumTypeDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IEnumTypeDescriptor.cs index 1010128d93d..f49b7dfa2ed 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IEnumTypeDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IEnumTypeDescriptor.cs @@ -7,7 +7,7 @@ namespace HotChocolate.Types; /// A fluent configuration API for GraphQL enum types. /// public interface IEnumTypeDescriptor - : IDescriptor + : IDescriptor , IFluent { /// diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IEnumTypeDescriptor~1.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IEnumTypeDescriptor~1.cs index a759a2309cc..82eff0473a3 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IEnumTypeDescriptor~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IEnumTypeDescriptor~1.cs @@ -10,7 +10,7 @@ namespace HotChocolate.Types; /// The runtime type. /// " public interface IEnumTypeDescriptor - : IDescriptor + : IDescriptor , IFluent { /// diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IEnumValueDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IEnumValueDescriptor.cs index befcc068458..da8bf1ab5cf 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IEnumValueDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IEnumValueDescriptor.cs @@ -4,7 +4,7 @@ namespace HotChocolate.Types; public interface IEnumValueDescriptor - : IDescriptor + : IDescriptor , IFluent { /// diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IInputFieldDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IInputFieldDescriptor.cs index e75717f165e..c588c3ff7e3 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IInputFieldDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IInputFieldDescriptor.cs @@ -4,7 +4,7 @@ namespace HotChocolate.Types; public interface IInputFieldDescriptor - : IDescriptor + : IDescriptor , IFluent { /// diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IInputObjectTypeDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IInputObjectTypeDescriptor.cs index 5420c9509db..1127caa9f53 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IInputObjectTypeDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IInputObjectTypeDescriptor.cs @@ -4,7 +4,7 @@ namespace HotChocolate.Types; public interface IInputObjectTypeDescriptor - : IDescriptor + : IDescriptor , IFluent { IInputObjectTypeDescriptor Name(string value); diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IInputObjectTypeDescriptor~1.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IInputObjectTypeDescriptor~1.cs index 704de719a9e..cbe40a260ef 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IInputObjectTypeDescriptor~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IInputObjectTypeDescriptor~1.cs @@ -5,7 +5,7 @@ namespace HotChocolate.Types; public interface IInputObjectTypeDescriptor - : IDescriptor + : IDescriptor , IFluent { IInputObjectTypeDescriptor Name(string value); diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IInterfaceFieldDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IInterfaceFieldDescriptor.cs index 1eef1f0f5d9..78904ca5cca 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IInterfaceFieldDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IInterfaceFieldDescriptor.cs @@ -12,7 +12,7 @@ namespace HotChocolate.Types; /// A fluent configuration API for GraphQL interface type fields. /// public interface IInterfaceFieldDescriptor - : IDescriptor + : IDescriptor , IFluent { /// diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IInterfaceTypeDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IInterfaceTypeDescriptor.cs index 3cd3326b579..29691e3031f 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IInterfaceTypeDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IInterfaceTypeDescriptor.cs @@ -4,7 +4,7 @@ namespace HotChocolate.Types; public interface IInterfaceTypeDescriptor - : IDescriptor + : IDescriptor , IFluent { /// diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IInterfaceTypeDescriptor~1.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IInterfaceTypeDescriptor~1.cs index 2d325766c0e..2d02adaeb27 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IInterfaceTypeDescriptor~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IInterfaceTypeDescriptor~1.cs @@ -6,7 +6,7 @@ namespace HotChocolate.Types; public interface IInterfaceTypeDescriptor - : IDescriptor + : IDescriptor , IFluent { /// diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IObjectFieldDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IObjectFieldDescriptor.cs index 3863f18ff11..ae7b6b57cfa 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IObjectFieldDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IObjectFieldDescriptor.cs @@ -12,7 +12,7 @@ namespace HotChocolate.Types; /// A fluent configuration API for GraphQL object type fields. /// public interface IObjectFieldDescriptor - : IDescriptor + : IDescriptor , IFluent { /// diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ArgumentDefinition.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ArgumentConfiguration.cs similarity index 83% rename from src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ArgumentDefinition.cs rename to src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ArgumentConfiguration.cs index 08466640069..3e5d0f8a8de 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ArgumentDefinition.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ArgumentConfiguration.cs @@ -9,17 +9,17 @@ namespace HotChocolate.Types.Descriptors.Definitions; /// /// Defines the properties of a GraphQL argument type. /// -public class ArgumentDefinition : FieldDefinitionBase +public class ArgumentConfiguration : FieldConfiguration { /// - /// Initializes a new instance of . + /// Initializes a new instance of . /// - public ArgumentDefinition() { } + public ArgumentConfiguration() { } /// - /// Initializes a new instance of . + /// Initializes a new instance of . /// - public ArgumentDefinition( + public ArgumentConfiguration( string name, string? description = null, TypeReference? type = null, @@ -52,13 +52,13 @@ public IReadOnlyList GetFormatters() { if (_formatters is null) { - return Array.Empty(); + return []; } return _formatters; } - internal void CopyTo(ArgumentDefinition target) + internal void CopyTo(ArgumentConfiguration target) { base.CopyTo(target); @@ -69,7 +69,7 @@ internal void CopyTo(ArgumentDefinition target) target.RuntimeType = RuntimeType; } - internal void MergeInto(ArgumentDefinition target) + internal void MergeInto(ArgumentConfiguration target) { base.MergeInto(target); diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/CompleteConfiguration.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/CompleteConfiguration.cs index fe78a37cee6..11f131aab64 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/CompleteConfiguration.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/CompleteConfiguration.cs @@ -4,9 +4,8 @@ namespace HotChocolate.Types.Descriptors.Definitions; -public sealed class CompleteConfiguration - : CompleteConfiguration - where TDefinition : IDefinition +public sealed class CompleteConfiguration : CompleteConfiguration + where TDefinition : ITypeSystemConfiguration { public CompleteConfiguration( Action configure, @@ -28,14 +27,14 @@ public CompleteConfiguration( } } -public class CompleteConfiguration : ITypeSystemMemberConfiguration +public class CompleteConfiguration : ITypeSystemConfigurationTask { - private readonly Action _configure; + private readonly Action _configure; private List? _dependencies; public CompleteConfiguration( - Action configure, - IDefinition owner, + Action configure, + ITypeSystemConfiguration owner, ApplyConfigurationOn on, TypeReference? typeReference = null, TypeDependencyFulfilled fulfilled = TypeDependencyFulfilled.Default) @@ -56,8 +55,8 @@ public CompleteConfiguration( } public CompleteConfiguration( - Action configure, - IDefinition owner, + Action configure, + ITypeSystemConfiguration owner, ApplyConfigurationOn on, IEnumerable dependencies) { @@ -77,7 +76,7 @@ public CompleteConfiguration( _dependencies = [..dependencies,]; } - public IDefinition Owner { get; } + public ITypeSystemConfiguration Owner { get; } public ApplyConfigurationOn On { get; } @@ -98,7 +97,7 @@ public void AddDependency(TypeDependency dependency) public void Configure(ITypeCompletionContext context) => _configure(context, Owner); - public ITypeSystemMemberConfiguration Copy(DefinitionBase newOwner) + public ITypeSystemConfigurationTask Copy(TypeSystemConfiguration newOwner) { if (newOwner is null) { diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/CreateConfiguration.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/CreateConfiguration.cs index 692a5681687..21d33a191ed 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/CreateConfiguration.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/CreateConfiguration.cs @@ -2,19 +2,19 @@ namespace HotChocolate.Types.Descriptors.Definitions; -public sealed class CreateConfiguration : ITypeSystemMemberConfiguration +public sealed class CreateConfiguration : ITypeSystemConfigurationTask { - private readonly Action _configure; + private readonly Action _configure; public CreateConfiguration( - Action configure, - IDefinition owner) + Action configure, + ITypeSystemConfiguration owner) { _configure = configure ?? throw new ArgumentNullException(nameof(configure)); Owner = owner ?? throw new ArgumentNullException(nameof(owner)); } - public IDefinition Owner { get; } + public ITypeSystemConfiguration Owner { get; } public ApplyConfigurationOn On => ApplyConfigurationOn.Create; @@ -27,7 +27,7 @@ public void AddDependency(TypeDependency dependency) public void Configure(IDescriptorContext context) => _configure(context, Owner); - public ITypeSystemMemberConfiguration Copy(DefinitionBase newOwner) + public ITypeSystemConfigurationTask Copy(TypeSystemConfiguration newOwner) { if (newOwner is null) { diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/DirectiveArgumentDefinition.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/DirectiveArgumentConfiguration.cs similarity index 74% rename from src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/DirectiveArgumentDefinition.cs rename to src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/DirectiveArgumentConfiguration.cs index ae8bfa6d640..e5dc8b2a26e 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/DirectiveArgumentDefinition.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/DirectiveArgumentConfiguration.cs @@ -9,17 +9,17 @@ namespace HotChocolate.Types.Descriptors.Definitions; /// /// This definition represents a directive argument. /// -public class DirectiveArgumentDefinition : ArgumentDefinition +public class DirectiveArgumentConfiguration : ArgumentConfiguration { /// - /// Initializes a new instance of . + /// Initializes a new instance of . /// - public DirectiveArgumentDefinition() { } + public DirectiveArgumentConfiguration() { } /// - /// Initializes a new instance of . + /// Initializes a new instance of . /// - public DirectiveArgumentDefinition( + public DirectiveArgumentConfiguration( string name, string? description = null, TypeReference? type = null, diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/DirectiveDefinition.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/DirectiveConfiguration.cs similarity index 79% rename from src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/DirectiveDefinition.cs rename to src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/DirectiveConfiguration.cs index 14bdf66c70c..a5e03d31a66 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/DirectiveDefinition.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/DirectiveConfiguration.cs @@ -7,10 +7,10 @@ namespace HotChocolate.Types.Descriptors.Definitions; /// /// Represents the data to create a directive. /// -public sealed class DirectiveDefinition +public sealed class DirectiveConfiguration { /// - /// Initializes a new instance of a + /// Initializes a new instance of a /// /// /// The directive syntax node. @@ -18,14 +18,14 @@ public sealed class DirectiveDefinition /// /// is null. /// - public DirectiveDefinition(DirectiveNode directiveNode) + public DirectiveConfiguration(DirectiveNode directiveNode) { Value = directiveNode ?? throw new ArgumentNullException(nameof(directiveNode)); Type = TypeReference.CreateDirective(directiveNode.Name.Value); } /// - /// Initializes a new instance of a + /// Initializes a new instance of a /// /// /// The runtime instance of a directive. @@ -36,7 +36,7 @@ public DirectiveDefinition(DirectiveNode directiveNode) /// /// or is null. /// - public DirectiveDefinition(object directive, ExtendedTypeDirectiveReference extendedTypeDirectiveType) + public DirectiveConfiguration(object directive, ExtendedTypeDirectiveReference extendedTypeDirectiveType) { Value = directive ?? throw new ArgumentNullException(nameof(directive)); Type = extendedTypeDirectiveType ?? throw new ArgumentNullException(nameof(extendedTypeDirectiveType)); diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/DirectiveTypeDefinition.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/DirectiveTypeConfiguration.cs similarity index 82% rename from src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/DirectiveTypeDefinition.cs rename to src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/DirectiveTypeConfiguration.cs index 8c38640d3d0..4fcfdf772eb 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/DirectiveTypeDefinition.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/DirectiveTypeConfiguration.cs @@ -9,21 +9,21 @@ namespace HotChocolate.Types.Descriptors.Definitions; /// /// Defines the properties of a GraphQL directive. /// -public class DirectiveTypeDefinition : DefinitionBase, IHasRuntimeType +public class DirectiveTypeConfiguration : TypeSystemConfiguration, IHasRuntimeType { private Type _clrType = typeof(object); private List? _middlewareComponents; - private BindableList? _arguments; + private BindableList? _arguments; /// - /// Initializes a new instance of . + /// Initializes a new instance of . /// - public DirectiveTypeDefinition() { } + public DirectiveTypeConfiguration() { } /// - /// Initializes a new instance of . + /// Initializes a new instance of . /// - public DirectiveTypeDefinition( + public DirectiveTypeConfiguration( string name, string? description = null, Type? runtimeType = null, @@ -72,7 +72,7 @@ public Type RuntimeType /// /// Gets the directive arguments. /// - public IBindableList Arguments + public IBindableList Arguments => _arguments ??= []; /// @@ -100,9 +100,9 @@ public IBindableList Arguments /// public Func? Format { get; set; } - public override IEnumerable GetConfigurations() + public override IEnumerable GetConfigurations() { - var configs = new List(); + var configs = new List(); configs.AddRange(Configurations); @@ -130,11 +130,11 @@ internal IReadOnlyList GetMiddlewareComponents() /// /// Gets the directive arguments. /// - internal IReadOnlyList GetArguments() + internal IReadOnlyList GetArguments() { if (_arguments is null) { - return Array.Empty(); + return Array.Empty(); } return _arguments; diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/EnumTypeDefinition.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/EnumTypeConfiguration.cs similarity index 74% rename from src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/EnumTypeDefinition.cs rename to src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/EnumTypeConfiguration.cs index 5fa74e2a5d0..62c0892de30 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/EnumTypeDefinition.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/EnumTypeConfiguration.cs @@ -7,17 +7,17 @@ namespace HotChocolate.Types.Descriptors.Definitions; /// /// Defines the properties of a GraphQL enum type. /// -public class EnumTypeDefinition : TypeDefinitionBase +public class EnumTypeConfiguration : TypeDefinitionBase { /// - /// Initializes a new instance of . + /// Initializes a new instance of . /// - public EnumTypeDefinition() { } + public EnumTypeConfiguration() { } /// - /// Initializes a new instance of . + /// Initializes a new instance of . /// - public EnumTypeDefinition( + public EnumTypeConfiguration( string name, string? description = null, Type? runtimeType = null) @@ -42,12 +42,12 @@ public EnumTypeDefinition( /// /// Gets the enum values. /// - public IBindableList Values { get; } = - new BindableList(); + public IBindableList Values { get; } = + new BindableList(); - public override IEnumerable GetConfigurations() + public override IEnumerable GetConfigurations() { - List? configs = null; + List? configs = null; if (HasConfigurations) { @@ -64,7 +64,7 @@ public override IEnumerable GetConfigurations() } } - return configs ?? Enumerable.Empty(); + return configs ?? Enumerable.Empty(); } private sealed class DefaultValueComparer : IEqualityComparer diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/EnumValueDefinition.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/EnumValueConfiguration.cs similarity index 79% rename from src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/EnumValueDefinition.cs rename to src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/EnumValueConfiguration.cs index 2edf8a809c7..c9e932c346a 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/EnumValueDefinition.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/EnumValueConfiguration.cs @@ -8,20 +8,20 @@ namespace HotChocolate.Types.Descriptors.Definitions; /// /// Defines the properties of a GraphQL enum value. /// -public class EnumValueDefinition +public class EnumValueConfiguration : TypeDefinitionBase - , ICanBeDeprecated - , IHasIgnore + , IDeprecationConfiguration + , IIgnoreConfiguration { /// - /// Initializes a new instance of . + /// Initializes a new instance of . /// - public EnumValueDefinition() { } + public EnumValueConfiguration() { } /// - /// Initializes a new instance of . + /// Initializes a new instance of . /// - public EnumValueDefinition( + public EnumValueConfiguration( string name, string? description = null, object? runtimeValue = null) diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/FieldDefinitionBase.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/FieldConfiguration.cs similarity index 87% rename from src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/FieldDefinitionBase.cs rename to src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/FieldConfiguration.cs index b88d11f796a..4e8f80cea1f 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/FieldDefinitionBase.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/FieldConfiguration.cs @@ -5,12 +5,12 @@ namespace HotChocolate.Types.Descriptors.Definitions; /// /// This definition represents a field or argument. /// -public abstract class FieldDefinitionBase - : DefinitionBase - , IHasDirectiveDefinition - , IHasIgnore +public abstract class FieldConfiguration + : TypeSystemConfiguration + , IDirectiveConfigurationProvider + , IIgnoreConfiguration { - private List? _directives; + private List? _directives; private string? _deprecationReason; private FieldFlags _flags = FieldFlags.None; @@ -77,7 +77,7 @@ public bool Ignore /// /// Gets the list of directives that are annotated to this field. /// - public IList Directives + public IList Directives => _directives ??= []; /// @@ -88,11 +88,11 @@ public IList Directives /// /// Gets the list of directives that are annotated to this field. /// - public IReadOnlyList GetDirectives() + public IReadOnlyList GetDirectives() { if (_directives is null) { - return Array.Empty(); + return Array.Empty(); } return _directives; @@ -108,7 +108,7 @@ public IReadOnlyList GetDirectives() public void SetConnectionTotalCountFieldFlags() => Flags |= FieldFlags.TotalCount; - protected void CopyTo(FieldDefinitionBase target) + protected void CopyTo(FieldConfiguration target) { base.CopyTo(target); @@ -126,7 +126,7 @@ protected void CopyTo(FieldDefinitionBase target) } } - protected void MergeInto(FieldDefinitionBase target) + protected void MergeInto(FieldConfiguration target) { base.MergeInto(target); diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/FieldMiddlewareDefinition.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/FieldMiddlewareConfiguration.cs similarity index 91% rename from src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/FieldMiddlewareDefinition.cs rename to src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/FieldMiddlewareConfiguration.cs index d18ba4a4bac..834371fdef5 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/FieldMiddlewareDefinition.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/FieldMiddlewareConfiguration.cs @@ -7,10 +7,10 @@ namespace HotChocolate.Types.Descriptors.Definitions; /// /// Represents a middleware configuration. /// -public sealed class FieldMiddlewareDefinition : IMiddlewareDefinition +public sealed class FieldMiddlewareConfiguration : IRepeatableConfiguration { /// - /// Initializes a new instance of . + /// Initializes a new instance of . /// /// /// The delegate representing the middleware. @@ -22,7 +22,7 @@ public sealed class FieldMiddlewareDefinition : IMiddlewareDefinition /// /// The key is optional and is used to identify a middleware. /// - public FieldMiddlewareDefinition( + public FieldMiddlewareConfiguration( FieldMiddleware middleware, bool isRepeatable = true, string? key = null) diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IComplexOutputTypeConfiguration.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IComplexOutputTypeConfiguration.cs new file mode 100644 index 00000000000..c2c6f0958a2 --- /dev/null +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IComplexOutputTypeConfiguration.cs @@ -0,0 +1,29 @@ +#nullable enable + +namespace HotChocolate.Types.Descriptors.Definitions; + +/// +/// Represents a complex output type configuration. +/// +public interface IComplexOutputTypeConfiguration +{ + /// + /// Gets the name of the type. + /// + string Name { get; } + + /// + /// Gets the description of the type. + /// + Type RuntimeType { get; } + + /// + /// Gets a list of other known runtime types for this complex type. + /// + IList KnownRuntimeTypes { get; } + + /// + /// Gets a list of interfaces that this complex type implements. + /// + IList Interfaces { get; } +} diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IComplexOutputTypeDefinition.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IComplexOutputTypeDefinition.cs deleted file mode 100644 index 5e65b4a5598..00000000000 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IComplexOutputTypeDefinition.cs +++ /dev/null @@ -1,14 +0,0 @@ -#nullable enable - -namespace HotChocolate.Types.Descriptors.Definitions; - -public interface IComplexOutputTypeDefinition -{ - string Name { get; } - - Type RuntimeType { get; } - - IList KnownRuntimeTypes { get; } - - IList Interfaces { get; } -} diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IDefinitionFactory.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IDefinitionFactory.cs index f71ab3b213d..196287db876 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IDefinitionFactory.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IDefinitionFactory.cs @@ -2,5 +2,5 @@ namespace HotChocolate.Types.Descriptors.Definitions; public interface IDefinitionFactory { - DefinitionBase CreateDefinition(); + TypeSystemConfiguration CreateDefinition(); } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IDefinitionFactory~1.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IDefinitionFactory~1.cs index c0328b4cb6f..5700a6632df 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IDefinitionFactory~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IDefinitionFactory~1.cs @@ -2,7 +2,7 @@ namespace HotChocolate.Types.Descriptors.Definitions; public interface IDefinitionFactory : IDefinitionFactory - where T : DefinitionBase + where T : TypeSystemConfiguration { new T CreateDefinition(); } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ICanBeDeprecated.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IDeprecationConfiguration.cs similarity index 75% rename from src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ICanBeDeprecated.cs rename to src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IDeprecationConfiguration.cs index a7f8fb65a9c..8a88d0829c5 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ICanBeDeprecated.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IDeprecationConfiguration.cs @@ -1,6 +1,6 @@ namespace HotChocolate.Types.Descriptors.Definitions; -public interface ICanBeDeprecated +public interface IDeprecationConfiguration { string DeprecationReason { get; } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IHasDirectiveDefinition.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IDirectiveConfigurationProvider.cs similarity index 73% rename from src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IHasDirectiveDefinition.cs rename to src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IDirectiveConfigurationProvider.cs index 9552b0ba58f..2b495a3aae6 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IHasDirectiveDefinition.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IDirectiveConfigurationProvider.cs @@ -2,7 +2,7 @@ namespace HotChocolate.Types.Descriptors.Definitions; -public interface IHasDirectiveDefinition +public interface IDirectiveConfigurationProvider { /// /// Specifies if any directives were registered. @@ -13,11 +13,11 @@ public interface IHasDirectiveDefinition /// Gets the list of directives that are annotated to /// the implementing object. /// - IList Directives { get; } + IList Directives { get; } /// /// Gets the list of directives that are annotated to /// the implementing object. /// - IReadOnlyList GetDirectives(); + IReadOnlyList GetDirectives(); } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IHasExtendsType.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IExtendsTypeConfiguration.cs similarity index 51% rename from src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IHasExtendsType.cs rename to src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IExtendsTypeConfiguration.cs index b44b63fc06d..b4d933f0fd9 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IHasExtendsType.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IExtendsTypeConfiguration.cs @@ -2,10 +2,11 @@ namespace HotChocolate.Types.Descriptors.Definitions; -public interface IHasExtendsType +public interface IExtendsTypeConfiguration { /// - /// If this is a type definition extension this is the type we want to extend. + /// If this is a type configuration extension + /// this is the type we want to extend. /// Type? ExtendsType { get; } } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IHasIgnore.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IIgnoreConfiguration.cs similarity index 88% rename from src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IHasIgnore.cs rename to src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IIgnoreConfiguration.cs index 0b34ef6cf62..27cc892a41d 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IHasIgnore.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IIgnoreConfiguration.cs @@ -3,7 +3,7 @@ namespace HotChocolate.Types.Descriptors.Definitions; /// /// Represents definitions that carry a ignore flag. /// -public interface IHasIgnore +public interface IIgnoreConfiguration { /// /// Defines if this field is ignored and will diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IMiddlewareDefinition.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IRepeatableConfiguration.cs similarity index 92% rename from src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IMiddlewareDefinition.cs rename to src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IRepeatableConfiguration.cs index eaf87961eca..830fa836d05 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IMiddlewareDefinition.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IRepeatableConfiguration.cs @@ -5,7 +5,7 @@ namespace HotChocolate.Types.Descriptors.Definitions; /// /// Represents a middleware or result converter configuration. /// -public interface IMiddlewareDefinition +public interface IRepeatableConfiguration { /// /// Defines if the middleware or result converters is repeatable and diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ITypeDefinition.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ITypeDefinition.cs index b63bd75845e..e2298f9ee3b 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ITypeDefinition.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ITypeDefinition.cs @@ -4,10 +4,10 @@ namespace HotChocolate.Types.Descriptors.Definitions; /// Represents a type definition. /// public interface ITypeDefinition - : IDefinition + : ITypeSystemConfiguration , IHasRuntimeType - , IHasDirectiveDefinition - , IHasExtendsType + , IDirectiveConfigurationProvider + , IExtendsTypeConfiguration { /// /// Specifies that this type system object needs an explicit name completion since it diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IDefinition.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ITypeSystemConfiguration.cs similarity index 77% rename from src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IDefinition.cs rename to src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ITypeSystemConfiguration.cs index bec17061f34..3459cf5ea63 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IDefinition.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ITypeSystemConfiguration.cs @@ -3,18 +3,18 @@ namespace HotChocolate.Types.Descriptors.Definitions; /// -/// A type system definition is used in the type initialization to store properties -/// of a type system object. +/// A type system configuration is used in the type initialization +/// as a mutable object to define the types properties. /// -public interface IDefinition +public interface ITypeSystemConfiguration { /// - /// Gets or sets the name the type shall have. + /// Gets or sets the name of the type system member. /// string Name { get; set; } /// - /// Gets or sets the description the type shall have. + /// Gets or sets the description of the type system member. /// string? Description { get; set; } @@ -47,7 +47,7 @@ public interface IDefinition /// /// Gets configurations that shall be applied at a later point. /// - IList Configurations { get; } + IList Configurations { get; } /// /// Defines if this type has configurations. diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ITypeSystemMemberConfiguration.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ITypeSystemConfigurationTask.cs similarity index 87% rename from src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ITypeSystemMemberConfiguration.cs rename to src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ITypeSystemConfigurationTask.cs index 0177e4a5129..54b1d3efcd7 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ITypeSystemMemberConfiguration.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ITypeSystemConfigurationTask.cs @@ -6,13 +6,13 @@ namespace HotChocolate.Types.Descriptors.Definitions; /// A configuration object that is applied to a type system member at a certain event /// during the type system initialization. /// -public interface ITypeSystemMemberConfiguration +public interface ITypeSystemConfigurationTask { /// /// The definition of the type system member that shall be configured. /// /// - IDefinition Owner { get; } + ITypeSystemConfiguration Owner { get; } /// /// Defines on which type initialization step this @@ -23,7 +23,6 @@ public interface ITypeSystemMemberConfiguration /// /// Defines types on on which this configuration is dependant on. /// - /// IReadOnlyList Dependencies { get; } /// @@ -43,5 +42,5 @@ public interface ITypeSystemMemberConfiguration /// /// Returns the new configuration. /// - ITypeSystemMemberConfiguration Copy(DefinitionBase newOwner); + ITypeSystemConfigurationTask Copy(TypeSystemConfiguration newOwner); } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InputFieldDefinition.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InputFieldConfiguration.cs similarity index 65% rename from src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InputFieldDefinition.cs rename to src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InputFieldConfiguration.cs index 4c843c862b1..3402ed917e5 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InputFieldDefinition.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InputFieldConfiguration.cs @@ -6,20 +6,20 @@ namespace HotChocolate.Types.Descriptors.Definitions; /// -/// The contains the settings +/// The contains the settings /// to create a . /// -public class InputFieldDefinition : ArgumentDefinition +public class InputFieldConfiguration : ArgumentConfiguration { /// - /// Initializes a new instance of . + /// Initializes a new instance of . /// - public InputFieldDefinition() { } + public InputFieldConfiguration() { } /// - /// Initializes a new instance of . + /// Initializes a new instance of . /// - public InputFieldDefinition( + public InputFieldConfiguration( string name, string? description = null, TypeReference? type = null, @@ -34,14 +34,14 @@ public InputFieldDefinition( /// public PropertyInfo? Property { get; set; } - internal void CopyTo(InputFieldDefinition target) + internal void CopyTo(InputFieldConfiguration target) { base.CopyTo(target); target.Property = Property; } - internal void MergeInto(InputFieldDefinition target) + internal void MergeInto(InputFieldConfiguration target) { base.MergeInto(target); diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InputObjectTypeDefinition.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InputObjectTypeConfiguration.cs similarity index 74% rename from src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InputObjectTypeDefinition.cs rename to src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InputObjectTypeConfiguration.cs index f5bad24c57f..499514fc165 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InputObjectTypeDefinition.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InputObjectTypeConfiguration.cs @@ -7,17 +7,17 @@ namespace HotChocolate.Types.Descriptors.Definitions; /// /// Defines the properties of a GraphQL input object type. /// -public class InputObjectTypeDefinition : TypeDefinitionBase +public class InputObjectTypeConfiguration : TypeDefinitionBase { /// - /// Initializes a new instance of . + /// Initializes a new instance of . /// - public InputObjectTypeDefinition() { } + public InputObjectTypeConfiguration() { } /// - /// Initializes a new instance of . + /// Initializes a new instance of . /// - public InputObjectTypeDefinition( + public InputObjectTypeConfiguration( string name, string? description = null, Type? runtimeType = null) @@ -30,8 +30,8 @@ public InputObjectTypeDefinition( /// /// Gets the input fields. /// - public IBindableList Fields { get; } = - new BindableList(); + public IBindableList Fields { get; } = + new BindableList(); /// /// Gets or sets the input object runtime value factory delegate. @@ -43,9 +43,9 @@ public InputObjectTypeDefinition( /// public Action? GetFieldData { get; set; } - public override IEnumerable GetConfigurations() + public override IEnumerable GetConfigurations() { - List? configs = null; + List? configs = null; if (HasConfigurations) { @@ -62,10 +62,10 @@ public override IEnumerable GetConfigurations() } } - return configs ?? Enumerable.Empty(); + return configs ?? Enumerable.Empty(); } - protected internal void CopyTo(InputObjectTypeDefinition target) + protected internal void CopyTo(InputObjectTypeConfiguration target) { base.CopyTo(target); @@ -83,7 +83,7 @@ protected internal void CopyTo(InputObjectTypeDefinition target) target.GetFieldData = GetFieldData; } - protected internal void MergeInto(InputObjectTypeDefinition target) + protected internal void MergeInto(InputObjectTypeConfiguration target) { base.MergeInto(target); @@ -106,7 +106,7 @@ protected internal void MergeInto(InputObjectTypeDefinition target) target.Fields.Remove(targetField); } - var newField = new InputFieldDefinition(); + var newField = new InputFieldConfiguration(); field.CopyTo(newField); target.Fields.Add(newField); } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InterfaceFieldDefinition.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InterfaceFieldConfiguration.cs similarity index 84% rename from src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InterfaceFieldDefinition.cs rename to src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InterfaceFieldConfiguration.cs index e90ad0d59d7..2e1fdc02c8f 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InterfaceFieldDefinition.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InterfaceFieldConfiguration.cs @@ -10,13 +10,13 @@ namespace HotChocolate.Types.Descriptors.Definitions; /// -/// The contains the settings +/// The contains the settings /// to create a . /// -public class InterfaceFieldDefinition : OutputFieldDefinitionBase +public class InterfaceFieldConfiguration : OutputFieldConfiguration { - private List? _middlewareDefinitions; - private List? _resultConverters; + private List? _middlewareDefinitions; + private List? _resultConverters; private List? _expressionBuilders; private bool _middlewareDefinitionsCleaned; private bool _resultConvertersCleaned; @@ -24,7 +24,7 @@ public class InterfaceFieldDefinition : OutputFieldDefinitionBase /// /// Initializes a new instance of . /// - public InterfaceFieldDefinition() + public InterfaceFieldConfiguration() { IsParallelExecutable = true; } @@ -32,7 +32,7 @@ public InterfaceFieldDefinition() /// /// Initializes a new instance of . /// - public InterfaceFieldDefinition( + public InterfaceFieldConfiguration( string name, string? description = null, TypeReference? type = null) @@ -104,7 +104,7 @@ public FieldResolverDelegates Resolvers /// /// A list of middleware components which will be used to form the field pipeline. /// - public IList MiddlewareDefinitions + public IList MiddlewareDefinitions { get { @@ -116,7 +116,7 @@ public IList MiddlewareDefinitions /// /// A list of formatters that can transform the resolver result. /// - public IList FormatterDefinitions + public IList FormatterDefinitions { get { @@ -184,14 +184,14 @@ public bool HasStreamResult /// /// A list of middleware components which will be used to form the field pipeline. /// - internal IReadOnlyList GetMiddlewareDefinitions() + internal IReadOnlyList GetMiddlewareDefinitions() { if (_middlewareDefinitions is null) { - return Array.Empty(); + return []; } - CleanMiddlewareDefinitions(_middlewareDefinitions, ref _middlewareDefinitionsCleaned); + CleanRepeatableConfigurations(_middlewareDefinitions, ref _middlewareDefinitionsCleaned); return _middlewareDefinitions; } @@ -199,14 +199,14 @@ internal IReadOnlyList GetMiddlewareDefinitions() /// /// A list of converters that can transform the resolver result. /// - internal IReadOnlyList GetResultConverters() + internal IReadOnlyList GetResultConverters() { if (_resultConverters is null) { - return Array.Empty(); + return []; } - CleanMiddlewareDefinitions(_resultConverters, ref _resultConvertersCleaned); + CleanRepeatableConfigurations(_resultConverters, ref _resultConvertersCleaned); return _resultConverters; } @@ -219,7 +219,7 @@ internal IReadOnlyList GetParameterExpressionBuilde { if (_expressionBuilders is null) { - return Array.Empty(); + return []; } return _expressionBuilders; @@ -228,7 +228,7 @@ internal IReadOnlyList GetParameterExpressionBuilde private FieldResolverDelegates GetResolvers() => new(Resolver, PureResolver); - internal void CopyTo(InterfaceFieldDefinition target) + internal void CopyTo(InterfaceFieldConfiguration target) { base.CopyTo(target); @@ -263,7 +263,7 @@ internal void CopyTo(InterfaceFieldDefinition target) target.ResultPostProcessor = ResultPostProcessor; } - internal void CopyTo(ObjectFieldDefinition target) + internal void CopyTo(ObjectFieldConfiguration target) { base.CopyTo(target); @@ -307,7 +307,7 @@ internal void CopyTo(ObjectFieldDefinition target) target.ResultPostProcessor = ResultPostProcessor; } - internal void MergeInto(InterfaceFieldDefinition target) + internal void MergeInto(InterfaceFieldConfiguration target) { base.MergeInto(target); @@ -382,18 +382,18 @@ internal void MergeInto(InterfaceFieldDefinition target) } } - private static void CleanMiddlewareDefinitions( - IList definitions, - ref bool definitionsCleaned) - where T : IMiddlewareDefinition + private static void CleanRepeatableConfigurations( + List definitions, + ref bool isClean) + where T :IRepeatableConfiguration { var count = definitions.Count; - if (!definitionsCleaned && count > 1) + if (!isClean && count > 1) { if (count == 2 && definitions[0].IsRepeatable) { - definitionsCleaned = true; + isClean = true; } if (count == 3 && @@ -401,7 +401,7 @@ private static void CleanMiddlewareDefinitions( definitions[1].IsRepeatable && definitions[2].IsRepeatable) { - definitionsCleaned = true; + isClean = true; } if (count == 4 && @@ -410,10 +410,10 @@ private static void CleanMiddlewareDefinitions( definitions[2].IsRepeatable && definitions[3].IsRepeatable) { - definitionsCleaned = true; + isClean = true; } - if (!definitionsCleaned) + if (!isClean) { var nonRepeatable = 0; @@ -430,12 +430,12 @@ private static void CleanMiddlewareDefinitions( var keys = ArrayPool.Shared.Rent(nonRepeatable); // we clear the section of the array we need before we are using it. - keys.AsSpan().Slice(0, nonRepeatable).Clear(); + keys.AsSpan()[..nonRepeatable].Clear(); int i = 0, ki = 0; do { - IMiddlewareDefinition def = definitions[i]; + var def = definitions[i]; if (def.IsRepeatable || def.Key is null) { @@ -443,14 +443,11 @@ private static void CleanMiddlewareDefinitions( } else { - if (ki > 0) + if (ki > 0 && Array.IndexOf(keys, def.Key, 0, ki) != -1) { - if (Array.IndexOf(keys, def.Key, 0, ki) != -1) - { - count--; - definitions.RemoveAt(i); - continue; - } + count--; + definitions.RemoveAt(i); + continue; } keys[ki++] = def.Key; @@ -461,7 +458,7 @@ private static void CleanMiddlewareDefinitions( ArrayPool.Shared.Return(keys); } - definitionsCleaned = true; + isClean = true; } } } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InterfaceTypeDefinition.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InterfaceTypeConfiguration.cs similarity index 77% rename from src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InterfaceTypeDefinition.cs rename to src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InterfaceTypeConfiguration.cs index b0d70fc9e6f..4c78aba4bed 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InterfaceTypeDefinition.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InterfaceTypeConfiguration.cs @@ -4,7 +4,7 @@ namespace HotChocolate.Types.Descriptors.Definitions; -public class InterfaceTypeDefinition : TypeDefinitionBase, IComplexOutputTypeDefinition +public class InterfaceTypeConfiguration : TypeDefinitionBase, IComplexOutputTypeConfiguration { private List? _knownClrTypes; private List? _interfaces; @@ -12,12 +12,12 @@ public class InterfaceTypeDefinition : TypeDefinitionBase, IComplexOutputTypeDef /// /// Initializes a new instance of . /// - public InterfaceTypeDefinition() { } + public InterfaceTypeConfiguration() { } /// /// Initializes a new instance of . /// - public InterfaceTypeDefinition( + public InterfaceTypeConfiguration( string name, string? description = null, Type? runtimeType = null) @@ -38,12 +38,12 @@ public InterfaceTypeDefinition( /// public bool HasInterfaces => _interfaces is { Count: > 0, }; - public IBindableList Fields { get; } = - new BindableList(); + public IBindableList Fields { get; } = + new BindableList(); - public override IEnumerable GetConfigurations() + public override IEnumerable GetConfigurations() { - List? configs = null; + List? configs = null; if (HasConfigurations) { @@ -72,14 +72,14 @@ public override IEnumerable GetConfigurations() } } - return configs ?? Enumerable.Empty(); + return configs ?? Enumerable.Empty(); } internal IReadOnlyList GetKnownClrTypes() { if (_knownClrTypes is null) { - return Array.Empty(); + return []; } return _knownClrTypes; @@ -89,7 +89,7 @@ internal IReadOnlyList GetInterfaces() { if (_interfaces is null) { - return Array.Empty(); + return []; } return _interfaces; diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ObjectFieldDefinition.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ObjectFieldConfiguration.cs similarity index 92% rename from src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ObjectFieldDefinition.cs rename to src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ObjectFieldConfiguration.cs index bdcd76588e2..269ee25244e 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ObjectFieldDefinition.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ObjectFieldConfiguration.cs @@ -11,13 +11,13 @@ namespace HotChocolate.Types.Descriptors.Definitions; /// -/// The contains the settings +/// The contains the settings /// to create a . /// -public class ObjectFieldDefinition : OutputFieldDefinitionBase +public class ObjectFieldConfiguration : OutputFieldConfiguration { - private List? _middlewareDefinitions; - private List? _resultConverters; + private List? _middlewareDefinitions; + private List? _resultConverters; private List? _expressionBuilders; private bool _middlewareDefinitionsCleaned; private bool _resultConvertersCleaned; @@ -25,7 +25,7 @@ public class ObjectFieldDefinition : OutputFieldDefinitionBase /// /// Initializes a new instance of . /// - public ObjectFieldDefinition() + public ObjectFieldConfiguration() { IsParallelExecutable = true; } @@ -33,7 +33,7 @@ public ObjectFieldDefinition() /// /// Initializes a new instance of . /// - public ObjectFieldDefinition( + public ObjectFieldConfiguration( string name, string? description = null, TypeReference? type = null, @@ -125,7 +125,7 @@ public FieldResolverDelegates Resolvers /// /// A list of middleware components which will be used to form the field pipeline. /// - public IList MiddlewareDefinitions + public IList MiddlewareDefinitions { get { @@ -137,7 +137,7 @@ public IList MiddlewareDefinitions /// /// A list of formatters that can transform the resolver result. /// - public IList FormatterDefinitions + public IList FormatterDefinitions { get { @@ -224,11 +224,11 @@ public bool HasStreamResult /// /// A list of middleware components which will be used to form the field pipeline. /// - internal IReadOnlyList GetMiddlewareDefinitions() + internal IReadOnlyList GetMiddlewareDefinitions() { if (_middlewareDefinitions is null) { - return Array.Empty(); + return Array.Empty(); } CleanMiddlewareDefinitions(_middlewareDefinitions, ref _middlewareDefinitionsCleaned); @@ -239,11 +239,11 @@ internal IReadOnlyList GetMiddlewareDefinitions() /// /// A list of converters that can transform the resolver result. /// - internal IReadOnlyList GetResultConverters() + internal IReadOnlyList GetResultConverters() { if (_resultConverters is null) { - return Array.Empty(); + return Array.Empty(); } CleanMiddlewareDefinitions(_resultConverters, ref _resultConvertersCleaned); @@ -268,7 +268,7 @@ internal IReadOnlyList GetParameterExpressionBuilde private FieldResolverDelegates GetResolvers() => new(Resolver, PureResolver); - internal void CopyTo(ObjectFieldDefinition target) + internal void CopyTo(ObjectFieldConfiguration target) { base.CopyTo(target); @@ -307,7 +307,7 @@ internal void CopyTo(ObjectFieldDefinition target) target.ResultPostProcessor = ResultPostProcessor; } - internal void MergeInto(ObjectFieldDefinition target) + internal void MergeInto(ObjectFieldConfiguration target) { base.MergeInto(target); @@ -400,7 +400,7 @@ internal void MergeInto(ObjectFieldDefinition target) private static void CleanMiddlewareDefinitions( IList definitions, ref bool definitionsCleaned) - where T : IMiddlewareDefinition + where T : IRepeatableConfiguration { var count = definitions.Count; @@ -450,7 +450,7 @@ private static void CleanMiddlewareDefinitions( do { - IMiddlewareDefinition def = definitions[i]; + IRepeatableConfiguration def = definitions[i]; if (def.IsRepeatable || def.Key is null) { diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ObjectTypeDefinition.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ObjectTypeDefinition.cs index df10524cf48..dbdab92dd3e 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ObjectTypeDefinition.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ObjectTypeDefinition.cs @@ -11,7 +11,7 @@ namespace HotChocolate.Types.Descriptors.Definitions; /// public class ObjectTypeDefinition : TypeDefinitionBase - , IComplexOutputTypeDefinition + , IComplexOutputTypeConfiguration { private List? _knownClrTypes; private List? _interfaces; @@ -96,8 +96,8 @@ public override Type RuntimeType /// /// Gets the fields of this object type. /// - public IBindableList Fields { get; } = - new BindableList(); + public IBindableList Fields { get; } = + new BindableList(); /// /// Gets the field binding flags, which defines how runtime @@ -118,9 +118,9 @@ public FieldBindingFlags FieldBindingFlags } } - public override IEnumerable GetConfigurations() + public override IEnumerable GetConfigurations() { - List? configs = null; + List? configs = null; if (HasConfigurations) { @@ -146,7 +146,7 @@ public override IEnumerable GetConfigurations() } } - return configs ?? Enumerable.Empty(); + return configs ?? Enumerable.Empty(); } internal IReadOnlyList GetKnownClrTypes() @@ -287,7 +287,7 @@ protected internal void MergeInto(ObjectTypeDefinition target) target.Fields.Remove(targetField); } - var newField = new ObjectFieldDefinition(); + var newField = new ObjectFieldConfiguration(); field.CopyTo(newField); newField.SourceType = target.RuntimeType; @@ -305,8 +305,8 @@ protected internal void MergeInto(ObjectTypeDefinition target) } private static void SetResolverMember( - ObjectFieldDefinition sourceField, - ObjectFieldDefinition? targetField) + ObjectFieldConfiguration sourceField, + ObjectFieldConfiguration? targetField) { // we prepare the field that is merged in to use the resolver member instead of member. // this will ensure that the original source type member is preserved after we have diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/OutputFieldDefinitionBase.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/OutputFieldConfiguration.cs similarity index 73% rename from src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/OutputFieldDefinitionBase.cs rename to src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/OutputFieldConfiguration.cs index ab25c09cd02..9697a63fd9c 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/OutputFieldDefinitionBase.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/OutputFieldConfiguration.cs @@ -4,11 +4,11 @@ namespace HotChocolate.Types.Descriptors.Definitions; -public class OutputFieldDefinitionBase : FieldDefinitionBase, ICanBeDeprecated +public class OutputFieldConfiguration : FieldConfiguration, IDeprecationConfiguration { - private List? _arguments; + private List? _arguments; - public IList Arguments + public IList Arguments => _arguments ??= []; /// @@ -16,17 +16,17 @@ public IList Arguments /// public bool HasArguments => _arguments?.Count > 0; - public IReadOnlyList GetArguments() + public IReadOnlyList GetArguments() { if (_arguments is null) { - return Array.Empty(); + return Array.Empty(); } return _arguments; } - protected void CopyTo(OutputFieldDefinitionBase target) + protected void CopyTo(OutputFieldConfiguration target) { base.CopyTo(target); @@ -36,7 +36,7 @@ protected void CopyTo(OutputFieldDefinitionBase target) foreach (var argument in _arguments) { - var newArgument = new ArgumentDefinition(); + var newArgument = new ArgumentConfiguration(); argument.CopyTo(newArgument); target._arguments.Add(newArgument); } @@ -45,7 +45,7 @@ protected void CopyTo(OutputFieldDefinitionBase target) target.DeprecationReason = DeprecationReason; } - protected void MergeInto(OutputFieldDefinitionBase target) + protected void MergeInto(OutputFieldConfiguration target) { base.MergeInto(target); @@ -60,7 +60,7 @@ protected void MergeInto(OutputFieldDefinitionBase target) if (targetArgument is null) { - targetArgument = new ArgumentDefinition(); + targetArgument = new ArgumentConfiguration(); argument.CopyTo(targetArgument); target._arguments.Add(targetArgument); } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ResultFormatterDefinition.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ResultFormatterConfiguration.cs similarity index 87% rename from src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ResultFormatterDefinition.cs rename to src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ResultFormatterConfiguration.cs index 1c12b07325e..88c7f7fda84 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ResultFormatterDefinition.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ResultFormatterConfiguration.cs @@ -7,10 +7,10 @@ namespace HotChocolate.Types.Descriptors.Definitions; /// /// Represents a result formatter configuration. /// -public sealed class ResultFormatterDefinition : IMiddlewareDefinition +public sealed class ResultFormatterConfiguration : IRepeatableConfiguration { /// - /// Initializes a new instance of . + /// Initializes a new instance of . /// /// /// The delegate representing the result converter. @@ -22,7 +22,7 @@ public sealed class ResultFormatterDefinition : IMiddlewareDefinition /// /// The key is optional and is used to identify a middleware. /// - public ResultFormatterDefinition( + public ResultFormatterConfiguration( ResultFormatterDelegate formatter, bool isRepeatable = true, string? key = null) diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/SchemaTypeDefinition.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/SchemaTypeDefinition.cs index 5f4bc64cdbf..65e64f6bfeb 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/SchemaTypeDefinition.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/SchemaTypeDefinition.cs @@ -4,14 +4,14 @@ namespace HotChocolate.Types.Descriptors.Definitions; -public class SchemaTypeDefinition : DefinitionBase, IFeatureProvider +public class SchemaTypeDefinition : TypeSystemConfiguration, IFeatureProvider { - private List? _directives; + private List? _directives; /// /// Gets the list of directives that are annotated to this schema. /// - internal IList Directives => + internal IList Directives => _directives ??= []; /// @@ -24,26 +24,26 @@ public class SchemaTypeDefinition : DefinitionBase, IFeatureProvider /// /// Gets the list of directives that are annotated to this schema. /// - internal IReadOnlyList GetDirectives() + internal IReadOnlyList GetDirectives() { if (_directives is null) { - return Array.Empty(); + return Array.Empty(); } return _directives; } - internal IHasDirectiveDefinition GetLegacyDefinition() + internal IDirectiveConfigurationProvider GetLegacyDefinition() => new CompatibilityLayer(this); - private class CompatibilityLayer(SchemaTypeDefinition definition) : IHasDirectiveDefinition + private class CompatibilityLayer(SchemaTypeDefinition definition) : IDirectiveConfigurationProvider { public bool HasDirectives => definition.HasDirectives; - public IList Directives => definition.Directives; + public IList Directives => definition.Directives; - public IReadOnlyList GetDirectives() + public IReadOnlyList GetDirectives() => definition.GetDirectives(); } } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/TypeDefinitionBase~1.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/TypeDefinitionBase~1.cs index fe5f9fbb347..87fe0aa12d1 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/TypeDefinitionBase~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/TypeDefinitionBase~1.cs @@ -5,9 +5,9 @@ namespace HotChocolate.Types.Descriptors.Definitions; /// /// A definition that represents a type. /// -public class TypeDefinitionBase : DefinitionBase, ITypeDefinition +public class TypeDefinitionBase : TypeSystemConfiguration, ITypeDefinition { - private List? _directives; + private List? _directives; private Type _runtimeType = typeof(object); protected TypeDefinitionBase() { } @@ -40,7 +40,7 @@ public virtual Type RuntimeType /// /// Gets the list of directives that are annotated to this type. /// - public IList Directives => + public IList Directives => _directives ??= []; /// @@ -51,7 +51,7 @@ public virtual Type RuntimeType /// /// Gets the list of directives that are annotated to this field. /// - public IReadOnlyList GetDirectives() + public IReadOnlyList GetDirectives() { if (_directives is null) { diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/TypeDependency.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/TypeDependency.cs index 94652bd6106..9aea74418e0 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/TypeDependency.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/TypeDependency.cs @@ -7,9 +7,7 @@ namespace HotChocolate.Types.Descriptors.Definitions; public sealed class TypeDependency { - public TypeDependency( - TypeReference type, - TypeDependencyFulfilled fulfilled = TypeDependencyFulfilled.Default) + public TypeDependency(TypeReference type, TypeDependencyFulfilled fulfilled = TypeDependencyFulfilled.Default) { Type = type ?? throw new ArgumentNullException(nameof(type)); Fulfilled = fulfilled; diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/DefinitionBase.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/TypeSystemConfiguration.cs similarity index 82% rename from src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/DefinitionBase.cs rename to src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/TypeSystemConfiguration.cs index f249ef83247..d64fe510707 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/DefinitionBase.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/TypeSystemConfiguration.cs @@ -9,15 +9,15 @@ namespace HotChocolate.Types.Descriptors.Definitions; /// A type system definition is used in the type initialization to store properties /// of a type system object. /// -public class DefinitionBase : IDefinition +public abstract class TypeSystemConfiguration : ITypeSystemConfiguration { private List? _dependencies; - private List? _configurations; + private List? _configurations; private ExtensionData? _contextData; private string _name = string.Empty; /// - /// Gets or sets the name the type shall have. + /// Gets or sets the name of the type system member. /// public string Name { @@ -26,7 +26,7 @@ public string Name } /// - /// Gets or sets the description the type shall have. + /// Gets or sets the description of the type system member. /// public string? Description { get; set; } @@ -57,7 +57,7 @@ public bool HasDependencies /// /// Gets configurations that shall be applied at a later point. /// - public IList Configurations + public IList Configurations => _configurations ??= []; /// @@ -80,11 +80,11 @@ public bool HasConfigurations /// /// Gets lazy configuration of this definition and all dependent definitions. /// - public virtual IEnumerable GetConfigurations() + public virtual IEnumerable GetConfigurations() { if (_configurations is null) { - return Array.Empty(); + return Array.Empty(); } return _configurations; @@ -118,16 +118,16 @@ public IReadOnlyList GetDependencies() } public void TouchContextData() - => _contextData = new ExtensionData(); + => _contextData = []; - protected void CopyTo(DefinitionBase target) + protected void CopyTo(TypeSystemConfiguration target) { - if (_dependencies is not null && _dependencies.Count > 0) + if (_dependencies?.Count > 0) { target._dependencies = [.._dependencies,]; } - if (_configurations is not null && _configurations.Count > 0) + if (_configurations?.Count > 0) { target._configurations = []; @@ -137,9 +137,9 @@ protected void CopyTo(DefinitionBase target) } } - if (_contextData is not null && _contextData.Count > 0) + if (_contextData?.Count > 0) { - target._contextData = new ExtensionData(_contextData); + target._contextData = [.. _contextData]; } if (State is { Count: > 0 }) @@ -153,15 +153,15 @@ protected void CopyTo(DefinitionBase target) target.BindTo = BindTo; } - protected void MergeInto(DefinitionBase target) + protected void MergeInto(TypeSystemConfiguration target) { - if (_dependencies is not null && _dependencies.Count > 0) + if (_dependencies?.Count > 0) { target._dependencies ??= []; target._dependencies.AddRange(_dependencies); } - if (_configurations is not null && _configurations.Count > 0) + if (_configurations?.Count > 0) { target._configurations ??= []; @@ -171,7 +171,7 @@ protected void MergeInto(DefinitionBase target) } } - if (_contextData is not null && _contextData.Count > 0) + if (_contextData?.Count > 0) { target._contextData ??= new ExtensionData(); foreach (var item in _contextData) diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/DependencyDescriptorBase~1.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/DependencyDescriptorBase~1.cs index 412d44e6f6b..6629af4151f 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/DependencyDescriptorBase~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/DependencyDescriptorBase~1.cs @@ -10,11 +10,11 @@ namespace HotChocolate.Types.Descriptors; internal abstract class DependencyDescriptorBase { - private readonly ITypeSystemMemberConfiguration _configuration; + private readonly ITypeSystemConfigurationTask _configuration; protected DependencyDescriptorBase( ITypeInspector typeInspector, - ITypeSystemMemberConfiguration configuration) + ITypeSystemConfigurationTask configuration) { TypeInspector = typeInspector ?? throw new ArgumentNullException(nameof(typeInspector)); diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/DescriptorBase~1.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/DescriptorBase~1.cs index 8ea54491c0e..a8ced815351 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/DescriptorBase~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/DescriptorBase~1.cs @@ -10,7 +10,7 @@ public abstract class DescriptorBase(IDescriptorContext context) , IDescriptorExtension , IDescriptorExtension , IDefinitionFactory - where T : DefinitionBase + where T : TypeSystemConfiguration { protected internal IDescriptorContext Context { get; } = context ?? throw new ArgumentNullException(nameof(context)); @@ -79,7 +79,7 @@ protected virtual void OnCreateDefinition(T definition) { } - DefinitionBase IDefinitionFactory.CreateDefinition() + TypeSystemConfiguration IDefinitionFactory.CreateDefinition() => CreateDefinition(); void IDescriptorExtension.OnBeforeCreate( @@ -91,11 +91,11 @@ void IDescriptorExtension.OnBeforeCreate( => OnBeforeCreate(configure); void IDescriptorExtension.OnBeforeCreate( - Action configure) + Action configure) => OnBeforeCreate((_, d) => configure(d)); void IDescriptorExtension.OnBeforeCreate( - Action configure) + Action configure) => OnBeforeCreate(configure); private void OnBeforeCreate(Action configure) @@ -115,7 +115,7 @@ INamedDependencyDescriptor IDescriptorExtension.OnBeforeNaming( => OnBeforeNaming(configure); INamedDependencyDescriptor IDescriptorExtension.OnBeforeNaming( - Action configure) + Action configure) => OnBeforeNaming(configure); private INamedDependencyDescriptor OnBeforeNaming( @@ -141,7 +141,7 @@ ICompletedDependencyDescriptor IDescriptorExtension.OnBeforeCompletion( => OnBeforeCompletion(configure); ICompletedDependencyDescriptor IDescriptorExtension.OnBeforeCompletion( - Action configure) + Action configure) => OnBeforeCompletion(configure); private ICompletedDependencyDescriptor OnBeforeCompletion( diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/DirectiveArgumentDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/DirectiveArgumentDescriptor.cs index ab6f2d1a860..d5f9d525a0c 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/DirectiveArgumentDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/DirectiveArgumentDescriptor.cs @@ -10,7 +10,7 @@ namespace HotChocolate.Types.Descriptors; /// A fluent configuration API for GraphQL directive arguments. /// public class DirectiveArgumentDescriptor - : ArgumentDescriptorBase + : ArgumentDescriptorBase , IDirectiveArgumentDescriptor { /// @@ -55,14 +55,14 @@ protected internal DirectiveArgumentDescriptor( /// protected internal DirectiveArgumentDescriptor( IDescriptorContext context, - DirectiveArgumentDefinition definition) + DirectiveArgumentConfiguration definition) : base(context) { Definition = definition ?? throw new ArgumentNullException(nameof(definition)); } /// - protected override void OnCreateDefinition(DirectiveArgumentDefinition definition) + protected override void OnCreateDefinition(DirectiveArgumentConfiguration definition) { Context.Descriptors.Push(this); @@ -186,6 +186,6 @@ public static DirectiveArgumentDescriptor New( /// An instance of public static DirectiveArgumentDescriptor From( IDescriptorContext context, - DirectiveArgumentDefinition definition) + DirectiveArgumentConfiguration definition) => new(context, definition); } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/DirectiveTypeDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/DirectiveTypeDescriptor.cs index fbfc79413f9..b18fb200f4e 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/DirectiveTypeDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/DirectiveTypeDescriptor.cs @@ -9,7 +9,7 @@ namespace HotChocolate.Types.Descriptors; public class DirectiveTypeDescriptor - : DescriptorBase + : DescriptorBase , IDirectiveTypeDescriptor { protected internal DirectiveTypeDescriptor( @@ -39,19 +39,19 @@ protected internal DirectiveTypeDescriptor(IDescriptorContext context) protected internal DirectiveTypeDescriptor( IDescriptorContext context, - DirectiveTypeDefinition definition) + DirectiveTypeConfiguration definition) : base(context) { Definition = definition ?? throw new ArgumentNullException(nameof(definition)); } - protected internal override DirectiveTypeDefinition Definition { get; protected set; } = new(); + protected internal override DirectiveTypeConfiguration Definition { get; protected set; } = new(); protected ICollection Arguments { get; } = new List(); protected override void OnCreateDefinition( - DirectiveTypeDefinition definition) + DirectiveTypeConfiguration definition) { Context.Descriptors.Push(this); @@ -64,7 +64,7 @@ protected override void OnCreateDefinition( Definition.AttributesAreApplied = true; } - var arguments = new Dictionary(StringComparer.Ordinal); + var arguments = new Dictionary(StringComparer.Ordinal); var handledMembers = new HashSet(); FieldDescriptorUtilities.AddExplicitFields( @@ -83,7 +83,7 @@ protected override void OnCreateDefinition( } protected virtual void OnCompleteArguments( - IDictionary arguments, + IDictionary arguments, ISet handledProperties) { } @@ -185,11 +185,11 @@ public static DirectiveTypeDescriptor FromSchemaType( public static DirectiveTypeDescriptor From( IDescriptorContext context, - DirectiveTypeDefinition definition) + DirectiveTypeConfiguration definition) => new(context, definition); public static DirectiveTypeDescriptor From( IDescriptorContext context, - DirectiveTypeDefinition definition) + DirectiveTypeConfiguration definition) => new DirectiveTypeDescriptor(context, definition); } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/DirectiveTypeDescriptor~1.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/DirectiveTypeDescriptor~1.cs index f8adbd66c7f..338e299beb5 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/DirectiveTypeDescriptor~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/DirectiveTypeDescriptor~1.cs @@ -21,7 +21,7 @@ protected internal DirectiveTypeDescriptor(IDescriptorContext context) protected internal DirectiveTypeDescriptor( IDescriptorContext context, - DirectiveTypeDefinition definition) + DirectiveTypeConfiguration definition) : base(context, definition) { Definition = definition; @@ -30,7 +30,7 @@ protected internal DirectiveTypeDescriptor( Type IHasRuntimeType.RuntimeType => Definition.RuntimeType; protected override void OnCompleteArguments( - IDictionary arguments, + IDictionary arguments, ISet handledProperties) { if (Definition.Arguments.IsImplicitBinding()) diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/EnumTypeDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/EnumTypeDescriptor.cs index 8cad3f72ee8..2c0cad5ee98 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/EnumTypeDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/EnumTypeDescriptor.cs @@ -5,7 +5,7 @@ namespace HotChocolate.Types.Descriptors; public class EnumTypeDescriptor - : DescriptorBase + : DescriptorBase , IEnumTypeDescriptor { protected EnumTypeDescriptor(IDescriptorContext context) @@ -24,19 +24,19 @@ protected EnumTypeDescriptor(IDescriptorContext context, Type clrType) Definition.Values.BindingBehavior = context.Options.DefaultBindingBehavior; } - protected EnumTypeDescriptor(IDescriptorContext context, EnumTypeDefinition definition) + protected EnumTypeDescriptor(IDescriptorContext context, EnumTypeConfiguration definition) : base(context) { Definition = definition ?? throw new ArgumentNullException(nameof(definition)); } - protected internal override EnumTypeDefinition Definition { get; protected set; } = new(); + protected internal override EnumTypeConfiguration Definition { get; protected set; } = new(); protected ICollection Values { get; } = new List(); protected override void OnCreateDefinition( - EnumTypeDefinition definition) + EnumTypeConfiguration definition) { Context.Descriptors.Push(this); @@ -65,8 +65,8 @@ protected override void OnCreateDefinition( } protected void AddImplicitValues( - EnumTypeDefinition typeDefinition, - IDictionary values) + EnumTypeConfiguration typeDefinition, + IDictionary values) { if (typeDefinition.Values.IsImplicitBinding()) { @@ -186,11 +186,11 @@ public static EnumTypeDescriptor FromSchemaType( public static EnumTypeDescriptor From( IDescriptorContext context, - EnumTypeDefinition definition) => + EnumTypeConfiguration definition) => new(context, definition); public static EnumTypeDescriptor From( IDescriptorContext context, - EnumTypeDefinition definition) => + EnumTypeConfiguration definition) => new(context, definition); } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/EnumTypeDescriptor~1.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/EnumTypeDescriptor~1.cs index 18c3faf92fd..a8ba6b1eb9f 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/EnumTypeDescriptor~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/EnumTypeDescriptor~1.cs @@ -14,7 +14,7 @@ protected internal EnumTypeDescriptor(IDescriptorContext context) protected internal EnumTypeDescriptor( IDescriptorContext context, - EnumTypeDefinition definition) + EnumTypeConfiguration definition) : base(context, definition) { } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/EnumValueDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/EnumValueDescriptor.cs index 191fdfd8333..fcca9193c17 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/EnumValueDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/EnumValueDescriptor.cs @@ -5,7 +5,7 @@ namespace HotChocolate.Types.Descriptors; public class EnumValueDescriptor - : DescriptorBase + : DescriptorBase , IEnumValueDescriptor { protected EnumValueDescriptor(IDescriptorContext context, object runtimeValue) @@ -26,15 +26,15 @@ protected EnumValueDescriptor(IDescriptorContext context, object runtimeValue) } } - protected EnumValueDescriptor(IDescriptorContext context, EnumValueDefinition definition) + protected EnumValueDescriptor(IDescriptorContext context, EnumValueConfiguration definition) : base(context) { Definition = definition ?? throw new ArgumentNullException(nameof(definition)); } - protected internal override EnumValueDefinition Definition { get; protected set; } = new(); + protected internal override EnumValueConfiguration Definition { get; protected set; } = new(); - protected override void OnCreateDefinition(EnumValueDefinition definition) + protected override void OnCreateDefinition(EnumValueConfiguration definition) { Context.Descriptors.Push(this); @@ -124,6 +124,6 @@ public static EnumValueDescriptor New( public static EnumValueDescriptor From( IDescriptorContext context, - EnumValueDefinition definition) => + EnumValueConfiguration definition) => new EnumValueDescriptor(context, definition); } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Extensions/DescriptorExtensions.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Extensions/DescriptorExtensions.cs index 3a7cd2dd621..a2e89850fe3 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Extensions/DescriptorExtensions.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Extensions/DescriptorExtensions.cs @@ -11,26 +11,26 @@ public static ObjectTypeDescriptor ToDescriptor( => ObjectTypeDescriptor.From(context, definition); public static ObjectFieldDescriptor ToDescriptor( - this ObjectFieldDefinition definition, + this ObjectFieldConfiguration definition, IDescriptorContext context) => ObjectFieldDescriptor.From(context, definition); public static ArgumentDescriptor ToDescriptor( - this ArgumentDefinition definition, + this ArgumentConfiguration definition, IDescriptorContext context) => ArgumentDescriptor.From(context, definition); public static EnumTypeDescriptor ToDescriptor( - this EnumTypeDefinition definition, + this EnumTypeConfiguration definition, IDescriptorContext context) => EnumTypeDescriptor.From(context, definition); public static EnumValueDescriptor ToDescriptor( - this EnumValueDefinition definition, + this EnumValueConfiguration definition, IDescriptorContext context) => EnumValueDescriptor.From(context, definition); - public static T ToDefinition(this IDescriptor descriptor) where T : DefinitionBase + public static T ToDefinition(this IDescriptor descriptor) where T : TypeSystemConfiguration => descriptor is DescriptorBase desc ? desc.CreateDefinition() : throw new NotSupportedException("The specified descriptor is not supported."); diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/InputFieldDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/InputFieldDescriptor.cs index 9afefc0efd5..1f451c9ea6d 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/InputFieldDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/InputFieldDescriptor.cs @@ -8,7 +8,7 @@ namespace HotChocolate.Types.Descriptors; public class InputFieldDescriptor - : ArgumentDescriptorBase + : ArgumentDescriptorBase , IInputFieldDescriptor { /// @@ -27,7 +27,7 @@ protected internal InputFieldDescriptor( /// protected internal InputFieldDescriptor( IDescriptorContext context, - InputFieldDefinition definition) + InputFieldConfiguration definition) : base(context) { Definition = definition ?? throw new ArgumentNullException(nameof(definition)); @@ -59,7 +59,7 @@ protected internal InputFieldDescriptor( } /// - protected override void OnCreateDefinition(InputFieldDefinition definition) + protected override void OnCreateDefinition(InputFieldConfiguration definition) { Context.Descriptors.Push(this); @@ -211,6 +211,6 @@ public static InputFieldDescriptor New( /// An instance of public static InputFieldDescriptor From( IDescriptorContext context, - InputFieldDefinition definition) => + InputFieldConfiguration definition) => new(context, definition); } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/InputObjectTypeDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/InputObjectTypeDescriptor.cs index 5c46318a432..cb2584471b2 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/InputObjectTypeDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/InputObjectTypeDescriptor.cs @@ -10,7 +10,7 @@ namespace HotChocolate.Types.Descriptors; public class InputObjectTypeDescriptor - : DescriptorBase + : DescriptorBase , IInputObjectTypeDescriptor { private readonly List _fields = []; @@ -38,7 +38,7 @@ protected InputObjectTypeDescriptor(IDescriptorContext context) protected InputObjectTypeDescriptor( IDescriptorContext context, - InputObjectTypeDefinition definition) + InputObjectTypeConfiguration definition) : base(context) { Definition = definition ?? throw new ArgumentNullException(nameof(definition)); @@ -49,13 +49,13 @@ protected InputObjectTypeDescriptor( } } - protected internal override InputObjectTypeDefinition Definition { get; protected set; } = + protected internal override InputObjectTypeConfiguration Definition { get; protected set; } = new(); protected ICollection Fields => _fields; protected override void OnCreateDefinition( - InputObjectTypeDefinition definition) + InputObjectTypeConfiguration definition) { Context.Descriptors.Push(this); @@ -100,7 +100,7 @@ protected override void OnCreateDefinition( } protected void InferFieldsFromFieldBindingType( - IDictionary fields, + IDictionary fields, ISet handledMembers) { if (Definition.Fields.IsImplicitBinding()) @@ -136,7 +136,7 @@ protected void InferFieldsFromFieldBindingType( } protected virtual void OnCompleteFields( - IDictionary fields, + IDictionary fields, ISet handledMembers) { } @@ -206,12 +206,12 @@ public static InputObjectTypeDescriptor FromSchemaType( public static InputObjectTypeDescriptor From( IDescriptorContext context, - InputObjectTypeDefinition definition) + InputObjectTypeConfiguration definition) => new(context, definition); public static InputObjectTypeDescriptor From( IDescriptorContext context, - InputObjectTypeDefinition definition) + InputObjectTypeConfiguration definition) => new(context, definition); /// diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/InputObjectTypeDescriptor~1.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/InputObjectTypeDescriptor~1.cs index 4c3f2cc96f1..122144dfd8a 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/InputObjectTypeDescriptor~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/InputObjectTypeDescriptor~1.cs @@ -20,7 +20,7 @@ protected internal InputObjectTypeDescriptor(IDescriptorContext context) protected internal InputObjectTypeDescriptor( IDescriptorContext context, - InputObjectTypeDefinition definition) + InputObjectTypeConfiguration definition) : base(context, definition) { } @@ -28,7 +28,7 @@ protected internal InputObjectTypeDescriptor( Type IHasRuntimeType.RuntimeType => Definition.RuntimeType; protected override void OnCompleteFields( - IDictionary fields, + IDictionary fields, ISet handledMembers) { InferFieldsFromFieldBindingType(fields, handledMembers); diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/InterfaceFieldDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/InterfaceFieldDescriptor.cs index a1026802d11..5ffe1001a04 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/InterfaceFieldDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/InterfaceFieldDescriptor.cs @@ -13,7 +13,7 @@ namespace HotChocolate.Types.Descriptors; public class InterfaceFieldDescriptor - : OutputFieldDescriptorBase + : OutputFieldDescriptorBase , IInterfaceFieldDescriptor { private ParameterInfo[] _parameterInfos = []; @@ -29,7 +29,7 @@ protected internal InterfaceFieldDescriptor( protected internal InterfaceFieldDescriptor( IDescriptorContext context, - InterfaceFieldDefinition definition) + InterfaceFieldConfiguration definition) : base(context) { Definition = definition ?? throw new ArgumentNullException(nameof(definition)); @@ -59,9 +59,9 @@ protected internal InterfaceFieldDescriptor( } } - protected internal override InterfaceFieldDefinition Definition { get; protected set; } = new(); + protected internal override InterfaceFieldConfiguration Definition { get; protected set; } = new(); - protected override void OnCreateDefinition(InterfaceFieldDefinition definition) + protected override void OnCreateDefinition(InterfaceFieldConfiguration definition) { Context.Descriptors.Push(this); @@ -78,7 +78,7 @@ protected override void OnCreateDefinition(InterfaceFieldDefinition definition) Context.Descriptors.Pop(); } - private void CompleteArguments(InterfaceFieldDefinition definition) + private void CompleteArguments(InterfaceFieldConfiguration definition) { if (!_argumentsInitialized && Parameters.Any()) { @@ -312,6 +312,6 @@ public static InterfaceFieldDescriptor New( public static InterfaceFieldDescriptor From( IDescriptorContext context, - InterfaceFieldDefinition definition) + InterfaceFieldConfiguration definition) => new(context, definition); } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/InterfaceTypeDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/InterfaceTypeDescriptor.cs index 34695f46c48..89b6ff8210b 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/InterfaceTypeDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/InterfaceTypeDescriptor.cs @@ -8,7 +8,7 @@ namespace HotChocolate.Types.Descriptors; public class InterfaceTypeDescriptor - : DescriptorBase + : DescriptorBase , IInterfaceTypeDescriptor { protected InterfaceTypeDescriptor( @@ -35,7 +35,7 @@ protected InterfaceTypeDescriptor( protected InterfaceTypeDescriptor( IDescriptorContext context, - InterfaceTypeDefinition definition) + InterfaceTypeConfiguration definition) : base(context) { Definition = definition ?? throw new ArgumentNullException(nameof(definition)); @@ -46,14 +46,14 @@ protected InterfaceTypeDescriptor( } } - protected internal override InterfaceTypeDefinition Definition { get; protected set; } = + protected internal override InterfaceTypeConfiguration Definition { get; protected set; } = new(); protected ICollection Fields { get; } = new List(); protected override void OnCreateDefinition( - InterfaceTypeDefinition definition) + InterfaceTypeConfiguration definition) { Context.Descriptors.Push(this); @@ -66,7 +66,7 @@ protected override void OnCreateDefinition( Definition.AttributesAreApplied = true; } - var fields = new Dictionary(); + var fields = new Dictionary(); var handledMembers = new HashSet(); FieldDescriptorUtilities.AddExplicitFields( @@ -86,7 +86,7 @@ protected override void OnCreateDefinition( } protected virtual void OnCompleteFields( - IDictionary fields, + IDictionary fields, ISet handledMembers) { } @@ -200,11 +200,11 @@ public static InterfaceTypeDescriptor FromSchemaType( public static InterfaceTypeDescriptor From( IDescriptorContext context, - InterfaceTypeDefinition definition) + InterfaceTypeConfiguration definition) => new(context, definition); public static InterfaceTypeDescriptor From( IDescriptorContext context, - InterfaceTypeDefinition definition) + InterfaceTypeConfiguration definition) => new(context, definition); } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/InterfaceTypeDescriptor~1.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/InterfaceTypeDescriptor~1.cs index 362a453ac71..c263c0ac1ad 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/InterfaceTypeDescriptor~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/InterfaceTypeDescriptor~1.cs @@ -21,7 +21,7 @@ protected internal InterfaceTypeDescriptor(IDescriptorContext context) protected internal InterfaceTypeDescriptor( IDescriptorContext context, - InterfaceTypeDefinition definition) + InterfaceTypeConfiguration definition) : base(context, definition) { } @@ -29,7 +29,7 @@ protected internal InterfaceTypeDescriptor( Type IHasRuntimeType.RuntimeType => Definition.RuntimeType; protected override void OnCompleteFields( - IDictionary fields, + IDictionary fields, ISet handledMembers) { if (Definition.Fields.IsImplicitBinding()) diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/ObjectFieldDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/ObjectFieldDescriptor.cs index f7b9e5da5cd..0cec64373b0 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/ObjectFieldDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/ObjectFieldDescriptor.cs @@ -17,7 +17,7 @@ namespace HotChocolate.Types.Descriptors; public class ObjectFieldDescriptor - : OutputFieldDescriptorBase + : OutputFieldDescriptorBase , IObjectFieldDescriptor { private bool _argumentsInitialized; @@ -127,16 +127,16 @@ protected ObjectFieldDescriptor( /// protected ObjectFieldDescriptor( IDescriptorContext context, - ObjectFieldDefinition definition) + ObjectFieldConfiguration definition) : base(context) { Definition = definition ?? throw new ArgumentNullException(nameof(definition)); } - protected internal override ObjectFieldDefinition Definition { get; protected set; } = new(); + protected internal override ObjectFieldConfiguration Definition { get; protected set; } = new(); /// - protected override void OnCreateDefinition(ObjectFieldDefinition definition) + protected override void OnCreateDefinition(ObjectFieldConfiguration definition) { Context.Descriptors.Push(this); @@ -162,7 +162,7 @@ protected override void OnCreateDefinition(ObjectFieldDefinition definition) Context.Descriptors.Pop(); } - private void CompleteArguments(ObjectFieldDefinition definition) + private void CompleteArguments(ObjectFieldConfiguration definition) { if (!_argumentsInitialized) { @@ -559,7 +559,7 @@ public static ObjectFieldDescriptor New( /// public static ObjectFieldDescriptor From( IDescriptorContext context, - ObjectFieldDefinition definition) + ObjectFieldConfiguration definition) => new(context, definition); public static class ExpressionSelectionSetFormatter diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/ObjectTypeDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/ObjectTypeDescriptor.cs index 73e72228368..a78e36d0e9f 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/ObjectTypeDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/ObjectTypeDescriptor.cs @@ -141,7 +141,7 @@ internal void InferFieldsFromFieldBindingType() } private protected void InferFieldsFromFieldBindingType( - IDictionary fields, + IDictionary fields, ISet handledMembers, bool createDefinition = true) { @@ -233,7 +233,7 @@ static bool IncludeField( } protected virtual void OnCompleteFields( - IDictionary fields, + IDictionary fields, ISet handledMembers) { } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/ObjectTypeDescriptorBase~1.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/ObjectTypeDescriptorBase~1.cs index 68e131d8744..f43f5125b69 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/ObjectTypeDescriptorBase~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/ObjectTypeDescriptorBase~1.cs @@ -28,7 +28,7 @@ protected ObjectTypeDescriptorBase( Type IHasRuntimeType.RuntimeType => Definition.RuntimeType; protected override void OnCompleteFields( - IDictionary fields, + IDictionary fields, ISet handledMembers) { InferFieldsFromFieldBindingType(fields, handledMembers); diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/OutputFieldDescriptorBase.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/OutputFieldDescriptorBase.cs index 56f3732726e..8758e156247 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/OutputFieldDescriptorBase.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/OutputFieldDescriptorBase.cs @@ -13,7 +13,7 @@ namespace HotChocolate.Types.Descriptors; public abstract class OutputFieldDescriptorBase : DescriptorBase - where TDefinition : OutputFieldDefinitionBase + where TDefinition : OutputFieldConfiguration { private ICollection? _arguments; diff --git a/src/HotChocolate/Core/src/Types/Types/DirectiveArgument.cs b/src/HotChocolate/Core/src/Types/Types/DirectiveArgument.cs index e672a6bce37..f6dac94e4b5 100644 --- a/src/HotChocolate/Core/src/Types/Types/DirectiveArgument.cs +++ b/src/HotChocolate/Core/src/Types/Types/DirectiveArgument.cs @@ -18,7 +18,7 @@ public sealed class DirectiveArgument : Argument, IHasProperty /// /// The position of the argument within the field collection. /// - public DirectiveArgument(DirectiveArgumentDefinition definition, int index) + public DirectiveArgument(DirectiveArgumentConfiguration definition, int index) : base(definition, index) { Property = definition.Property; diff --git a/src/HotChocolate/Core/src/Types/Types/DirectiveCollection.cs b/src/HotChocolate/Core/src/Types/Types/DirectiveCollection.cs index d2566628106..e642fd7aec0 100644 --- a/src/HotChocolate/Core/src/Types/Types/DirectiveCollection.cs +++ b/src/HotChocolate/Core/src/Types/Types/DirectiveCollection.cs @@ -111,7 +111,7 @@ public bool ContainsDirective() internal static DirectiveCollection CreateAndComplete( ITypeCompletionContext context, object source, - IReadOnlyList definitions) + IReadOnlyList definitions) { var location = DirectiveHelper.InferDirectiveLocation(source); return CreateAndComplete(context, location, source, definitions); @@ -121,7 +121,7 @@ internal static DirectiveCollection CreateAndComplete( ITypeCompletionContext context, DirectiveLocation location, object source, - IReadOnlyList definitions) + IReadOnlyList definitions) { if (context is null) { diff --git a/src/HotChocolate/Core/src/Types/Types/DirectiveType.Initialization.cs b/src/HotChocolate/Core/src/Types/Types/DirectiveType.Initialization.cs index 2cab32974b5..b008a28d47c 100644 --- a/src/HotChocolate/Core/src/Types/Types/DirectiveType.Initialization.cs +++ b/src/HotChocolate/Core/src/Types/Types/DirectiveType.Initialization.cs @@ -15,7 +15,7 @@ namespace HotChocolate.Types; public partial class DirectiveType { - protected override DirectiveTypeDefinition CreateDefinition(ITypeDiscoveryContext context) + protected override DirectiveTypeConfiguration CreateDefinition(ITypeDiscoveryContext context) { try { @@ -40,7 +40,7 @@ protected virtual void Configure(IDirectiveTypeDescriptor descriptor) { } protected override void OnRegisterDependencies( ITypeDiscoveryContext context, - DirectiveTypeDefinition definition) + DirectiveTypeConfiguration definition) { base.OnRegisterDependencies(context, definition); @@ -60,7 +60,7 @@ protected override void OnRegisterDependencies( protected override void OnCompleteType( ITypeCompletionContext context, - DirectiveTypeDefinition definition) + DirectiveTypeConfiguration definition) { base.OnCompleteType(context, definition); @@ -87,7 +87,7 @@ protected override void OnCompleteType( protected override void OnCompleteMetadata( ITypeCompletionContext context, - DirectiveTypeDefinition definition) + DirectiveTypeConfiguration definition) { base.OnCompleteMetadata(context, definition); @@ -99,7 +99,7 @@ protected override void OnCompleteMetadata( protected override void OnMakeExecutable( ITypeCompletionContext context, - DirectiveTypeDefinition definition) + DirectiveTypeConfiguration definition) { base.OnMakeExecutable(context, definition); @@ -111,7 +111,7 @@ protected override void OnMakeExecutable( protected override void OnFinalizeType( ITypeCompletionContext context, - DirectiveTypeDefinition definition) + DirectiveTypeConfiguration definition) { base.OnFinalizeType(context, definition); @@ -123,16 +123,16 @@ protected override void OnFinalizeType( protected virtual FieldCollection OnCompleteFields( ITypeCompletionContext context, - DirectiveTypeDefinition definition) + DirectiveTypeConfiguration definition) { return CompleteFields(context, this, definition.GetArguments(), CreateArgument); - static DirectiveArgument CreateArgument(DirectiveArgumentDefinition argDef, int index) + static DirectiveArgument CreateArgument(DirectiveArgumentConfiguration argDef, int index) => new(argDef, index); } protected virtual Func OnCompleteCreateInstance( ITypeCompletionContext context, - DirectiveTypeDefinition definition) + DirectiveTypeConfiguration definition) { if (definition.CreateInstance is not null) { @@ -149,7 +149,7 @@ static DirectiveArgument CreateArgument(DirectiveArgumentDefinition argDef, int protected virtual Action OnCompleteGetFieldValues( ITypeCompletionContext context, - DirectiveTypeDefinition definition) + DirectiveTypeConfiguration definition) { if (definition.GetFieldData is not null) { @@ -166,7 +166,7 @@ static DirectiveArgument CreateArgument(DirectiveArgumentDefinition argDef, int protected virtual Func OnCompleteParse( ITypeCompletionContext context, - DirectiveTypeDefinition definition) + DirectiveTypeConfiguration definition) { if (definition.Parse is not null) { @@ -179,7 +179,7 @@ protected virtual Func OnCompleteParse( protected virtual Func OnCompleteFormat( ITypeCompletionContext context, - DirectiveTypeDefinition definition) + DirectiveTypeConfiguration definition) { if (definition.Format is not null) { @@ -192,7 +192,7 @@ protected virtual Func OnCompleteFormat( protected virtual DirectiveMiddleware? OnCompleteMiddleware( ITypeCompletionContext context, - DirectiveTypeDefinition definition) + DirectiveTypeConfiguration definition) { if (definition.MiddlewareComponents.Count == 0) { diff --git a/src/HotChocolate/Core/src/Types/Types/DirectiveType.cs b/src/HotChocolate/Core/src/Types/Types/DirectiveType.cs index d306389742f..13d2f4f1be8 100644 --- a/src/HotChocolate/Core/src/Types/Types/DirectiveType.cs +++ b/src/HotChocolate/Core/src/Types/Types/DirectiveType.cs @@ -17,7 +17,7 @@ namespace HotChocolate.Types; /// https://spec.graphql.org/draft/#sec-Type-System.Directives /// public partial class DirectiveType - : TypeSystemObjectBase + : TypeSystemObjectBase , IHasRuntimeType , IHasTypeIdentity { @@ -44,7 +44,7 @@ public DirectiveType(Action configure) /// /// Returns the newly created directive type. /// - public static DirectiveType CreateUnsafe(DirectiveTypeDefinition definition) + public static DirectiveType CreateUnsafe(DirectiveTypeConfiguration definition) => new() { Definition = definition, }; /// diff --git a/src/HotChocolate/Core/src/Types/Types/DirectiveType~1.cs b/src/HotChocolate/Core/src/Types/Types/DirectiveType~1.cs index 55b126d8550..7f68eb1c4b0 100644 --- a/src/HotChocolate/Core/src/Types/Types/DirectiveType~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/DirectiveType~1.cs @@ -22,7 +22,7 @@ public DirectiveType() _configure = Configure; } - protected override DirectiveTypeDefinition CreateDefinition( + protected override DirectiveTypeConfiguration CreateDefinition( ITypeDiscoveryContext context) { var descriptor = DirectiveTypeDescriptor.New(context.DescriptorContext); diff --git a/src/HotChocolate/Core/src/Types/Types/Directives/DirectiveTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/Types/Directives/DirectiveTypeInterceptor.cs index 2746691c72f..4a8352e6159 100644 --- a/src/HotChocolate/Core/src/Types/Types/Directives/DirectiveTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Directives/DirectiveTypeInterceptor.cs @@ -13,7 +13,7 @@ internal sealed class DirectiveTypeInterceptor : TypeInterceptor public override void OnAfterCompleteMetadata( ITypeCompletionContext context, - DefinitionBase definition) + TypeSystemConfiguration definition) { base.OnAfterCompleteMetadata(context, definition); diff --git a/src/HotChocolate/Core/src/Types/Types/EnumType.Initialization.cs b/src/HotChocolate/Core/src/Types/Types/EnumType.Initialization.cs index 325066e0235..e8002cf3e9e 100644 --- a/src/HotChocolate/Core/src/Types/Types/EnumType.Initialization.cs +++ b/src/HotChocolate/Core/src/Types/Types/EnumType.Initialization.cs @@ -48,7 +48,7 @@ public EnumType(Action configure) /// /// Returns the newly created enum type. /// - public static EnumType CreateUnsafe(EnumTypeDefinition definition) + public static EnumType CreateUnsafe(EnumTypeConfiguration definition) => new() { Definition = definition, }; /// @@ -60,7 +60,7 @@ public static EnumType CreateUnsafe(EnumTypeDefinition definition) protected virtual void Configure(IEnumTypeDescriptor descriptor) { } /// - protected override EnumTypeDefinition CreateDefinition(ITypeDiscoveryContext context) + protected override EnumTypeConfiguration CreateDefinition(ITypeDiscoveryContext context) { try { @@ -84,7 +84,7 @@ protected override EnumTypeDefinition CreateDefinition(ITypeDiscoveryContext con /// protected override void OnRegisterDependencies( ITypeDiscoveryContext context, - EnumTypeDefinition definition) + EnumTypeConfiguration definition) { base.OnRegisterDependencies(context, definition); context.RegisterDependencies(definition); @@ -94,7 +94,7 @@ protected override void OnRegisterDependencies( /// protected override void OnCompleteType( ITypeCompletionContext context, - EnumTypeDefinition definition) + EnumTypeConfiguration definition) { base.OnCompleteType(context, definition); @@ -135,7 +135,7 @@ protected override void OnCompleteType( protected override void OnCompleteMetadata( ITypeCompletionContext context, - EnumTypeDefinition definition) + EnumTypeConfiguration definition) { base.OnCompleteMetadata(context, definition); @@ -147,7 +147,7 @@ protected override void OnCompleteMetadata( protected virtual bool TryCreateEnumValue( ITypeCompletionContext context, - EnumValueDefinition definition, + EnumValueConfiguration definition, [NotNullWhen(true)] out IEnumValue? enumValue) { enumValue = new EnumValue(definition); diff --git a/src/HotChocolate/Core/src/Types/Types/EnumType.cs b/src/HotChocolate/Core/src/Types/Types/EnumType.cs index 4f81941bef0..a99688357ad 100644 --- a/src/HotChocolate/Core/src/Types/Types/EnumType.cs +++ b/src/HotChocolate/Core/src/Types/Types/EnumType.cs @@ -28,7 +28,7 @@ namespace HotChocolate.Types; /// /// public partial class EnumType - : NamedTypeBase + : NamedTypeBase , IEnumType { /// diff --git a/src/HotChocolate/Core/src/Types/Types/EnumTypeExtension.cs b/src/HotChocolate/Core/src/Types/Types/EnumTypeExtension.cs index 33831aff860..50dd8f4e1b4 100644 --- a/src/HotChocolate/Core/src/Types/Types/EnumTypeExtension.cs +++ b/src/HotChocolate/Core/src/Types/Types/EnumTypeExtension.cs @@ -14,7 +14,7 @@ namespace HotChocolate.Types; /// some original enum type. For example, this might be used to represent additional local data, /// or by a GraphQL service which is itself an extension of another GraphQL service. /// -public class EnumTypeExtension : NamedTypeExtensionBase +public class EnumTypeExtension : NamedTypeExtensionBase { private Action? _configure; @@ -47,13 +47,13 @@ public EnumTypeExtension(Action configure) /// /// Returns the newly created enum type extension. /// - public static EnumTypeExtension CreateUnsafe(EnumTypeDefinition definition) + public static EnumTypeExtension CreateUnsafe(EnumTypeConfiguration definition) => new() { Definition = definition, }; /// public override TypeKind Kind => TypeKind.Enum; - protected override EnumTypeDefinition CreateDefinition(ITypeDiscoveryContext context) + protected override EnumTypeConfiguration CreateDefinition(ITypeDiscoveryContext context) { try { @@ -82,7 +82,7 @@ protected virtual void Configure(IEnumTypeDescriptor descriptor) { } protected override void OnRegisterDependencies( ITypeDiscoveryContext context, - EnumTypeDefinition definition) + EnumTypeConfiguration definition) { base.OnRegisterDependencies(context, definition); context.RegisterDependencies(definition); @@ -124,8 +124,8 @@ protected override void Merge( private void MergeValues( ITypeCompletionContext context, - EnumTypeDefinition extension, - EnumTypeDefinition type) + EnumTypeConfiguration extension, + EnumTypeConfiguration type) { foreach (var enumValue in extension.Values.Where(t => t.RuntimeValue != null)) diff --git a/src/HotChocolate/Core/src/Types/Types/EnumType~1.cs b/src/HotChocolate/Core/src/Types/Types/EnumType~1.cs index 68ac5f0f0e7..e188f9ba985 100644 --- a/src/HotChocolate/Core/src/Types/Types/EnumType~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/EnumType~1.cs @@ -76,7 +76,7 @@ protected sealed override void Configure(IEnumTypeDescriptor descriptor) => throw new NotSupportedException(); /// - protected override EnumTypeDefinition CreateDefinition( + protected override EnumTypeConfiguration CreateDefinition( ITypeDiscoveryContext context) { var descriptor = diff --git a/src/HotChocolate/Core/src/Types/Types/EnumValue.cs b/src/HotChocolate/Core/src/Types/Types/EnumValue.cs index df5c5042ae8..be5849c81b7 100644 --- a/src/HotChocolate/Core/src/Types/Types/EnumValue.cs +++ b/src/HotChocolate/Core/src/Types/Types/EnumValue.cs @@ -9,9 +9,9 @@ namespace HotChocolate.Types; public sealed class EnumValue : IEnumValue, IEnumValueCompletion { - private EnumValueDefinition? _enumValueDefinition; + private EnumValueConfiguration? _enumValueDefinition; - public EnumValue(EnumValueDefinition enumValueDefinition) + public EnumValue(EnumValueConfiguration enumValueDefinition) { if (enumValueDefinition is null) { diff --git a/src/HotChocolate/Core/src/Types/Types/Extensions/TypeExtensions.cs b/src/HotChocolate/Core/src/Types/Types/Extensions/TypeExtensions.cs index acd27545093..d3309e5bcbf 100644 --- a/src/HotChocolate/Core/src/Types/Types/Extensions/TypeExtensions.cs +++ b/src/HotChocolate/Core/src/Types/Types/Extensions/TypeExtensions.cs @@ -594,7 +594,7 @@ public static Type ToRuntimeType(this IType type) return ToRuntimeType(type.InnerType()); } - if (type is IHasRuntimeType { RuntimeType: { }, } t) + if (type is IHasRuntimeType t) { return t.RuntimeType; } diff --git a/src/HotChocolate/Core/src/Types/Types/Factories/DirectiveTypeFactory.cs b/src/HotChocolate/Core/src/Types/Types/Factories/DirectiveTypeFactory.cs index ffd55f6cd33..4e1d7dd9a5b 100644 --- a/src/HotChocolate/Core/src/Types/Types/Factories/DirectiveTypeFactory.cs +++ b/src/HotChocolate/Core/src/Types/Types/Factories/DirectiveTypeFactory.cs @@ -10,7 +10,7 @@ internal sealed class DirectiveTypeFactory : ITypeFactory arguments) { foreach (var argument in arguments) { - var argumentDefinition = new DirectiveArgumentDefinition( + var argumentDefinition = new DirectiveArgumentConfiguration( argument.Name.Value, argument.Description?.Value, TypeReference.Create(argument.Type), @@ -48,7 +48,7 @@ private static void DeclareArguments( } private static void DeclareLocations( - DirectiveTypeDefinition parent, + DirectiveTypeConfiguration parent, DirectiveDefinitionNode node) { parent.Locations = Parse(node.Locations); diff --git a/src/HotChocolate/Core/src/Types/Types/Factories/EnumTypeFactory.cs b/src/HotChocolate/Core/src/Types/Types/Factories/EnumTypeFactory.cs index 8c2511925f9..c31a8fbed83 100644 --- a/src/HotChocolate/Core/src/Types/Types/Factories/EnumTypeFactory.cs +++ b/src/HotChocolate/Core/src/Types/Types/Factories/EnumTypeFactory.cs @@ -13,7 +13,7 @@ public EnumType Create(IDescriptorContext context, EnumTypeDefinitionNode node) var path = context.GetOrCreateDefinitionStack(); path.Clear(); - var typeDefinition = new EnumTypeDefinition( + var typeDefinition = new EnumTypeConfiguration( node.Name.Value, node.Description?.Value) { @@ -32,7 +32,7 @@ public EnumTypeExtension Create(IDescriptorContext context, EnumTypeExtensionNod var path = context.GetOrCreateDefinitionStack(); path.Clear(); - var typeDefinition = new EnumTypeDefinition(node.Name.Value) + var typeDefinition = new EnumTypeConfiguration(node.Name.Value) { BindTo = node.GetBindingValue(), }; @@ -46,15 +46,15 @@ public EnumTypeExtension Create(IDescriptorContext context, EnumTypeExtensionNod private static void DeclareValues( IDescriptorContext context, - EnumTypeDefinition parent, + EnumTypeConfiguration parent, IReadOnlyCollection values, - Stack path) + Stack path) { path.Push(parent); foreach (var value in values) { - var valueDefinition = new EnumValueDefinition( + var valueDefinition = new EnumValueConfiguration( value.Name.Value, value.Description?.Value, value.Name.Value) diff --git a/src/HotChocolate/Core/src/Types/Types/Factories/InputObjectTypeFactory.cs b/src/HotChocolate/Core/src/Types/Types/Factories/InputObjectTypeFactory.cs index 554541ee9c2..f89d375a94b 100644 --- a/src/HotChocolate/Core/src/Types/Types/Factories/InputObjectTypeFactory.cs +++ b/src/HotChocolate/Core/src/Types/Types/Factories/InputObjectTypeFactory.cs @@ -15,7 +15,7 @@ public InputObjectType Create( var path = context.GetOrCreateDefinitionStack(); path.Clear(); - var typeDefinition = new InputObjectTypeDefinition( + var typeDefinition = new InputObjectTypeConfiguration( node.Name.Value, node.Description?.Value) { @@ -34,7 +34,7 @@ public InputObjectTypeExtension Create(IDescriptorContext context, InputObjectTy var path = context.GetOrCreateDefinitionStack(); path.Clear(); - var typeDefinition = new InputObjectTypeDefinition(node.Name.Value) + var typeDefinition = new InputObjectTypeConfiguration(node.Name.Value) { BindTo = node.GetBindingValue(), }; @@ -48,15 +48,15 @@ public InputObjectTypeExtension Create(IDescriptorContext context, InputObjectTy private static void DeclareFields( IDescriptorContext context, - InputObjectTypeDefinition parent, + InputObjectTypeConfiguration parent, IReadOnlyCollection fields, - Stack path) + Stack path) { path.Push(parent); foreach (var inputField in fields) { - var inputFieldDefinition = new InputFieldDefinition( + var inputFieldDefinition = new InputFieldConfiguration( inputField.Name.Value, inputField.Description?.Value, TypeReference.Create(inputField.Type), diff --git a/src/HotChocolate/Core/src/Types/Types/Factories/InterfaceTypeFactory.cs b/src/HotChocolate/Core/src/Types/Types/Factories/InterfaceTypeFactory.cs index f5b5949936a..525daaa64c6 100644 --- a/src/HotChocolate/Core/src/Types/Types/Factories/InterfaceTypeFactory.cs +++ b/src/HotChocolate/Core/src/Types/Types/Factories/InterfaceTypeFactory.cs @@ -13,7 +13,7 @@ public InterfaceType Create(IDescriptorContext context, InterfaceTypeDefinitionN var path = context.GetOrCreateDefinitionStack(); path.Clear(); - var typeDefinition = new InterfaceTypeDefinition( + var typeDefinition = new InterfaceTypeConfiguration( node.Name.Value, node.Description?.Value) { @@ -37,7 +37,7 @@ public InterfaceTypeExtension Create(IDescriptorContext context, InterfaceTypeEx var path = context.GetOrCreateDefinitionStack(); path.Clear(); - var typeDefinition = new InterfaceTypeDefinition(node.Name.Value) + var typeDefinition = new InterfaceTypeConfiguration(node.Name.Value) { BindTo = node.GetBindingValue(), }; @@ -56,15 +56,15 @@ public InterfaceTypeExtension Create(IDescriptorContext context, InterfaceTypeEx private static void DeclareFields( IDescriptorContext context, - InterfaceTypeDefinition parent, + InterfaceTypeConfiguration parent, IReadOnlyCollection fields, - Stack path) + Stack path) { path.Push(parent); foreach (var field in fields) { - var fieldDefinition = new InterfaceFieldDefinition( + var fieldDefinition = new InterfaceFieldConfiguration( field.Name.Value, field.Description?.Value, TypeReference.Create(field.Type)) @@ -89,15 +89,15 @@ private static void DeclareFields( private static void DeclareFieldArguments( IDescriptorContext context, - InterfaceFieldDefinition parent, + InterfaceFieldConfiguration parent, FieldDefinitionNode field, - Stack path) + Stack path) { path.Push(parent); foreach (var argument in field.Arguments) { - var argumentDefinition = new ArgumentDefinition( + var argumentDefinition = new ArgumentConfiguration( argument.Name.Value, argument.Description?.Value, TypeReference.Create(argument.Type), diff --git a/src/HotChocolate/Core/src/Types/Types/Factories/ObjectTypeFactory.cs b/src/HotChocolate/Core/src/Types/Types/Factories/ObjectTypeFactory.cs index fbfb4831ff9..0aeef79b800 100644 --- a/src/HotChocolate/Core/src/Types/Types/Factories/ObjectTypeFactory.cs +++ b/src/HotChocolate/Core/src/Types/Types/Factories/ObjectTypeFactory.cs @@ -60,13 +60,13 @@ private static void DeclareFields( IDescriptorContext context, ObjectTypeDefinition parent, IReadOnlyCollection fields, - Stack path) + Stack path) { path.Push(parent); foreach (var field in fields) { - var fieldDefinition = new ObjectFieldDefinition( + var fieldDefinition = new ObjectFieldConfiguration( field.Name.Value, field.Description?.Value, TypeReference.Create(field.Type)) @@ -91,15 +91,15 @@ private static void DeclareFields( private static void DeclareFieldArguments( IDescriptorContext context, - ObjectFieldDefinition parent, + ObjectFieldConfiguration parent, FieldDefinitionNode field, - Stack path) + Stack path) { path.Push(parent); foreach (var argument in field.Arguments) { - var argumentDefinition = new ArgumentDefinition( + var argumentDefinition = new ArgumentConfiguration( argument.Name.Value, argument.Description?.Value, TypeReference.Create(argument.Type), diff --git a/src/HotChocolate/Core/src/Types/Types/Factories/SchemaBuildingDirectiveHelper.cs b/src/HotChocolate/Core/src/Types/Types/Factories/SchemaBuildingDirectiveHelper.cs index f8442e4888d..41f6dc21a07 100644 --- a/src/HotChocolate/Core/src/Types/Types/Factories/SchemaBuildingDirectiveHelper.cs +++ b/src/HotChocolate/Core/src/Types/Types/Factories/SchemaBuildingDirectiveHelper.cs @@ -9,12 +9,12 @@ internal static class SchemaBuildingDirectiveHelper { private const string _definitionStackKey = "HotChocolate.Schema.Building.DefinitionStack"; - public static Stack GetOrCreateDefinitionStack(this IDescriptorContext context) + public static Stack GetOrCreateDefinitionStack(this IDescriptorContext context) { if (!context.ContextData.TryGetValue(_definitionStackKey, out var value) || - value is not Stack stack) + value is not Stack stack) { - stack = new Stack(); + stack = new Stack(); context.ContextData[_definitionStackKey] = stack; } diff --git a/src/HotChocolate/Core/src/Types/Types/Factories/SchemaFirstTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/Types/Factories/SchemaFirstTypeInterceptor.cs index 809df9b7880..3acb0381ab6 100644 --- a/src/HotChocolate/Core/src/Types/Types/Factories/SchemaFirstTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Factories/SchemaFirstTypeInterceptor.cs @@ -17,7 +17,7 @@ internal sealed class SchemaFirstTypeInterceptor : TypeInterceptor public override void OnAfterCompleteName( ITypeCompletionContext completionContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { if (_directives.TryGetValue(completionContext.Type.Name, out var directives) && definition is ScalarTypeDefinition scalarTypeDef) diff --git a/src/HotChocolate/Core/src/Types/Types/Factories/SdlToTypeSystemHelper.cs b/src/HotChocolate/Core/src/Types/Types/Factories/SdlToTypeSystemHelper.cs index 0e12f49594d..2274b7ee95b 100644 --- a/src/HotChocolate/Core/src/Types/Types/Factories/SdlToTypeSystemHelper.cs +++ b/src/HotChocolate/Core/src/Types/Types/Factories/SdlToTypeSystemHelper.cs @@ -12,8 +12,8 @@ public static void AddDirectives( IDescriptorContext context, TOwner owner, HotChocolate.Language.IHasDirectives ownerSyntax, - Stack path) - where TOwner : IHasDirectiveDefinition, IDefinition + Stack path) + where TOwner : IDirectiveConfigurationProvider, ITypeSystemConfiguration { foreach (var directive in ownerSyntax.Directives) { diff --git a/src/HotChocolate/Core/src/Types/Types/FieldBase.cs b/src/HotChocolate/Core/src/Types/Types/FieldBase.cs index 099c9aa0dc3..746d79f496e 100644 --- a/src/HotChocolate/Core/src/Types/Types/FieldBase.cs +++ b/src/HotChocolate/Core/src/Types/Types/FieldBase.cs @@ -12,10 +12,10 @@ public abstract class FieldBase : IField , IFieldCompletion { - private FieldDefinitionBase? _definition; + private FieldConfiguration? _definition; private FieldFlags _flags; - protected FieldBase(FieldDefinitionBase definition, int index) + protected FieldBase(FieldConfiguration definition, int index) { _definition = definition ?? throw new ArgumentNullException(nameof(definition)); Index = index; @@ -74,7 +74,7 @@ internal void CompleteField( protected virtual void OnCompleteField( ITypeCompletionContext context, ITypeSystemMember declaringMember, - FieldDefinitionBase definition) + FieldConfiguration definition) { DeclaringType = context.Type; Coordinate = declaringMember is IField field @@ -99,7 +99,7 @@ private void CompleteMetadata( protected virtual void OnCompleteMetadata( ITypeCompletionContext context, ITypeSystemMember declaringMember, - FieldDefinitionBase definition) + FieldConfiguration definition) { Directives = DirectiveCollection.CreateAndComplete( context, this, definition.GetDirectives()); @@ -121,7 +121,7 @@ private void MakeExecutable( protected virtual void OnMakeExecutable( ITypeCompletionContext context, ITypeSystemMember declaringMember, - FieldDefinitionBase definition) + FieldConfiguration definition) { } @@ -143,7 +143,7 @@ private void FinalizeField( protected virtual void OnFinalizeField( ITypeCompletionContext context, ITypeSystemMember declaringMember, - FieldDefinitionBase definition) + FieldConfiguration definition) { } diff --git a/src/HotChocolate/Core/src/Types/Types/Helpers/DescriptorHelpers.cs b/src/HotChocolate/Core/src/Types/Types/Helpers/DescriptorHelpers.cs index 11ceae09e90..624cc73dfdf 100644 --- a/src/HotChocolate/Core/src/Types/Types/Helpers/DescriptorHelpers.cs +++ b/src/HotChocolate/Core/src/Types/Types/Helpers/DescriptorHelpers.cs @@ -11,7 +11,7 @@ public static TDefinition SetMoreSpecificType( this TDefinition definition, IExtendedType type, TypeContext context) - where TDefinition : FieldDefinitionBase + where TDefinition : FieldConfiguration { if (IsTypeMoreSpecific(definition.Type, type)) { @@ -24,7 +24,7 @@ public static TDefinition SetMoreSpecificType( this TDefinition definition, ITypeNode typeNode, TypeContext context) - where TDefinition : FieldDefinitionBase + where TDefinition : FieldConfiguration { if (IsTypeMoreSpecific(definition.Type, typeNode)) { diff --git a/src/HotChocolate/Core/src/Types/Types/Helpers/DirectiveUtils.cs b/src/HotChocolate/Core/src/Types/Types/Helpers/DirectiveUtils.cs index 3a566cd9b83..dad51a7164f 100644 --- a/src/HotChocolate/Core/src/Types/Types/Helpers/DirectiveUtils.cs +++ b/src/HotChocolate/Core/src/Types/Types/Helpers/DirectiveUtils.cs @@ -8,7 +8,7 @@ namespace HotChocolate.Types.Helpers; public static class DirectiveUtils { public static void AddDirective( - this IHasDirectiveDefinition directivesContainer, + this IDirectiveConfigurationProvider directivesContainer, T directive, ITypeInspector typeInspector) where T : class @@ -22,7 +22,7 @@ public static void AddDirective( { case DirectiveNode node: directivesContainer.Directives.Add( - new DirectiveDefinition(node)); + new DirectiveConfiguration(node)); break; case string directiveName: @@ -34,7 +34,7 @@ public static void AddDirective( default: directivesContainer.Directives.Add( - new DirectiveDefinition( + new DirectiveConfiguration( directive, TypeReference.CreateDirective(typeInspector.GetType(directive.GetType())))); break; @@ -42,12 +42,12 @@ public static void AddDirective( } public static void AddDirective( - this IHasDirectiveDefinition directivesContainer, + this IDirectiveConfigurationProvider directivesContainer, string name, IEnumerable arguments) { directivesContainer.Directives.Add( - new DirectiveDefinition( + new DirectiveConfiguration( new DirectiveNode( name.EnsureGraphQLName(), arguments.ToArray()))); diff --git a/src/HotChocolate/Core/src/Types/Types/Helpers/FieldDescriptorUtilities.cs b/src/HotChocolate/Core/src/Types/Types/Helpers/FieldDescriptorUtilities.cs index eab539618de..18cfd50ac75 100644 --- a/src/HotChocolate/Core/src/Types/Types/Helpers/FieldDescriptorUtilities.cs +++ b/src/HotChocolate/Core/src/Types/Types/Helpers/FieldDescriptorUtilities.cs @@ -15,7 +15,7 @@ public static void AddExplicitFields( IDictionary fields, ISet handledMembers) where TMember : MemberInfo - where TField : FieldDefinitionBase + where TField : FieldConfiguration { foreach (var fieldDefinition in fieldDefinitions) { @@ -39,7 +39,7 @@ public static void AddImplicitFields( ISet handledMembers) where TDescriptor : IHasRuntimeType, IHasDescriptorContext where TMember : MemberInfo - where TField : FieldDefinitionBase + where TField : FieldConfiguration { AddImplicitFields( descriptor, @@ -59,7 +59,7 @@ public static void AddImplicitFields( bool includeIgnoredMembers = false) where TDescriptor : IHasDescriptorContext where TMember : MemberInfo - where TField : FieldDefinitionBase + where TField : FieldConfiguration { if (fieldBindingType != typeof(object)) { @@ -95,7 +95,7 @@ public static void AddImplicitFields( public static void DiscoverArguments( IDescriptorContext context, - ICollection arguments, + ICollection arguments, MemberInfo? member, ParameterInfo[] parameters, IReadOnlyList? parameterExpressionBuilders) diff --git a/src/HotChocolate/Core/src/Types/Types/Helpers/FieldMiddlewareCompiler.cs b/src/HotChocolate/Core/src/Types/Types/Helpers/FieldMiddlewareCompiler.cs index 0554a8dc344..fef447190ee 100644 --- a/src/HotChocolate/Core/src/Types/Types/Helpers/FieldMiddlewareCompiler.cs +++ b/src/HotChocolate/Core/src/Types/Types/Helpers/FieldMiddlewareCompiler.cs @@ -9,8 +9,8 @@ internal static class FieldMiddlewareCompiler { public static FieldDelegate? Compile( IReadOnlyList globalComponents, - IReadOnlyList fieldComponents, - IReadOnlyList resultConverters, + IReadOnlyList fieldComponents, + IReadOnlyList resultConverters, FieldResolverDelegate? fieldResolver, bool skipMiddleware) { @@ -32,7 +32,7 @@ internal static class FieldMiddlewareCompiler } public static PureFieldDelegate Compile( - IReadOnlyList resultConverters, + IReadOnlyList resultConverters, PureFieldDelegate fieldResolver, bool skipMiddleware) => skipMiddleware || resultConverters.Count == 0 @@ -41,8 +41,8 @@ public static PureFieldDelegate Compile( private static FieldDelegate CompilePipeline( IReadOnlyList components, - IReadOnlyList mappedComponents, - IReadOnlyList resultConverters, + IReadOnlyList mappedComponents, + IReadOnlyList resultConverters, FieldResolverDelegate? fieldResolver) => CompileMiddlewareComponents(components, CompileMiddlewareComponents(mappedComponents, @@ -64,7 +64,7 @@ private static FieldDelegate CompileMiddlewareComponents( } private static FieldDelegate CompileMiddlewareComponents( - IReadOnlyList components, + IReadOnlyList components, FieldDelegate first) { var next = first; @@ -78,7 +78,7 @@ private static FieldDelegate CompileMiddlewareComponents( } private static FieldDelegate CompileResultConverters( - IReadOnlyList components, + IReadOnlyList components, FieldDelegate first) { var next = first; @@ -92,7 +92,7 @@ private static FieldDelegate CompileResultConverters( } private static PureFieldDelegate CompileResultConverters( - IReadOnlyList components, + IReadOnlyList components, PureFieldDelegate first) { var next = first; diff --git a/src/HotChocolate/Core/src/Types/Types/Helpers/TypeMemHelper.cs b/src/HotChocolate/Core/src/Types/Types/Helpers/TypeMemHelper.cs index 563a016bbc4..84b14facfb9 100644 --- a/src/HotChocolate/Core/src/Types/Types/Helpers/TypeMemHelper.cs +++ b/src/HotChocolate/Core/src/Types/Types/Helpers/TypeMemHelper.cs @@ -11,9 +11,9 @@ namespace HotChocolate.Types.Helpers; /// internal static class TypeMemHelper { - private static Dictionary? _objectFieldDefinitionMap; - private static Dictionary? _interfaceFieldDefinitionMap; - private static Dictionary? _inputFieldDefinitionMap; + private static Dictionary? _objectFieldDefinitionMap; + private static Dictionary? _interfaceFieldDefinitionMap; + private static Dictionary? _inputFieldDefinitionMap; private static Dictionary? _inputFieldMap; private static Dictionary? _inputFieldMapOrdinalIgnoreCase; private static Dictionary? _directiveArgumentMap; @@ -23,31 +23,31 @@ internal static class TypeMemHelper private static HashSet? _nameSet; private static HashSet? _nameSetOrdinalIgnoreCase; - public static Dictionary RentObjectFieldDefinitionMap() + public static Dictionary RentObjectFieldDefinitionMap() => Interlocked.Exchange(ref _objectFieldDefinitionMap, null) ?? - new Dictionary(StringComparer.Ordinal); + new Dictionary(StringComparer.Ordinal); - public static void Return(Dictionary map) + public static void Return(Dictionary map) { map.Clear(); Interlocked.CompareExchange(ref _objectFieldDefinitionMap, map, null); } - public static Dictionary RentInterfaceFieldDefinitionMap() + public static Dictionary RentInterfaceFieldDefinitionMap() => Interlocked.Exchange(ref _interfaceFieldDefinitionMap, null) ?? - new Dictionary(StringComparer.Ordinal); + new Dictionary(StringComparer.Ordinal); - public static void Return(Dictionary map) + public static void Return(Dictionary map) { map.Clear(); Interlocked.CompareExchange(ref _interfaceFieldDefinitionMap, map, null); } - public static Dictionary RentInputFieldDefinitionMap() + public static Dictionary RentInputFieldDefinitionMap() => Interlocked.Exchange(ref _inputFieldDefinitionMap, null) ?? - new Dictionary(StringComparer.Ordinal); + new Dictionary(StringComparer.Ordinal); - public static void Return(Dictionary map) + public static void Return(Dictionary map) { map.Clear(); Interlocked.CompareExchange(ref _inputFieldDefinitionMap, map, null); diff --git a/src/HotChocolate/Core/src/Types/Types/Helpers/TypeNameHelper.cs b/src/HotChocolate/Core/src/Types/Types/Helpers/TypeNameHelper.cs index c774b640bbe..b541112b3f7 100644 --- a/src/HotChocolate/Core/src/Types/Types/Helpers/TypeNameHelper.cs +++ b/src/HotChocolate/Core/src/Types/Types/Helpers/TypeNameHelper.cs @@ -11,7 +11,7 @@ public static void AddNameFunction( IDescriptor descriptor, Func createName, Type dependency) - where TDefinition : DefinitionBase, ITypeDefinition + where TDefinition : TypeSystemConfiguration, ITypeDefinition { if (descriptor is null) { @@ -59,7 +59,7 @@ public static void AddNameFunction( IDescriptor descriptor, Func createName, TypeReference dependency) - where TDefinition : DefinitionBase, ITypeDefinition + where TDefinition : TypeSystemConfiguration, ITypeDefinition { if (descriptor is null) { diff --git a/src/HotChocolate/Core/src/Types/Types/ISchemaDirective.cs b/src/HotChocolate/Core/src/Types/Types/ISchemaDirective.cs index 6a1b3593a0e..1f04c202181 100644 --- a/src/HotChocolate/Core/src/Types/Types/ISchemaDirective.cs +++ b/src/HotChocolate/Core/src/Types/Types/ISchemaDirective.cs @@ -34,6 +34,6 @@ public interface ISchemaDirective void ApplyConfiguration( IDescriptorContext context, DirectiveNode directiveNode, - IDefinition definition, - Stack path); + ITypeSystemConfiguration definition, + Stack path); } diff --git a/src/HotChocolate/Core/src/Types/Types/InputField.cs b/src/HotChocolate/Core/src/Types/Types/InputField.cs index ce75518e8e0..605345d1c98 100644 --- a/src/HotChocolate/Core/src/Types/Types/InputField.cs +++ b/src/HotChocolate/Core/src/Types/Types/InputField.cs @@ -12,7 +12,7 @@ public class InputField : FieldBase, IInputField, IHasProperty { private Type _runtimeType = default!; - public InputField(InputFieldDefinition definition, int index) + public InputField(InputFieldConfiguration definition, int index) : base(definition, index) { DefaultValue = definition.DefaultValue; @@ -67,13 +67,13 @@ public InputField(InputFieldDefinition definition, int index) protected sealed override void OnCompleteField( ITypeCompletionContext context, ITypeSystemMember declaringMember, - FieldDefinitionBase definition) - => OnCompleteField(context, declaringMember, (InputFieldDefinition)definition); + FieldConfiguration definition) + => OnCompleteField(context, declaringMember, (InputFieldConfiguration)definition); protected virtual void OnCompleteField( ITypeCompletionContext context, ITypeSystemMember declaringMember, - InputFieldDefinition definition) + InputFieldConfiguration definition) { base.OnCompleteField(context, declaringMember, definition); @@ -86,13 +86,13 @@ protected virtual void OnCompleteField( protected sealed override void OnCompleteMetadata( ITypeCompletionContext context, ITypeSystemMember declaringMember, - FieldDefinitionBase definition) - => OnCompleteMetadata(context, declaringMember, (InputFieldDefinition)definition); + FieldConfiguration definition) + => OnCompleteMetadata(context, declaringMember, (InputFieldConfiguration)definition); protected virtual void OnCompleteMetadata( ITypeCompletionContext context, ITypeSystemMember declaringMember, - InputFieldDefinition definition) + InputFieldConfiguration definition) { base.OnCompleteMetadata(context, declaringMember, definition); DefaultValue = CompleteDefaultValue(context, definition, Type, Coordinate); @@ -101,25 +101,25 @@ protected virtual void OnCompleteMetadata( protected sealed override void OnMakeExecutable( ITypeCompletionContext context, ITypeSystemMember declaringMember, - FieldDefinitionBase definition) - => OnMakeExecutable(context, declaringMember, (InputFieldDefinition)definition); + FieldConfiguration definition) + => OnMakeExecutable(context, declaringMember, (InputFieldConfiguration)definition); protected virtual void OnMakeExecutable( ITypeCompletionContext context, ITypeSystemMember declaringMember, - InputFieldDefinition definition) + InputFieldConfiguration definition) => base.OnMakeExecutable(context, declaringMember, definition); protected sealed override void OnFinalizeField( ITypeCompletionContext context, ITypeSystemMember declaringMember, - FieldDefinitionBase definition) - => base.OnFinalizeField(context, declaringMember, (InputFieldDefinition)definition); + FieldConfiguration definition) + => base.OnFinalizeField(context, declaringMember, (InputFieldConfiguration)definition); protected virtual void OnFinalizeField( ITypeCompletionContext context, ITypeSystemMember declaringMember, - InputFieldDefinition definition) + InputFieldConfiguration definition) => base.OnFinalizeField(context, declaringMember, definition); diff --git a/src/HotChocolate/Core/src/Types/Types/InputObjectType.Initialization.cs b/src/HotChocolate/Core/src/Types/Types/InputObjectType.Initialization.cs index cdd3f7bc32a..63aaa35010c 100644 --- a/src/HotChocolate/Core/src/Types/Types/InputObjectType.Initialization.cs +++ b/src/HotChocolate/Core/src/Types/Types/InputObjectType.Initialization.cs @@ -22,7 +22,7 @@ public partial class InputObjectType private Func _createInstance = default!; private Action _getFieldValues = default!; - protected override InputObjectTypeDefinition CreateDefinition(ITypeDiscoveryContext context) + protected override InputObjectTypeConfiguration CreateDefinition(ITypeDiscoveryContext context) { try { @@ -45,7 +45,7 @@ protected override InputObjectTypeDefinition CreateDefinition(ITypeDiscoveryCont protected override void OnRegisterDependencies( ITypeDiscoveryContext context, - InputObjectTypeDefinition definition) + InputObjectTypeConfiguration definition) { base.OnRegisterDependencies(context, definition); context.RegisterDependencies(definition); @@ -54,7 +54,7 @@ protected override void OnRegisterDependencies( protected override void OnCompleteType( ITypeCompletionContext context, - InputObjectTypeDefinition definition) + InputObjectTypeConfiguration definition) { base.OnCompleteType(context, definition); @@ -67,7 +67,7 @@ protected override void OnCompleteType( protected override void OnCompleteMetadata( ITypeCompletionContext context, - InputObjectTypeDefinition definition) + InputObjectTypeConfiguration definition) { base.OnCompleteMetadata(context, definition); @@ -79,7 +79,7 @@ protected override void OnCompleteMetadata( protected override void OnMakeExecutable( ITypeCompletionContext context, - InputObjectTypeDefinition definition) + InputObjectTypeConfiguration definition) { base.OnMakeExecutable(context, definition); @@ -91,7 +91,7 @@ protected override void OnMakeExecutable( protected override void OnFinalizeType( ITypeCompletionContext context, - InputObjectTypeDefinition definition) + InputObjectTypeConfiguration definition) { base.OnFinalizeType(context, definition); @@ -103,16 +103,16 @@ protected override void OnFinalizeType( protected virtual FieldCollection OnCompleteFields( ITypeCompletionContext context, - InputObjectTypeDefinition definition) + InputObjectTypeConfiguration definition) { return CompleteFields(context, this, definition.Fields, CreateField); - static InputField CreateField(InputFieldDefinition fieldDef, int index) + static InputField CreateField(InputFieldConfiguration fieldDef, int index) => new(fieldDef, index); } protected virtual Func OnCompleteCreateInstance( ITypeCompletionContext context, - InputObjectTypeDefinition definition) + InputObjectTypeConfiguration definition) { Func? createInstance = null; @@ -135,7 +135,7 @@ static InputField CreateField(InputFieldDefinition fieldDef, int index) protected virtual Action OnCompleteGetFieldValues( ITypeCompletionContext context, - InputObjectTypeDefinition definition) + InputObjectTypeConfiguration definition) { Action? getFieldValues = null; @@ -186,7 +186,7 @@ file static class Extensions { [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsOneOf(this DirectiveDefinition directiveDef) + public static bool IsOneOf(this DirectiveConfiguration directiveDef) => directiveDef.Value is DirectiveNode node && node.Name.Value.EqualsOrdinal(WellKnownDirectives.OneOf); } diff --git a/src/HotChocolate/Core/src/Types/Types/InputObjectType.cs b/src/HotChocolate/Core/src/Types/Types/InputObjectType.cs index 3d5d1fc9ea8..f35c4fa3fff 100644 --- a/src/HotChocolate/Core/src/Types/Types/InputObjectType.cs +++ b/src/HotChocolate/Core/src/Types/Types/InputObjectType.cs @@ -19,7 +19,7 @@ namespace HotChocolate.Types; /// /// public partial class InputObjectType - : NamedTypeBase + : NamedTypeBase , IInputObjectType { /// @@ -54,7 +54,7 @@ public InputObjectType(Action configure) /// /// Returns the newly created input object type. /// - public static InputObjectType CreateUnsafe(InputObjectTypeDefinition definition) + public static InputObjectType CreateUnsafe(InputObjectTypeConfiguration definition) => new() { Definition = definition, }; /// diff --git a/src/HotChocolate/Core/src/Types/Types/InputObjectTypeExtension.cs b/src/HotChocolate/Core/src/Types/Types/InputObjectTypeExtension.cs index 479b9d03931..a6a4e881098 100644 --- a/src/HotChocolate/Core/src/Types/Types/InputObjectTypeExtension.cs +++ b/src/HotChocolate/Core/src/Types/Types/InputObjectTypeExtension.cs @@ -14,7 +14,7 @@ namespace HotChocolate.Types; /// this might be used by a GraphQL service which is itself an extension of another /// GraphQL service. /// -public class InputObjectTypeExtension : NamedTypeExtensionBase +public class InputObjectTypeExtension : NamedTypeExtensionBase { private Action? _configure; @@ -50,13 +50,13 @@ public InputObjectTypeExtension(Action configure) /// /// Returns the newly created input object type. /// - public static InputObjectTypeExtension CreateUnsafe(InputObjectTypeDefinition definition) + public static InputObjectTypeExtension CreateUnsafe(InputObjectTypeConfiguration definition) => new() { Definition = definition, }; /// public override TypeKind Kind => TypeKind.InputObject; - protected override InputObjectTypeDefinition CreateDefinition(ITypeDiscoveryContext context) + protected override InputObjectTypeConfiguration CreateDefinition(ITypeDiscoveryContext context) { try { @@ -80,7 +80,7 @@ protected virtual void Configure(IInputObjectTypeDescriptor descriptor) { } protected override void OnRegisterDependencies( ITypeDiscoveryContext context, - InputObjectTypeDefinition definition) + InputObjectTypeConfiguration definition) { base.OnRegisterDependencies(context, definition); context.RegisterDependencies(definition); diff --git a/src/HotChocolate/Core/src/Types/Types/InputObjectType~1.cs b/src/HotChocolate/Core/src/Types/Types/InputObjectType~1.cs index 6fa1a874307..183c1dff15e 100644 --- a/src/HotChocolate/Core/src/Types/Types/InputObjectType~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/InputObjectType~1.cs @@ -21,7 +21,7 @@ public InputObjectType() _configure = Configure; } - protected override InputObjectTypeDefinition CreateDefinition( + protected override InputObjectTypeConfiguration CreateDefinition( ITypeDiscoveryContext context) { var descriptor = InputObjectTypeDescriptor.New(context.DescriptorContext); diff --git a/src/HotChocolate/Core/src/Types/Types/InputParser.cs b/src/HotChocolate/Core/src/Types/Types/InputParser.cs index fa873795164..396e1291ead 100644 --- a/src/HotChocolate/Core/src/Types/Types/InputParser.cs +++ b/src/HotChocolate/Core/src/Types/Types/InputParser.cs @@ -96,7 +96,7 @@ public InputParser(ITypeConverter converter, InputParserOptions options) case TypeKind.NonNull: return ParseLiteralInternal( value, - ((NonNullType)type).Type, + ((NonNullType)type).NullableType, path, stack, defaults, @@ -478,7 +478,7 @@ private object ParseDirective( if (type.Kind == TypeKind.NonNull) { - type = ((NonNullType)type).Type; + type = ((NonNullType)type).NullableType; } switch (type.Kind) diff --git a/src/HotChocolate/Core/src/Types/Types/Interceptors/FlagEnumTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/Types/Interceptors/FlagEnumTypeInterceptor.cs index cef324bee2b..9079184ab63 100644 --- a/src/HotChocolate/Core/src/Types/Types/Interceptors/FlagEnumTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Interceptors/FlagEnumTypeInterceptor.cs @@ -33,7 +33,7 @@ internal override void InitializeContext( public override void OnBeforeRegisterDependencies( ITypeDiscoveryContext discoveryContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { switch (definition) { @@ -42,24 +42,24 @@ public override void OnBeforeRegisterDependencies( break; - case InterfaceTypeDefinition i: + case InterfaceTypeConfiguration i: ProcessOutputFields(i.Fields); break; - case InputObjectTypeDefinition i: + case InputObjectTypeConfiguration i: ProcessInputFields(i.Fields); break; - case DirectiveTypeDefinition i: + case DirectiveTypeConfiguration i: ProcessArguments(i.Arguments); break; } } - private void ProcessOutputFields(IEnumerable fields) + private void ProcessOutputFields(IEnumerable fields) { foreach (var field in fields) { @@ -73,7 +73,7 @@ private void ProcessOutputFields(IEnumerable fields) } } - private void ProcessArguments(IEnumerable argumentDefinitions) + private void ProcessArguments(IEnumerable argumentDefinitions) { foreach (var arg in argumentDefinitions) { @@ -86,7 +86,7 @@ private void ProcessArguments(IEnumerable argumentDefinition } } - private void ProcessInputFields(IEnumerable fields) + private void ProcessInputFields(IEnumerable fields) { foreach (var field in fields) { @@ -125,7 +125,7 @@ private string CreateObjectType(Type type) var typeReference = TypeReference.Parse("Boolean!"); PureFieldDelegate resolver = c => c.Parent().HasFlag((Enum)value); var fieldDefinition = - new ObjectFieldDefinition(valueName, description, typeReference, null, resolver); + new ObjectFieldConfiguration(valueName, description, typeReference, null, resolver); objectTypeDefinition.Fields.Add(fieldDefinition); } @@ -144,7 +144,7 @@ private RegisteredInputType CreateInputObjectType(Type type) var typeName = $"{_namingConventions.GetTypeName(type)}{_flagNameAddition}Input"; var desc = _namingConventions.GetTypeDescription(type, TypeKind.Enum); - var objectTypeDefinition = new InputObjectTypeDefinition(typeName, desc) + var objectTypeDefinition = new InputObjectTypeConfiguration(typeName, desc) { RuntimeType = typeof(Dictionary), }; @@ -155,7 +155,7 @@ private RegisteredInputType CreateInputObjectType(Type type) var valueName = GetFlagFieldName(type, value); var description = _namingConventions.GetEnumValueDescription(value); var typeReference = TypeReference.Parse("Boolean"); - var fieldDefinition = new InputFieldDefinition(valueName, description, typeReference); + var fieldDefinition = new InputFieldConfiguration(valueName, description, typeReference); objectTypeDefinition.Fields.Add(fieldDefinition); metadata[valueName] = value; } diff --git a/src/HotChocolate/Core/src/Types/Types/Interceptors/InterfaceCompletionTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/Types/Interceptors/InterfaceCompletionTypeInterceptor.cs index 278e1dd6931..80c76124ca9 100644 --- a/src/HotChocolate/Core/src/Types/Types/Interceptors/InterfaceCompletionTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Interceptors/InterfaceCompletionTypeInterceptor.cs @@ -17,11 +17,11 @@ internal sealed class InterfaceCompletionTypeInterceptor : TypeInterceptor public override void OnAfterInitialize( ITypeDiscoveryContext discoveryContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { // we need to preserve the initialization context of all // interface types and object types. - if (definition is IComplexOutputTypeDefinition typeDefinition) + if (definition is IComplexOutputTypeConfiguration typeDefinition) { _typeInfos.Add(discoveryContext.Type, new(discoveryContext, typeDefinition)); } @@ -34,7 +34,7 @@ public override void OnTypesInitialized() foreach (var interfaceTypeInfo in _typeInfos.Values .Where(t => t.Definition.RuntimeType is { } rt && rt != typeof(object) && - t.Definition is InterfaceTypeDefinition)) + t.Definition is InterfaceTypeConfiguration)) { if (!_allInterfaceRuntimeTypes.ContainsKey(interfaceTypeInfo.Definition.RuntimeType)) { @@ -97,9 +97,9 @@ private Type GetRuntimeType(TypeInfo typeInfo) public override void OnBeforeCompleteType( ITypeCompletionContext completionContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { - if (definition is InterfaceTypeDefinition { Interfaces: { Count: > 0, }, } typeDef) + if (definition is InterfaceTypeConfiguration { Interfaces: { Count: > 0, }, } typeDef) { _completed.Clear(); _completedFields.Clear(); @@ -150,7 +150,7 @@ public override void OnBeforeCompleteType( } } - private void CompleteInterfacesAndFields(IComplexOutputTypeDefinition definition) + private void CompleteInterfacesAndFields(IComplexOutputTypeConfiguration definition) { while (_backlog.Count > 0) { @@ -158,9 +158,9 @@ private void CompleteInterfacesAndFields(IComplexOutputTypeDefinition definition var typeInfo = _typeInfos[current]; definition.Interfaces.Add(TypeReference.Create(current)); - if (definition is InterfaceTypeDefinition interfaceDef) + if (definition is InterfaceTypeConfiguration interfaceDef) { - foreach (var field in ((InterfaceTypeDefinition)typeInfo.Definition).Fields) + foreach (var field in ((InterfaceTypeConfiguration)typeInfo.Definition).Fields) { if (_completedFields.Add(field.Name)) { @@ -202,7 +202,7 @@ private readonly struct TypeInfo { public TypeInfo( ITypeDiscoveryContext context, - IComplexOutputTypeDefinition definition) + IComplexOutputTypeConfiguration definition) { Context = context; Definition = definition; @@ -210,7 +210,7 @@ public TypeInfo( public ITypeDiscoveryContext Context { get; } - public IComplexOutputTypeDefinition Definition { get; } + public IComplexOutputTypeConfiguration Definition { get; } public override string ToString() => Definition.Name; } diff --git a/src/HotChocolate/Core/src/Types/Types/Interceptors/MiddlewareValidationTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/Types/Interceptors/MiddlewareValidationTypeInterceptor.cs index 72ed9463f0a..98771b0fa39 100644 --- a/src/HotChocolate/Core/src/Types/Types/Interceptors/MiddlewareValidationTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Interceptors/MiddlewareValidationTypeInterceptor.cs @@ -19,7 +19,7 @@ internal sealed class MiddlewareValidationTypeInterceptor : TypeInterceptor public override void OnAfterCompleteType( ITypeCompletionContext completionContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { if (completionContext.DescriptorContext.Options.ValidatePipelineOrder && definition is ObjectTypeDefinition objectTypeDef) @@ -40,7 +40,7 @@ public override void OnAfterCompleteType( private void ValidatePipeline( ITypeSystemObject type, SchemaCoordinate fieldCoordinate, - IList middlewareDefinitions) + IList middlewareDefinitions) { _names.Clear(); @@ -138,7 +138,7 @@ private void ValidatePipeline( } private static string PrintPipeline( - IList middlewareDefinitions) + IList middlewareDefinitions) { var sb = new StringBuilder(); var next = false; diff --git a/src/HotChocolate/Core/src/Types/Types/Interceptors/ResolverTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/Types/Interceptors/ResolverTypeInterceptor.cs index 38d63ec2d25..5edbfa74768 100644 --- a/src/HotChocolate/Core/src/Types/Types/Interceptors/ResolverTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Interceptors/ResolverTypeInterceptor.cs @@ -53,7 +53,7 @@ internal override void InitializeContext( public override void OnAfterInitialize( ITypeDiscoveryContext discoveryContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { if (discoveryContext is { IsIntrospectionType: false, Type: IHasName namedType, } && definition is ITypeDefinition { NeedsNameCompletion: false, } typeDef) @@ -86,7 +86,7 @@ public override IEnumerable RegisterMoreTypes( TypeDependencyHelper.CollectDependencies(otd, list); break; - case InterfaceTypeDefinition itd: + case InterfaceTypeConfiguration itd: TypeDependencyHelper.CollectDependencies(itd, list); break; } @@ -97,7 +97,7 @@ public override IEnumerable RegisterMoreTypes( public override void OnAfterCompleteName( ITypeCompletionContext completionContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { if (completionContext is { IsIntrospectionType: false, Type: IHasName namedType, } && definition is ITypeDefinition typeDef) @@ -216,11 +216,11 @@ private void ApplySourceMembers(CompletionContext context) ApplyObjectSourceMembers(context, objectTypeDef); break; - case InputObjectTypeDefinition inputTypeDef: + case InputObjectTypeConfiguration inputTypeDef: ApplyInputSourceMembers(context, inputTypeDef); break; - case EnumTypeDefinition enumTypeDef: + case EnumTypeConfiguration enumTypeDef: ApplyEnumSourceMembers(context, enumTypeDef); break; } @@ -285,7 +285,7 @@ private void ApplyObjectSourceMembers( private void ApplyInputSourceMembers( CompletionContext context, - InputObjectTypeDefinition inputTypeDef) + InputObjectTypeConfiguration inputTypeDef) { var initialized = false; @@ -318,7 +318,7 @@ private void ApplyInputSourceMembers( private void ApplyEnumSourceMembers( CompletionContext context, - EnumTypeDefinition enumTypeDef) + EnumTypeConfiguration enumTypeDef) { var initialized = false; @@ -376,7 +376,7 @@ private void CollectSourceMembers(CompletionContext context, Type runtimeType) private void TrySetRuntimeType( CompletionContext context, - ObjectFieldDefinition field, + ObjectFieldConfiguration field, FieldResolverConfig config) { if (config.ResultType != typeof(object) && @@ -394,7 +394,7 @@ field.Type is not null && } private void TryBindArgumentRuntimeType( - ObjectFieldDefinition field, + ObjectFieldConfiguration field, MemberInfo member) { if (member is MethodInfo method) diff --git a/src/HotChocolate/Core/src/Types/Types/Interceptors/TypeValidationTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/Types/Interceptors/TypeValidationTypeInterceptor.cs index 4ad5d152f47..91467a322ba 100644 --- a/src/HotChocolate/Core/src/Types/Types/Interceptors/TypeValidationTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Interceptors/TypeValidationTypeInterceptor.cs @@ -10,7 +10,7 @@ internal sealed class TypeValidationTypeInterceptor : TypeInterceptor { public override void OnBeforeRegisterDependencies( ITypeDiscoveryContext discoveryContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { if (discoveryContext.IsIntrospectionType) { @@ -23,11 +23,11 @@ public override void OnBeforeRegisterDependencies( ValidateObjectType(discoveryContext, od); return; - case InputObjectTypeDefinition ind: + case InputObjectTypeConfiguration ind: ValidateInputObjectType(discoveryContext, ind); return; - case InterfaceTypeDefinition id: + case InterfaceTypeConfiguration id: ValidateInterfaceType(discoveryContext, id); return; @@ -35,7 +35,7 @@ public override void OnBeforeRegisterDependencies( ValidateUnionType(discoveryContext, ud); return; - case DirectiveTypeDefinition ud: + case DirectiveTypeConfiguration ud: ValidateDirectiveType(discoveryContext, ud); return; } @@ -43,7 +43,7 @@ public override void OnBeforeRegisterDependencies( private void ValidateInputObjectType( ITypeDiscoveryContext context, - InputObjectTypeDefinition? definition) + InputObjectTypeConfiguration? definition) { if (definition is { RuntimeType: { } runtimeType, } && IsTypeSystemType(definition.RuntimeType)) @@ -57,7 +57,7 @@ private void ValidateInputObjectType( private void ValidateDirectiveType( ITypeDiscoveryContext context, - DirectiveTypeDefinition? definition) + DirectiveTypeConfiguration? definition) { if (definition is { RuntimeType: { } runtimeType, } && IsTypeSystemType(definition.RuntimeType)) @@ -98,7 +98,7 @@ private void ValidateObjectType( private void ValidateInterfaceType( ITypeDiscoveryContext context, - InterfaceTypeDefinition? definition) + InterfaceTypeConfiguration? definition) { if (definition is { RuntimeType: { } runtimeType, } && IsTypeSystemType(definition.RuntimeType)) diff --git a/src/HotChocolate/Core/src/Types/Types/InterfaceField.cs b/src/HotChocolate/Core/src/Types/Types/InterfaceField.cs index aec6fee3220..d464ffef412 100644 --- a/src/HotChocolate/Core/src/Types/Types/InterfaceField.cs +++ b/src/HotChocolate/Core/src/Types/Types/InterfaceField.cs @@ -2,7 +2,7 @@ namespace HotChocolate.Types; -public sealed class InterfaceField(InterfaceFieldDefinition definition, int index) +public sealed class InterfaceField(InterfaceFieldConfiguration definition, int index) : OutputFieldBase(definition, index) { /// diff --git a/src/HotChocolate/Core/src/Types/Types/InterfaceType.Initialization.cs b/src/HotChocolate/Core/src/Types/Types/InterfaceType.Initialization.cs index 7a6fa960f11..0718618744e 100644 --- a/src/HotChocolate/Core/src/Types/Types/InterfaceType.Initialization.cs +++ b/src/HotChocolate/Core/src/Types/Types/InterfaceType.Initialization.cs @@ -17,7 +17,7 @@ public partial class InterfaceType private ResolveAbstractType? _resolveAbstractType; private ISchema _schema = default!; - protected override InterfaceTypeDefinition CreateDefinition( + protected override InterfaceTypeConfiguration CreateDefinition( ITypeDiscoveryContext context) { try @@ -41,7 +41,7 @@ protected override InterfaceTypeDefinition CreateDefinition( protected override void OnRegisterDependencies( ITypeDiscoveryContext context, - InterfaceTypeDefinition definition) + InterfaceTypeConfiguration definition) { base.OnRegisterDependencies(context, definition); context.RegisterDependencies(definition); @@ -50,7 +50,7 @@ protected override void OnRegisterDependencies( protected override void OnCompleteType( ITypeCompletionContext context, - InterfaceTypeDefinition definition) + InterfaceTypeConfiguration definition) { base.OnCompleteType(context, definition); @@ -63,7 +63,7 @@ protected override void OnCompleteType( protected override void OnCompleteMetadata( ITypeCompletionContext context, - InterfaceTypeDefinition definition) + InterfaceTypeConfiguration definition) { base.OnCompleteMetadata(context, definition); @@ -75,7 +75,7 @@ protected override void OnCompleteMetadata( protected override void OnMakeExecutable( ITypeCompletionContext context, - InterfaceTypeDefinition definition) + InterfaceTypeConfiguration definition) { base.OnMakeExecutable(context, definition); @@ -87,7 +87,7 @@ protected override void OnMakeExecutable( protected override void OnFinalizeType( ITypeCompletionContext context, - InterfaceTypeDefinition definition) + InterfaceTypeConfiguration definition) { base.OnFinalizeType(context, definition); @@ -99,10 +99,10 @@ protected override void OnFinalizeType( protected virtual FieldCollection OnCompleteFields( ITypeCompletionContext context, - InterfaceTypeDefinition definition) + InterfaceTypeConfiguration definition) { return CompleteFields(context, this, definition.Fields, CreateField); - static InterfaceField CreateField(InterfaceFieldDefinition fieldDef, int index) + static InterfaceField CreateField(InterfaceFieldConfiguration fieldDef, int index) => new(fieldDef, index); } diff --git a/src/HotChocolate/Core/src/Types/Types/InterfaceType.cs b/src/HotChocolate/Core/src/Types/Types/InterfaceType.cs index a99550b1cf2..08e82611c16 100644 --- a/src/HotChocolate/Core/src/Types/Types/InterfaceType.cs +++ b/src/HotChocolate/Core/src/Types/Types/InterfaceType.cs @@ -45,7 +45,7 @@ namespace HotChocolate.Types; /// /// public partial class InterfaceType - : NamedTypeBase + : NamedTypeBase , IInterfaceType { /// @@ -80,7 +80,7 @@ public InterfaceType(Action configure) /// /// Returns the newly created interface type. /// - public static InterfaceType CreateUnsafe(InterfaceTypeDefinition definition) + public static InterfaceType CreateUnsafe(InterfaceTypeConfiguration definition) => new() { Definition = definition, }; /// diff --git a/src/HotChocolate/Core/src/Types/Types/InterfaceTypeExtension.cs b/src/HotChocolate/Core/src/Types/Types/InterfaceTypeExtension.cs index bb939f8fd90..acab6b2136b 100644 --- a/src/HotChocolate/Core/src/Types/Types/InterfaceTypeExtension.cs +++ b/src/HotChocolate/Core/src/Types/Types/InterfaceTypeExtension.cs @@ -15,7 +15,7 @@ namespace HotChocolate.Types; /// For example, this might be used to represent common local data on many types, /// or by a GraphQL service which is itself an extension of another GraphQL service. /// -public class InterfaceTypeExtension : NamedTypeExtensionBase +public class InterfaceTypeExtension : NamedTypeExtensionBase { private Action? _configure; @@ -51,13 +51,13 @@ public InterfaceTypeExtension(Action configure) /// /// Returns the newly created interface type extension. /// - public static InterfaceTypeExtension CreateUnsafe(InterfaceTypeDefinition definition) + public static InterfaceTypeExtension CreateUnsafe(InterfaceTypeConfiguration definition) => new() { Definition = definition, }; /// public override TypeKind Kind => TypeKind.Interface; - protected override InterfaceTypeDefinition CreateDefinition(ITypeDiscoveryContext context) + protected override InterfaceTypeConfiguration CreateDefinition(ITypeDiscoveryContext context) { try { @@ -80,7 +80,7 @@ protected virtual void Configure(IInterfaceTypeDescriptor descriptor) { } protected override void OnRegisterDependencies( ITypeDiscoveryContext context, - InterfaceTypeDefinition definition) + InterfaceTypeConfiguration definition) { base.OnRegisterDependencies(context, definition); context.RegisterDependencies(definition); diff --git a/src/HotChocolate/Core/src/Types/Types/InterfaceType~1.cs b/src/HotChocolate/Core/src/Types/Types/InterfaceType~1.cs index 0d8bc1d4869..2e711ece486 100644 --- a/src/HotChocolate/Core/src/Types/Types/InterfaceType~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/InterfaceType~1.cs @@ -17,7 +17,7 @@ public InterfaceType(Action> configure) => public InterfaceType() => _configure = Configure; - protected override InterfaceTypeDefinition CreateDefinition(ITypeDiscoveryContext context) + protected override InterfaceTypeConfiguration CreateDefinition(ITypeDiscoveryContext context) { var descriptor = InterfaceTypeDescriptor.New(context.DescriptorContext); diff --git a/src/HotChocolate/Core/src/Types/Types/Introspection/IntrospectionFields.cs b/src/HotChocolate/Core/src/Types/Types/Introspection/IntrospectionFields.cs index d300b8aaf51..1e416f03084 100644 --- a/src/HotChocolate/Core/src/Types/Types/Introspection/IntrospectionFields.cs +++ b/src/HotChocolate/Core/src/Types/Types/Introspection/IntrospectionFields.cs @@ -27,7 +27,7 @@ public static class IntrospectionFields private static readonly PureFieldDelegate _typeNameResolver = ctx => ctx.ObjectType.Name; - internal static ObjectFieldDefinition CreateSchemaField(IDescriptorContext context) + internal static ObjectFieldConfiguration CreateSchemaField(IDescriptorContext context) { var descriptor = ObjectFieldDescriptor.New(context, Schema); @@ -43,7 +43,7 @@ static ISchema Resolve(IResolverContext ctx) return CreateDefinition(descriptor); } - internal static ObjectFieldDefinition CreateTypeField(IDescriptorContext context) + internal static ObjectFieldConfiguration CreateTypeField(IDescriptorContext context) { var descriptor = ObjectFieldDescriptor.New(context, Type); @@ -64,7 +64,7 @@ internal static ObjectFieldDefinition CreateTypeField(IDescriptorContext context return CreateDefinition(descriptor); } - internal static ObjectFieldDefinition CreateTypeNameField(IDescriptorContext context) + internal static ObjectFieldConfiguration CreateTypeNameField(IDescriptorContext context) { var descriptor = ObjectFieldDescriptor.New(context, TypeName); @@ -79,7 +79,7 @@ internal static ObjectFieldDefinition CreateTypeNameField(IDescriptorContext con return CreateDefinition(descriptor); } - private static ObjectFieldDefinition CreateDefinition(ObjectFieldDescriptor descriptor) + private static ObjectFieldConfiguration CreateDefinition(ObjectFieldDescriptor descriptor) { var definition = descriptor.CreateDefinition(); definition.IsIntrospectionField = true; diff --git a/src/HotChocolate/Core/src/Types/Types/Introspection/IntrospectionTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/Types/Introspection/IntrospectionTypeInterceptor.cs index 581bef7ca49..8c3637eccf3 100644 --- a/src/HotChocolate/Core/src/Types/Types/Introspection/IntrospectionTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Introspection/IntrospectionTypeInterceptor.cs @@ -28,7 +28,7 @@ internal override void InitializeContext( public override void OnAfterCompleteName( ITypeCompletionContext completionContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { if(completionContext.Type is ObjectType && definition is ObjectTypeDefinition typeDef) { diff --git a/src/HotChocolate/Core/src/Types/Types/Introspection/__DirectiveLocation.cs b/src/HotChocolate/Core/src/Types/Types/Introspection/__DirectiveLocation.cs index c2d148f9c91..59027c11d09 100644 --- a/src/HotChocolate/Core/src/Types/Types/Introspection/__DirectiveLocation.cs +++ b/src/HotChocolate/Core/src/Types/Types/Introspection/__DirectiveLocation.cs @@ -11,7 +11,7 @@ namespace HotChocolate.Types.Introspection; // ReSharper disable once InconsistentNaming internal sealed class __DirectiveLocation : EnumType { - protected override EnumTypeDefinition CreateDefinition(ITypeDiscoveryContext context) + protected override EnumTypeConfiguration CreateDefinition(ITypeDiscoveryContext context) => new( Names.__DirectiveLocation, DirectiveLocation_Description, @@ -19,79 +19,79 @@ protected override EnumTypeDefinition CreateDefinition(ITypeDiscoveryContext con { Values = { - new EnumValueDefinition( + new EnumValueConfiguration( Lang.Query.Value, DirectiveLocation_Query, DirectiveLocation.Query), - new EnumValueDefinition( + new EnumValueConfiguration( Lang.Mutation.Value, DirectiveLocation_Mutation, DirectiveLocation.Mutation), - new EnumValueDefinition( + new EnumValueConfiguration( Lang.Subscription.Value, DirectiveLocation_Subscription, DirectiveLocation.Subscription), - new EnumValueDefinition( + new EnumValueConfiguration( Lang.Field.Value, DirectiveLocation_Field, DirectiveLocation.Field), - new EnumValueDefinition( + new EnumValueConfiguration( Lang.FragmentDefinition.Value, DirectiveLocation_FragmentDefinition, DirectiveLocation.FragmentDefinition), - new EnumValueDefinition( + new EnumValueConfiguration( Lang.FragmentSpread.Value, DirectiveLocation_FragmentSpread, DirectiveLocation.FragmentSpread), - new EnumValueDefinition( + new EnumValueConfiguration( Lang.InlineFragment.Value, DirectiveLocation_InlineFragment, DirectiveLocation.InlineFragment), - new EnumValueDefinition( + new EnumValueConfiguration( Lang.VariableDefinition.Value, DirectiveLocation_VariableDefinition, DirectiveLocation.VariableDefinition), - new EnumValueDefinition( + new EnumValueConfiguration( Lang.Schema.Value, DirectiveLocation_Schema, DirectiveLocation.Schema), - new EnumValueDefinition( + new EnumValueConfiguration( Lang.Scalar.Value, DirectiveLocation_Scalar, DirectiveLocation.Scalar), - new EnumValueDefinition( + new EnumValueConfiguration( Lang.Object.Value, DirectiveLocation_Object, DirectiveLocation.Object), - new EnumValueDefinition( + new EnumValueConfiguration( Lang.FieldDefinition.Value, DirectiveLocation_FieldDefinition, DirectiveLocation.FieldDefinition), - new EnumValueDefinition( + new EnumValueConfiguration( Lang.ArgumentDefinition.Value, DirectiveLocation_ArgumentDefinition, DirectiveLocation.ArgumentDefinition), - new EnumValueDefinition( + new EnumValueConfiguration( Lang.Interface.Value, DirectiveLocation_Interface, DirectiveLocation.Interface), - new EnumValueDefinition( + new EnumValueConfiguration( Lang.Union.Value, DirectiveLocation_Union, DirectiveLocation.Union), - new EnumValueDefinition( + new EnumValueConfiguration( Lang.Enum.Value, DirectiveLocation_Enum, DirectiveLocation.Enum), - new EnumValueDefinition( + new EnumValueConfiguration( Lang.EnumValue.Value, DirectiveLocation_EnumValue, DirectiveLocation.EnumValue), - new EnumValueDefinition( + new EnumValueConfiguration( Lang.InputObject.Value, DirectiveLocation_InputObject, DirectiveLocation.InputObject), - new EnumValueDefinition( + new EnumValueConfiguration( Lang.InputFieldDefinition.Value, DirectiveLocation_InputFieldDefinition, DirectiveLocation.InputFieldDefinition), diff --git a/src/HotChocolate/Core/src/Types/Types/Introspection/__TypeKind.cs b/src/HotChocolate/Core/src/Types/Types/Introspection/__TypeKind.cs index bdea43d12fb..6210c18da7c 100644 --- a/src/HotChocolate/Core/src/Types/Types/Introspection/__TypeKind.cs +++ b/src/HotChocolate/Core/src/Types/Types/Introspection/__TypeKind.cs @@ -11,7 +11,7 @@ namespace HotChocolate.Types.Introspection; // ReSharper disable once InconsistentNaming internal sealed class __TypeKind : EnumType { - protected override EnumTypeDefinition CreateDefinition(ITypeDiscoveryContext context) + protected override EnumTypeConfiguration CreateDefinition(ITypeDiscoveryContext context) => new(Names.__TypeKind, TypeKind_Description, typeof(TypeKind)) { Values = diff --git a/src/HotChocolate/Core/src/Types/Types/ListType.cs b/src/HotChocolate/Core/src/Types/Types/ListType.cs deleted file mode 100644 index 57e8c24692b..00000000000 --- a/src/HotChocolate/Core/src/Types/Types/ListType.cs +++ /dev/null @@ -1,14 +0,0 @@ -#nullable enable - -namespace HotChocolate.Types; - -public class ListType : NonNamedType -{ - public ListType(IType elementType) : base(elementType) - { - } - - public override TypeKind Kind => TypeKind.List; - - public IType ElementType => InnerType; -} diff --git a/src/HotChocolate/Core/src/Types/Types/ListType~1.cs b/src/HotChocolate/Core/src/Types/Types/ListType~1.cs index 53c72ff5610..19465310b7d 100644 --- a/src/HotChocolate/Core/src/Types/Types/ListType~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/ListType~1.cs @@ -1,6 +1,14 @@ namespace HotChocolate.Types; -// this is just a marker type for the fluent code-first api. +/// +/// Represents a GraphQL list type. +/// +/// +/// This is just a marker type for the fluent code-first api. +/// +/// +/// The inner type. +/// public sealed class ListType : FluentWrapperType where T : IType { private ListType() { } diff --git a/src/HotChocolate/Core/src/Types/Types/NamedTypeBase.cs b/src/HotChocolate/Core/src/Types/Types/NamedTypeBase.cs index ddce4b0e94f..a3b1832c161 100644 --- a/src/HotChocolate/Core/src/Types/Types/NamedTypeBase.cs +++ b/src/HotChocolate/Core/src/Types/Types/NamedTypeBase.cs @@ -18,7 +18,7 @@ public abstract class NamedTypeBase , IHasRuntimeType , IHasTypeIdentity , IHasTypeDefinition - where TDefinition : DefinitionBase, IHasDirectiveDefinition, ITypeDefinition + where TDefinition : TypeSystemConfiguration, IDirectiveConfigurationProvider, ITypeDefinition { private IDirectiveCollection? _directives; private Type? _runtimeType; diff --git a/src/HotChocolate/Core/src/Types/Types/NamedTypeExtensionBase.cs b/src/HotChocolate/Core/src/Types/Types/NamedTypeExtensionBase.cs index 070fd6df71d..f34afcb99d2 100644 --- a/src/HotChocolate/Core/src/Types/Types/NamedTypeExtensionBase.cs +++ b/src/HotChocolate/Core/src/Types/Types/NamedTypeExtensionBase.cs @@ -13,7 +13,7 @@ namespace HotChocolate.Types; public abstract class NamedTypeExtensionBase : TypeSystemObjectBase , INamedTypeExtensionMerger - where TDefinition : DefinitionBase, ITypeDefinition + where TDefinition : TypeSystemConfiguration, ITypeDefinition { /// public abstract TypeKind Kind { get; } @@ -31,7 +31,7 @@ void INamedTypeExtensionMerger.Merge( protected override void OnAfterCompleteName( ITypeCompletionContext context, - DefinitionBase definition) + TypeSystemConfiguration definition) { ExtendsType = Definition?.ExtendsType; base.OnAfterCompleteName(context, definition); diff --git a/src/HotChocolate/Core/src/Types/Types/NonNamedType.cs b/src/HotChocolate/Core/src/Types/Types/NonNamedType.cs deleted file mode 100644 index e553267c578..00000000000 --- a/src/HotChocolate/Core/src/Types/Types/NonNamedType.cs +++ /dev/null @@ -1,38 +0,0 @@ -#nullable enable - -namespace HotChocolate.Types; - -public abstract class NonNamedType - : IOutputType - , IInputType -{ - private Type? _innerClrType; - private Type? _clrType; - - protected NonNamedType(IType innerType) - { - InnerType = innerType ?? throw new ArgumentNullException(nameof(innerType)); - } - - public abstract TypeKind Kind { get; } - - protected IType InnerType { get; } - - protected Type InnerClrType - { - get - { - return _innerClrType ??= InnerType.ToRuntimeType(); - } - } - public Type RuntimeType - { - get - { - return _clrType ??= this.ToRuntimeType(); - } - } - - public bool Equals(IType? other) - => ReferenceEquals(this, other); -} diff --git a/src/HotChocolate/Core/src/Types/Types/NonNullType.cs b/src/HotChocolate/Core/src/Types/Types/NonNullType.cs deleted file mode 100644 index 6c54a5ff951..00000000000 --- a/src/HotChocolate/Core/src/Types/Types/NonNullType.cs +++ /dev/null @@ -1,22 +0,0 @@ -using HotChocolate.Properties; - -#nullable enable - -namespace HotChocolate.Types; - -public class NonNullType : NonNamedType -{ - public NonNullType(IType type) : base(type) - { - if (type.Kind == TypeKind.NonNull) - { - throw new ArgumentException( - TypeResources.NonNullType_TypeIsNunNullType, - nameof(type)); - } - } - - public override TypeKind Kind => TypeKind.NonNull; - - public IType Type => InnerType; -} diff --git a/src/HotChocolate/Core/src/Types/Types/NonNullType~1.cs b/src/HotChocolate/Core/src/Types/Types/NonNullType~1.cs index e4f54093529..d9f8c3a962d 100644 --- a/src/HotChocolate/Core/src/Types/Types/NonNullType~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/NonNullType~1.cs @@ -1,9 +1,15 @@ namespace HotChocolate.Types; -// this is just a marker type for the fluent code-first api. -public sealed class NonNullType - : FluentWrapperType - where T : IType +/// +/// Represents a non-null type. +/// +/// +/// this is just a marker type for the fluent code-first api. +/// +/// +/// The inner type. +/// +public sealed class NonNullType : FluentWrapperType where T : IType { private NonNullType() { } } diff --git a/src/HotChocolate/Core/src/Types/Types/ObjectField.cs b/src/HotChocolate/Core/src/Types/Types/ObjectField.cs index b8081004ffc..bc1abee9bdc 100644 --- a/src/HotChocolate/Core/src/Types/Types/ObjectField.cs +++ b/src/HotChocolate/Core/src/Types/Types/ObjectField.cs @@ -20,7 +20,7 @@ public sealed class ObjectField : OutputFieldBase, IObjectField { private static readonly FieldDelegate _empty = _ => throw new InvalidOperationException(); - internal ObjectField(ObjectFieldDefinition definition, int index) + internal ObjectField(ObjectFieldConfiguration definition, int index) : base(definition, index) { Member = definition.Member; @@ -113,15 +113,15 @@ private set protected override void OnMakeExecutable( ITypeCompletionContext context, ITypeSystemMember declaringMember, - OutputFieldDefinitionBase definition) + OutputFieldConfiguration definition) { base.OnMakeExecutable(context, declaringMember, definition); - CompleteResolver(context, (ObjectFieldDefinition)definition); + CompleteResolver(context, (ObjectFieldConfiguration)definition); } private void CompleteResolver( ITypeCompletionContext context, - ObjectFieldDefinition definition) + ObjectFieldConfiguration definition) { var isIntrospectionField = IsIntrospectionField || DeclaringType.IsIntrospectionType(); var fieldMiddlewareDefinitions = definition.GetMiddlewareDefinitions(); @@ -141,7 +141,7 @@ private void CompleteResolver( if (Directives.Count > 0) { - List? middlewareDefinitions = null; + List? middlewareDefinitions = null; for (var i = Directives.Count - 1; i >= 0; i--) { @@ -151,7 +151,7 @@ private void CompleteResolver( { (middlewareDefinitions ??= fieldMiddlewareDefinitions.ToList()).Insert( 0, - new FieldMiddlewareDefinition(next => m(next, directive))); + new FieldMiddlewareConfiguration(next => m(next, directive))); } } @@ -224,7 +224,7 @@ bool IsPureContext() return skipMiddleware || (context.GlobalComponents.Count == 0 && fieldMiddlewareDefinitions.Count == 0); } - static Type GetResultType(ObjectFieldDefinition definition, Type runtimeType) + static Type GetResultType(ObjectFieldConfiguration definition, Type runtimeType) { if (definition.ResultType == null || definition.ResultType == typeof(object)) diff --git a/src/HotChocolate/Core/src/Types/Types/ObjectType.Initialization.cs b/src/HotChocolate/Core/src/Types/Types/ObjectType.Initialization.cs index fe445f94dfa..1aac10fbff0 100644 --- a/src/HotChocolate/Core/src/Types/Types/ObjectType.Initialization.cs +++ b/src/HotChocolate/Core/src/Types/Types/ObjectType.Initialization.cs @@ -144,7 +144,7 @@ protected virtual FieldCollection OnCompleteFields( { if (processed.Add(interfaceField.Name)) { - var field = new ObjectFieldDefinition(); + var field = new ObjectFieldConfiguration(); interfaceField.CopyTo(field); definition.Fields.Add(field); } @@ -166,7 +166,7 @@ protected virtual FieldCollection OnCompleteFields( TypeMemHelper.Return(processed); return collection; - static ObjectField CreateField(ObjectFieldDefinition fieldDef, int index) + static ObjectField CreateField(ObjectFieldConfiguration fieldDef, int index) => new(fieldDef, index); } diff --git a/src/HotChocolate/Core/src/Types/Types/ObjectTypeExtension.cs b/src/HotChocolate/Core/src/Types/Types/ObjectTypeExtension.cs index ce78c895d8a..05a05c41787 100644 --- a/src/HotChocolate/Core/src/Types/Types/ObjectTypeExtension.cs +++ b/src/HotChocolate/Core/src/Types/Types/ObjectTypeExtension.cs @@ -123,7 +123,7 @@ private void ApplyGlobalFieldIgnores( if (fieldIgnores.Count > 0) { - var fields = new List(); + var fields = new List(); foreach (var binding in fieldIgnores) { diff --git a/src/HotChocolate/Core/src/Types/Types/OutputFieldBase.cs b/src/HotChocolate/Core/src/Types/Types/OutputFieldBase.cs index 735db533249..b77dddfdc04 100644 --- a/src/HotChocolate/Core/src/Types/Types/OutputFieldBase.cs +++ b/src/HotChocolate/Core/src/Types/Types/OutputFieldBase.cs @@ -11,7 +11,7 @@ public class OutputFieldBase : FieldBase, IOutputField { private Type _runtimeType = default!; - internal OutputFieldBase(OutputFieldDefinitionBase definition, int index) + internal OutputFieldBase(OutputFieldConfiguration definition, int index) : base(definition, index) { DeprecationReason = definition.DeprecationReason; @@ -50,13 +50,13 @@ public bool IsDeprecated protected sealed override void OnCompleteField( ITypeCompletionContext context, ITypeSystemMember declaringMember, - FieldDefinitionBase definition) - => OnCompleteField(context, declaringMember, (OutputFieldDefinitionBase)definition); + FieldConfiguration definition) + => OnCompleteField(context, declaringMember, (OutputFieldConfiguration)definition); protected virtual void OnCompleteField( ITypeCompletionContext context, ITypeSystemMember declaringMember, - OutputFieldDefinitionBase definition) + OutputFieldConfiguration definition) { base.OnCompleteField(context, declaringMember, definition); @@ -68,23 +68,23 @@ protected virtual void OnCompleteField( // TODO: V15: should be renamed to OnCompleteArguments protected virtual FieldCollection OnCompleteFields( ITypeCompletionContext context, - OutputFieldDefinitionBase definition) + OutputFieldConfiguration definition) { return CompleteFields(context, this, definition.GetArguments(), CreateArgument); - static Argument CreateArgument(ArgumentDefinition argDef, int index) + static Argument CreateArgument(ArgumentConfiguration argDef, int index) => new(argDef, index); } protected sealed override void OnCompleteMetadata( ITypeCompletionContext context, ITypeSystemMember declaringMember, - FieldDefinitionBase definition) - => OnCompleteMetadata(context, declaringMember, (OutputFieldDefinitionBase)definition); + FieldConfiguration definition) + => OnCompleteMetadata(context, declaringMember, (OutputFieldConfiguration)definition); protected virtual void OnCompleteMetadata( ITypeCompletionContext context, ITypeSystemMember declaringMember, - OutputFieldDefinitionBase definition) + OutputFieldConfiguration definition) { base.OnCompleteMetadata(context, declaringMember, definition); @@ -97,13 +97,13 @@ protected virtual void OnCompleteMetadata( protected sealed override void OnMakeExecutable( ITypeCompletionContext context, ITypeSystemMember declaringMember, - FieldDefinitionBase definition) - => OnMakeExecutable(context, declaringMember, (OutputFieldDefinitionBase)definition); + FieldConfiguration definition) + => OnMakeExecutable(context, declaringMember, (OutputFieldConfiguration)definition); protected virtual void OnMakeExecutable( ITypeCompletionContext context, ITypeSystemMember declaringMember, - OutputFieldDefinitionBase definition) + OutputFieldConfiguration definition) { base.OnMakeExecutable(context, declaringMember, definition); @@ -116,13 +116,13 @@ protected virtual void OnMakeExecutable( protected sealed override void OnFinalizeField( ITypeCompletionContext context, ITypeSystemMember declaringMember, - FieldDefinitionBase definition) - => OnFinalizeField(context, declaringMember, (OutputFieldDefinitionBase)definition); + FieldConfiguration definition) + => OnFinalizeField(context, declaringMember, (OutputFieldConfiguration)definition); protected virtual void OnFinalizeField( ITypeCompletionContext context, ITypeSystemMember declaringMember, - OutputFieldDefinitionBase definition) + OutputFieldConfiguration definition) { base.OnFinalizeField(context, declaringMember, definition); diff --git a/src/HotChocolate/Core/src/Types/Types/Pagination/PagingHelper.cs b/src/HotChocolate/Core/src/Types/Types/Pagination/PagingHelper.cs index 8ba504aeb82..6cb1860b91f 100644 --- a/src/HotChocolate/Core/src/Types/Types/Pagination/PagingHelper.cs +++ b/src/HotChocolate/Core/src/Types/Types/Pagination/PagingHelper.cs @@ -30,12 +30,12 @@ internal static IObjectFieldDescriptor UsePaging( throw new ArgumentNullException(nameof(descriptor)); } - FieldMiddlewareDefinition placeholder = new(_ => _ => default, key: Paging); + FieldMiddlewareConfiguration placeholder = new(_ => _ => default, key: Paging); var definition = descriptor.Extend().Definition; definition.MiddlewareDefinitions.Add(placeholder); definition.Configurations.Add( - new CompleteConfiguration( + new CompleteConfiguration( (c, d) => ApplyConfiguration( c, d, @@ -52,12 +52,12 @@ internal static IObjectFieldDescriptor UsePaging( private static void ApplyConfiguration( ITypeCompletionContext context, - ObjectFieldDefinition definition, + ObjectFieldConfiguration definition, Type? entityType, string? name, GetPagingProvider resolvePagingProvider, PagingOptions? options, - FieldMiddlewareDefinition placeholder) + FieldMiddlewareConfiguration placeholder) { options = context.GetPagingOptions(options); entityType ??= context.GetType(definition.Type!).ToRuntimeType(); @@ -74,7 +74,7 @@ private static void ApplyConfiguration( private static IExtendedType GetSourceType( ITypeInspector typeInspector, - ObjectFieldDefinition definition, + ObjectFieldConfiguration definition, Type entityType) { var type = ResolveType(); diff --git a/src/HotChocolate/Core/src/Types/Types/Relay/Descriptors/NodeDefinition.cs b/src/HotChocolate/Core/src/Types/Types/Relay/Descriptors/NodeDefinition.cs index 45787e94822..a06b1554bb4 100644 --- a/src/HotChocolate/Core/src/Types/Types/Relay/Descriptors/NodeDefinition.cs +++ b/src/HotChocolate/Core/src/Types/Types/Relay/Descriptors/NodeDefinition.cs @@ -9,7 +9,7 @@ namespace HotChocolate.Types.Relay.Descriptors; /// The node definition is a mutable object that is used during type initialization /// to configure object types that implement . /// -public class NodeDefinition : DefinitionBase +public class NodeDefinition : TypeSystemConfiguration { /// /// Gets the node runtime type. @@ -24,5 +24,5 @@ public class NodeDefinition : DefinitionBase /// /// Gets an object field definition representing the node resolver. /// - public ObjectFieldDefinition? ResolverField { get; set; } + public ObjectFieldConfiguration? ResolverField { get; set; } } diff --git a/src/HotChocolate/Core/src/Types/Types/Relay/Descriptors/NodeDescriptorBase.cs b/src/HotChocolate/Core/src/Types/Types/Relay/Descriptors/NodeDescriptorBase.cs index 201cee6bb3a..51d7e72a64f 100644 --- a/src/HotChocolate/Core/src/Types/Types/Relay/Descriptors/NodeDescriptorBase.cs +++ b/src/HotChocolate/Core/src/Types/Types/Relay/Descriptors/NodeDescriptorBase.cs @@ -29,7 +29,7 @@ public abstract class NodeDescriptorBase(IDescriptorContext context) public virtual IObjectFieldDescriptor ResolveNode( FieldResolverDelegate fieldResolver) { - Definition.ResolverField ??= new ObjectFieldDefinition(); + Definition.ResolverField ??= new ObjectFieldConfiguration(); Definition.ResolverField.Resolver = fieldResolver ?? throw new ArgumentNullException(nameof(fieldResolver)); @@ -84,7 +84,7 @@ public IObjectFieldDescriptor ResolveNodeWith( if (member is MethodInfo m) { - Definition.ResolverField ??= new ObjectFieldDefinition(); + Definition.ResolverField ??= new ObjectFieldConfiguration(); Definition.ResolverField.Member = m; Definition.ResolverField.ResolverType = typeof(TResolver); return ConfigureNodeField(); @@ -108,7 +108,7 @@ public IObjectFieldDescriptor ResolveNodeWith(MethodInfo method) throw new ArgumentNullException(nameof(method)); } - Definition.ResolverField ??= new ObjectFieldDefinition(); + Definition.ResolverField ??= new ObjectFieldConfiguration(); Definition.ResolverField.Member = method; Definition.ResolverField.ResolverType = method.DeclaringType ?? typeof(object); return ConfigureNodeField(); @@ -187,7 +187,7 @@ public static IObjectFieldDescriptor TryAdd(IObjectFieldDescriptor descriptor) context.ContextData[WellKnownContextData.NodeIdResultFormatter] = value; } - var formatter = (ResultFormatterDefinition)value; + var formatter = (ResultFormatterConfiguration)value; var converters = extensions.Definition.FormatterDefinitions; if (!converters.Contains(formatter)) @@ -198,7 +198,7 @@ public static IObjectFieldDescriptor TryAdd(IObjectFieldDescriptor descriptor) return descriptor; } - public static ResultFormatterDefinition Create( + public static ResultFormatterConfiguration Create( INodeIdSerializerAccessor serializerAccessor) => new((context, result) => result is not null diff --git a/src/HotChocolate/Core/src/Types/Types/Relay/Descriptors/NodeDescriptor~2.cs b/src/HotChocolate/Core/src/Types/Types/Relay/Descriptors/NodeDescriptor~2.cs index 93e0c6e8197..1f7882ffd7a 100644 --- a/src/HotChocolate/Core/src/Types/Types/Relay/Descriptors/NodeDescriptor~2.cs +++ b/src/HotChocolate/Core/src/Types/Types/Relay/Descriptors/NodeDescriptor~2.cs @@ -42,7 +42,7 @@ public IObjectFieldDescriptor NodeResolver(NodeResolverDelegate node public IObjectFieldDescriptor ResolveNode(FieldResolverDelegate fieldResolver) { - Definition.ResolverField ??= new ObjectFieldDefinition(); + Definition.ResolverField ??= new ObjectFieldConfiguration(); Definition.ResolverField.Resolver = fieldResolver ?? throw new ArgumentNullException(nameof(fieldResolver)); @@ -83,7 +83,7 @@ public IObjectFieldDescriptor ResolveNodeWith( if (member is MethodInfo m) { - Definition.ResolverField ??= new ObjectFieldDefinition(); + Definition.ResolverField ??= new ObjectFieldConfiguration(); Definition.ResolverField.Member = m; Definition.ResolverField.ResolverType = typeof(TResolver); return _configureNodeField(); @@ -101,7 +101,7 @@ public IObjectFieldDescriptor ResolveNodeWith(MethodInfo method) throw new ArgumentNullException(nameof(method)); } - Definition.ResolverField ??= new ObjectFieldDefinition(); + Definition.ResolverField ??= new ObjectFieldConfiguration(); Definition.ResolverField.Member = method; Definition.ResolverField.ResolverType = method.DeclaringType ?? typeof(object); return _configureNodeField(); diff --git a/src/HotChocolate/Core/src/Types/Types/Relay/Extensions/RelayIdFieldHelpers.cs b/src/HotChocolate/Core/src/Types/Types/Relay/Extensions/RelayIdFieldHelpers.cs index e6b738207b5..fbdd0a04b4b 100644 --- a/src/HotChocolate/Core/src/Types/Types/Relay/Extensions/RelayIdFieldHelpers.cs +++ b/src/HotChocolate/Core/src/Types/Types/Relay/Extensions/RelayIdFieldHelpers.cs @@ -24,7 +24,7 @@ internal static class RelayIdFieldHelpers /// You most likely want to call `.ID()` directly and do not use this helper /// public static void ApplyIdToField( - IDescriptor descriptor, + IDescriptor descriptor, string? typeName = default) { if (descriptor is null) @@ -52,7 +52,7 @@ public static void ApplyIdToField( /// You most likely want to call `.ID()` directly and do not use this helper /// public static void ApplyIdToField( - IDescriptor descriptor, + IDescriptor descriptor, string? typeName = default) { if (descriptor is null) @@ -63,7 +63,7 @@ public static void ApplyIdToField( // rewrite type descriptor.Extend().OnBeforeCreate(RewriteDefinition); - if (descriptor is IDescriptor objectFieldDescriptor) + if (descriptor is IDescriptor objectFieldDescriptor) { var extend = objectFieldDescriptor.Extend(); @@ -83,10 +83,10 @@ public static void ApplyIdToField( /// You most likely want to call `.ID()` directly and do not use this helper /// internal static void ApplyIdToField( - ObjectFieldDefinition definition, + ObjectFieldConfiguration definition, string? typeName = default) { - var placeholder = new ResultFormatterDefinition( + var placeholder = new ResultFormatterConfiguration( (_, r) => r, isRepeatable: false, key: WellKnownMiddleware.GlobalId); @@ -95,7 +95,7 @@ internal static void ApplyIdToField( var configuration = new CompleteConfiguration( (ctx, def) => AddSerializerToObjectField( ctx, - (ObjectFieldDefinition)def, + (ObjectFieldConfiguration)def, placeholder, typeName), definition, @@ -106,7 +106,7 @@ internal static void ApplyIdToField( private static void RewriteDefinition( IDescriptorContext context, - FieldDefinitionBase definition) + FieldConfiguration definition) { if (definition.Type is ExtendedTypeReference typeReference) { @@ -144,17 +144,17 @@ private static IExtendedType RewriteType(ITypeInspector typeInspector, ITypeInfo internal static void AddSerializerToInputField( ITypeCompletionContext completionContext, - ArgumentDefinition definition, + ArgumentConfiguration definition, string? typeName) { var typeInspector = completionContext.TypeInspector; IExtendedType? resultType; - if (definition is InputFieldDefinition { RuntimeType: { } runtimeType, }) + if (definition is InputFieldConfiguration { RuntimeType: { } runtimeType, }) { resultType = typeInspector.GetType(runtimeType); } - else if (definition is InputFieldDefinition { Property: not null, } inputField) + else if (definition is InputFieldConfiguration { Property: not null, } inputField) { resultType = typeInspector.GetReturnType(inputField.Property, true); } @@ -182,8 +182,8 @@ internal static void AddSerializerToInputField( private static void AddSerializerToObjectField( ITypeCompletionContext completionContext, - ObjectFieldDefinition definition, - ResultFormatterDefinition placeholder, + ObjectFieldConfiguration definition, + ResultFormatterConfiguration placeholder, string? typeName) { var typeInspector = completionContext.TypeInspector; @@ -214,7 +214,7 @@ private static void AddSerializerToObjectField( CreateResultFormatter(typeName, resultType, serializerAccessor); } - private static ResultFormatterDefinition CreateResultFormatter( + private static ResultFormatterConfiguration CreateResultFormatter( string typeName, IExtendedType resultType, INodeIdSerializerAccessor serializerAccessor) diff --git a/src/HotChocolate/Core/src/Types/Types/Relay/NodeFieldTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/Types/Relay/NodeFieldTypeInterceptor.cs index 6d88de1aa87..6865bdc5407 100644 --- a/src/HotChocolate/Core/src/Types/Types/Relay/NodeFieldTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Relay/NodeFieldTypeInterceptor.cs @@ -69,21 +69,21 @@ public override void OnBeforeCompleteTypes() private static void CreateNodeField( ITypeInspector typeInspector, INodeIdSerializerAccessor serializerAccessor, - IList fields, + IList fields, int index) { var node = typeInspector.GetTypeRef(typeof(NodeType)); var id = typeInspector.GetTypeRef(typeof(NonNullType)); - var field = new ObjectFieldDefinition( + var field = new ObjectFieldConfiguration( Node, Relay_NodeField_Description, node) { - Arguments = { new ArgumentDefinition(Id, Relay_NodeField_Id_Description, id), }, + Arguments = { new ArgumentConfiguration(Id, Relay_NodeField_Id_Description, id), }, MiddlewareDefinitions = { - new FieldMiddlewareDefinition( + new FieldMiddlewareConfiguration( _ => { INodeIdSerializer? serializer = null; @@ -108,22 +108,22 @@ private static void CreateNodeField( private static void CreateNodesField( ITypeInspector typeInspector, INodeIdSerializerAccessor serializerAccessor, - IList fields, + IList fields, int index, int maxAllowedNodes) { var nodes = typeInspector.GetTypeRef(typeof(NonNullType>)); var ids = typeInspector.GetTypeRef(typeof(NonNullType>>)); - var field = new ObjectFieldDefinition( + var field = new ObjectFieldConfiguration( Nodes, Relay_NodesField_Description, nodes) { - Arguments = { new ArgumentDefinition(Ids, Relay_NodesField_Ids_Description, ids), }, + Arguments = { new ArgumentConfiguration(Ids, Relay_NodesField_Ids_Description, ids), }, MiddlewareDefinitions = { - new FieldMiddlewareDefinition( + new FieldMiddlewareConfiguration( _ => { INodeIdSerializer? serializer = null; diff --git a/src/HotChocolate/Core/src/Types/Types/Relay/NodeIdSerializerTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/Types/Relay/NodeIdSerializerTypeInterceptor.cs index 4f7a355cae6..03a250a1f2d 100644 --- a/src/HotChocolate/Core/src/Types/Types/Relay/NodeIdSerializerTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Relay/NodeIdSerializerTypeInterceptor.cs @@ -11,7 +11,7 @@ namespace HotChocolate.Types.Relay; internal sealed class NodeIdSerializerTypeInterceptor : TypeInterceptor { - public override void OnBeforeCompleteType(ITypeCompletionContext completionContext, DefinitionBase definition) + public override void OnBeforeCompleteType(ITypeCompletionContext completionContext, TypeSystemConfiguration definition) { if (definition is SchemaTypeDefinition schemaTypeDef) { diff --git a/src/HotChocolate/Core/src/Types/Types/Relay/QueryFieldTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/Types/Relay/QueryFieldTypeInterceptor.cs index 06ed1bf89a4..a4045e10b50 100644 --- a/src/HotChocolate/Core/src/Types/Types/Relay/QueryFieldTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Relay/QueryFieldTypeInterceptor.cs @@ -16,7 +16,7 @@ internal sealed class QueryFieldTypeInterceptor : TypeInterceptor private ITypeCompletionContext _context = default!; private ObjectType? _queryType; - private ObjectFieldDefinition _queryField = default!; + private ObjectFieldConfiguration _queryField = default!; private ObjectTypeDefinition? _mutationDefinition; public override void OnAfterResolveRootType( @@ -46,7 +46,7 @@ public override void OnBeforeCompleteTypes() TypeReference queryType = TypeReference.Parse($"{_queryType.Name}!"); - _queryField = new ObjectFieldDefinition( + _queryField = new ObjectFieldConfiguration( options.QueryFieldName ?? _defaultFieldName, type: queryType, resolver: ctx => new(ctx.GetQueryRoot())); @@ -67,7 +67,7 @@ public override void OnBeforeCompleteTypes() public override void OnBeforeCompleteType( ITypeCompletionContext completionContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { if (completionContext.Type is ObjectType objectType && definition is ObjectTypeDefinition objectTypeDef diff --git a/src/HotChocolate/Core/src/Types/Types/TypeSystemObjectBase~1.cs b/src/HotChocolate/Core/src/Types/Types/TypeSystemObjectBase~1.cs index 3d710daf656..4479b523e2d 100644 --- a/src/HotChocolate/Core/src/Types/Types/TypeSystemObjectBase~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/TypeSystemObjectBase~1.cs @@ -9,7 +9,7 @@ namespace HotChocolate.Types; public abstract class TypeSystemObjectBase : TypeSystemObjectBase - where TDefinition : DefinitionBase + where TDefinition : TypeSystemConfiguration { private TDefinition? _definition; private IReadOnlyDictionary? _contextData; @@ -230,62 +230,62 @@ protected virtual void OnBeforeInitialize( protected virtual void OnAfterInitialize( ITypeDiscoveryContext context, - DefinitionBase definition) + TypeSystemConfiguration definition) => context.TypeInterceptor.OnAfterInitialize(context, definition); protected virtual void OnBeforeRegisterDependencies( ITypeDiscoveryContext context, - DefinitionBase definition) + TypeSystemConfiguration definition) => context.TypeInterceptor.OnBeforeRegisterDependencies(context, definition); protected virtual void OnAfterRegisterDependencies( ITypeDiscoveryContext context, - DefinitionBase definition) + TypeSystemConfiguration definition) => context.TypeInterceptor.OnAfterRegisterDependencies(context, definition); protected virtual void OnBeforeCompleteName( ITypeCompletionContext context, - DefinitionBase definition) + TypeSystemConfiguration definition) => context.TypeInterceptor.OnBeforeCompleteName(context, definition); protected virtual void OnAfterCompleteName( ITypeCompletionContext context, - DefinitionBase definition) + TypeSystemConfiguration definition) => context.TypeInterceptor.OnAfterCompleteName(context, definition); protected virtual void OnBeforeCompleteType( ITypeCompletionContext context, - DefinitionBase definition) + TypeSystemConfiguration definition) => context.TypeInterceptor.OnBeforeCompleteType(context, definition); protected virtual void OnAfterCompleteType( ITypeCompletionContext context, - DefinitionBase definition) + TypeSystemConfiguration definition) => context.TypeInterceptor.OnAfterCompleteType(context, definition); protected virtual void OnBeforeCompleteMetadata( ITypeCompletionContext context, - DefinitionBase definition) + TypeSystemConfiguration definition) => context.TypeInterceptor.OnBeforeCompleteMetadata(context, definition); protected virtual void OnAfterCompleteMetadata( ITypeCompletionContext context, - DefinitionBase definition) + TypeSystemConfiguration definition) => context.TypeInterceptor.OnAfterCompleteMetadata(context, definition); protected virtual void OnBeforeMakeExecutable( ITypeCompletionContext context, - DefinitionBase definition) + TypeSystemConfiguration definition) => context.TypeInterceptor.OnBeforeMakeExecutable(context, definition); protected virtual void OnAfterMakeExecutable( ITypeCompletionContext context, - DefinitionBase definition) + TypeSystemConfiguration definition) => context.TypeInterceptor.OnAfterMakeExecutable(context, definition); protected virtual void OnValidateType( ITypeSystemObjectContext context, - DefinitionBase definition) + TypeSystemConfiguration definition) => context.TypeInterceptor.OnValidateType(context, definition); private void AssertUninitialized() diff --git a/src/HotChocolate/Core/src/Types/Utilities/ErrorHelper.cs b/src/HotChocolate/Core/src/Types/Utilities/ErrorHelper.cs index 04479e33ece..889081551b8 100644 --- a/src/HotChocolate/Core/src/Types/Utilities/ErrorHelper.cs +++ b/src/HotChocolate/Core/src/Types/Utilities/ErrorHelper.cs @@ -374,7 +374,7 @@ public static ISchemaError DirectiveCollection_ArgumentError( public static ISchemaError ObjectType_UnableToInferOrResolveType( string typeName, ObjectType type, - ObjectFieldDefinition field) + ObjectFieldConfiguration field) => SchemaErrorBuilder.New() .SetMessage( ErrorHelper_ObjectType_UnableToInferOrResolveType, diff --git a/src/HotChocolate/Core/test/Types.Mutations.Tests/AnnotationBasedMutations.cs b/src/HotChocolate/Core/test/Types.Mutations.Tests/AnnotationBasedMutations.cs index 86a463b5ccd..ebf5afc2704 100644 --- a/src/HotChocolate/Core/test/Types.Mutations.Tests/AnnotationBasedMutations.cs +++ b/src/HotChocolate/Core/test/Types.Mutations.Tests/AnnotationBasedMutations.cs @@ -1410,7 +1410,7 @@ internal class SimpleMutation_ErrorViaTypeInterceptor : TypeInterceptor { public override void OnBeforeCompleteType( ITypeCompletionContext completionContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { if (definition is not ObjectTypeDefinition objTypeDef) { @@ -1420,7 +1420,7 @@ public override void OnBeforeCompleteType( public override void OnBeforeRegisterDependencies( ITypeDiscoveryContext discoveryContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { if (definition is ObjectTypeDefinition objTypeDef) { @@ -1756,7 +1756,7 @@ public class CustomErrorConfig : MutationErrorConfiguration { public override void OnConfigure( IDescriptorContext context, - ObjectFieldDefinition mutationField) + ObjectFieldConfiguration mutationField) { mutationField.AddErrorType(context, typeof(SomeNewError)); mutationField.MiddlewareDefinitions.Add( diff --git a/src/HotChocolate/Core/test/Types.Tests/Configuration/TypeInitializationOrderTests.cs b/src/HotChocolate/Core/test/Types.Tests/Configuration/TypeInitializationOrderTests.cs index 52c1e16c427..64cedb73513 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Configuration/TypeInitializationOrderTests.cs +++ b/src/HotChocolate/Core/test/Types.Tests/Configuration/TypeInitializationOrderTests.cs @@ -46,7 +46,7 @@ protected override void Configure(IObjectTypeDescriptor descriptor) c.TypeInspector.GetTypeRef(typeof(Word), TypeContext.Output); d.Configurations.Add( - new CompleteConfiguration( + new CompleteConfiguration( (context, _) => { var type = context.GetType(reference); diff --git a/src/HotChocolate/Core/test/Types.Tests/Configuration/TypeScopeInterceptorTests.cs b/src/HotChocolate/Core/test/Types.Tests/Configuration/TypeScopeInterceptorTests.cs index 4608701aaf5..4b118071f2d 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Configuration/TypeScopeInterceptorTests.cs +++ b/src/HotChocolate/Core/test/Types.Tests/Configuration/TypeScopeInterceptorTests.cs @@ -79,7 +79,7 @@ public TypeScopeInterceptor(ICollection types) public override void OnBeforeRegisterDependencies( ITypeDiscoveryContext discoveryContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { if (discoveryContext is { Scope: { }, } && definition is ObjectTypeDefinition def) { @@ -97,7 +97,7 @@ public override void OnBeforeRegisterDependencies( public override void OnBeforeCompleteName( ITypeCompletionContext completionContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { if (completionContext is { Scope: { }, }) { diff --git a/src/HotChocolate/Core/test/Types.Tests/SchemaBuilderTests.cs b/src/HotChocolate/Core/test/Types.Tests/SchemaBuilderTests.cs index 39fdf49a255..d28b2041c94 100644 --- a/src/HotChocolate/Core/test/Types.Tests/SchemaBuilderTests.cs +++ b/src/HotChocolate/Core/test/Types.Tests/SchemaBuilderTests.cs @@ -2273,14 +2273,14 @@ public class MyInterceptor : TypeInterceptor { public override void OnBeforeCompleteType( ITypeCompletionContext completionContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { definition.TouchContextData(); } public override void OnAfterCompleteType( ITypeCompletionContext completionContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { definition.ContextData.Add("touched", true); } diff --git a/src/HotChocolate/Core/test/Types.Tests/SchemaFirstTests.cs b/src/HotChocolate/Core/test/Types.Tests/SchemaFirstTests.cs index 86cf7138284..6cf75984ad7 100644 --- a/src/HotChocolate/Core/test/Types.Tests/SchemaFirstTests.cs +++ b/src/HotChocolate/Core/test/Types.Tests/SchemaFirstTests.cs @@ -551,10 +551,10 @@ public class CustomDescriptionDirective : ISchemaDirective public void ApplyConfiguration( IDescriptorContext context, DirectiveNode directiveNode, - IDefinition definition, - Stack path) + ITypeSystemConfiguration definition, + Stack path) { - if (definition is ObjectFieldDefinition objectField) + if (definition is ObjectFieldConfiguration objectField) { objectField.Description = (string)directiveNode.Arguments.First().Value.Value; } diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/EnumTypeTests.cs b/src/HotChocolate/Core/test/Types.Tests/Types/EnumTypeTests.cs index 623a2165f27..885621c2728 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Types/EnumTypeTests.cs +++ b/src/HotChocolate/Core/test/Types.Tests/Types/EnumTypeTests.cs @@ -508,7 +508,7 @@ public void EnumValue_DefinitionValueIsNull_ArgumentNullException() { // arrange // act - void Action() => new EnumValue(new EnumValueDefinition()); + void Action() => new EnumValue(new EnumValueConfiguration()); // assert Assert.Throws(Action); diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/EnumTypeUnsafeTests.cs b/src/HotChocolate/Core/test/Types.Tests/Types/EnumTypeUnsafeTests.cs index d419bb91edc..26cd3a33096 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Types/EnumTypeUnsafeTests.cs +++ b/src/HotChocolate/Core/test/Types.Tests/Types/EnumTypeUnsafeTests.cs @@ -46,7 +46,7 @@ public async Task Create_Enum_Unsafe_With_Descriptor() // arrange // act var enumType = EnumType.CreateUnsafe( - new EnumTypeDefinition("Simple") + new EnumTypeConfiguration("Simple") { Values = { diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/Relay/IdAttributeTests.cs b/src/HotChocolate/Core/test/Types.Tests/Types/Relay/IdAttributeTests.cs index b8a9eb7e354..78927a6bda6 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Types/Relay/IdAttributeTests.cs +++ b/src/HotChocolate/Core/test/Types.Tests/Types/Relay/IdAttributeTests.cs @@ -695,7 +695,7 @@ protected internal override void TryConfigure( } } - private void AddInterceptingSerializer(ArgumentDefinition definition) + private void AddInterceptingSerializer(ArgumentConfiguration definition) => definition.Formatters.Insert(0, new InterceptingFormatter(TypeName)); private sealed class InterceptingFormatter(string typeName) : IInputValueFormatter @@ -717,7 +717,7 @@ public class TestTypeInterceptor : TypeInterceptor public override void OnValidateType( ITypeSystemObjectContext validationContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { if (validationContext.Type.Name.EqualsOrdinal("Query") && definition is ObjectTypeDefinition typeDef) diff --git a/src/HotChocolate/CostAnalysis/src/CostAnalysis/CostTypeInterceptor.cs b/src/HotChocolate/CostAnalysis/src/CostAnalysis/CostTypeInterceptor.cs index 16db0975271..308d84685f4 100644 --- a/src/HotChocolate/CostAnalysis/src/CostAnalysis/CostTypeInterceptor.cs +++ b/src/HotChocolate/CostAnalysis/src/CostAnalysis/CostTypeInterceptor.cs @@ -43,7 +43,7 @@ internal override void InitializeContext( TypeReferenceResolver typeReferenceResolver) => _options = context.Services.GetRequiredService(); - public override void OnAfterCompleteName(ITypeCompletionContext completionContext, DefinitionBase definition) + public override void OnAfterCompleteName(ITypeCompletionContext completionContext, TypeSystemConfiguration definition) { if (definition is ObjectTypeDefinition objectTypeDef) { @@ -118,7 +118,7 @@ public override void OnAfterCompleteName(ITypeCompletionContext completionContex } } - if (definition is InputObjectTypeDefinition inputObjectTypeDef) + if (definition is InputObjectTypeConfiguration inputObjectTypeDef) { foreach (var fieldDef in inputObjectTypeDef.Fields) { @@ -151,7 +151,7 @@ public override void OnAfterCompleteName(ITypeCompletionContext completionContex } } - public override void OnBeforeCompleteType(ITypeCompletionContext completionContext, DefinitionBase definition) + public override void OnBeforeCompleteType(ITypeCompletionContext completionContext, TypeSystemConfiguration definition) { if (definition is ObjectTypeDefinition objectTypeDef) { @@ -180,11 +180,11 @@ internal override bool SkipDirectiveDefinition(DirectiveDefinitionNode node) file static class Extensions { - public static bool HasCostDirective(this IHasDirectiveDefinition directiveProvider) + public static bool HasCostDirective(this IDirectiveConfigurationProvider directiveProvider) => directiveProvider.Directives.Any( t => t.Value is CostDirective or DirectiveNode { Name.Value: "cost" }); - public static bool HasListSizeDirective(this IHasDirectiveDefinition directiveProvider) + public static bool HasListSizeDirective(this IDirectiveConfigurationProvider directiveProvider) => directiveProvider.Directives.Any( t => t.Value is ListSizeDirective or DirectiveNode { Name.Value: "listSize" }); } diff --git a/src/HotChocolate/CostAnalysis/src/CostAnalysis/Types/ListSizeDirectiveType.cs b/src/HotChocolate/CostAnalysis/src/CostAnalysis/Types/ListSizeDirectiveType.cs index bdfded05c21..9470d8ce5f3 100644 --- a/src/HotChocolate/CostAnalysis/src/CostAnalysis/Types/ListSizeDirectiveType.cs +++ b/src/HotChocolate/CostAnalysis/src/CostAnalysis/Types/ListSizeDirectiveType.cs @@ -80,7 +80,7 @@ protected override void Configure(IDirectiveTypeDescriptor de protected override Func OnCompleteParse( ITypeCompletionContext context, - DirectiveTypeDefinition definition) + DirectiveTypeConfiguration definition) => ParseLiteral; private static object ParseLiteral(DirectiveNode directiveNode) @@ -135,7 +135,7 @@ private static object ParseLiteral(DirectiveNode directiveNode) protected override Func OnCompleteFormat( ITypeCompletionContext context, - DirectiveTypeDefinition definition) + DirectiveTypeConfiguration definition) => FormatValue; private static DirectiveNode FormatValue(object value) diff --git a/src/HotChocolate/Data/src/Data/Filters/Convention/DataTypeExtensionHelper.cs b/src/HotChocolate/Data/src/Data/Filters/Convention/DataTypeExtensionHelper.cs index bfdd287132e..1150743400e 100644 --- a/src/HotChocolate/Data/src/Data/Filters/Convention/DataTypeExtensionHelper.cs +++ b/src/HotChocolate/Data/src/Data/Filters/Convention/DataTypeExtensionHelper.cs @@ -82,8 +82,8 @@ public static void MergeSortInputTypeDefinitions( private static void MergeFilterFieldDefinitions( ITypeCompletionContext context, - IList extensionFields, - IList typeFields) + IList extensionFields, + IList typeFields) { MergeFilterFields( context, @@ -104,8 +104,8 @@ private static void MergeFilterFieldDefinitions( private static void MergeSortEnumValueDefinitions( ITypeCompletionContext context, - IList extensionFields, - IList typeFields) + IList extensionFields, + IList typeFields) { MergeSortEnumValues( context, @@ -125,8 +125,8 @@ private static void MergeSortEnumValueDefinitions( private static void MergeSortInputFieldDefinitions( ITypeCompletionContext context, - IList extensionFields, - IList typeFields) + IList extensionFields, + IList typeFields) { MergeSortFields( context, @@ -147,14 +147,14 @@ private static void MergeSortInputFieldDefinitions( private static void MergeFilterFields( ITypeCompletionContext context, - IList extensionFields, - IList typeFields, - Action, InputFieldDefinition, InputFieldDefinition> + IList extensionFields, + IList typeFields, + Action, InputFieldConfiguration, InputFieldConfiguration> action) { foreach (var extensionField in extensionFields) { - InputFieldDefinition? typeField; + InputFieldConfiguration? typeField; if (extensionField is FilterOperationFieldDefinition operationFieldDefinition) { typeField = typeFields.OfType() @@ -186,14 +186,14 @@ private static void MergeFilterFields( private static void MergeSortEnumValues( ITypeCompletionContext context, - IList extensionFields, - IList typeFields, - Action, EnumValueDefinition, EnumValueDefinition> + IList extensionFields, + IList typeFields, + Action, EnumValueConfiguration, EnumValueConfiguration> action) { foreach (var extensionField in extensionFields) { - EnumValueDefinition? typeField; + EnumValueConfiguration? typeField; if (extensionField is SortEnumValueDefinition sortEnumValueDefinition) { typeField = typeFields.OfType() @@ -225,9 +225,9 @@ private static void MergeSortEnumValues( private static void MergeSortFields( ITypeCompletionContext context, - IList extensionFields, - IList typeFields, - Action, InputFieldDefinition, InputFieldDefinition> + IList extensionFields, + IList typeFields, + Action, InputFieldConfiguration, InputFieldConfiguration> action) { foreach (var extensionField in extensionFields) diff --git a/src/HotChocolate/Data/src/Data/Filters/Convention/FilterTypeInterceptor.cs b/src/HotChocolate/Data/src/Data/Filters/Convention/FilterTypeInterceptor.cs index 4bc61c26d3f..43cb17fac77 100644 --- a/src/HotChocolate/Data/src/Data/Filters/Convention/FilterTypeInterceptor.cs +++ b/src/HotChocolate/Data/src/Data/Filters/Convention/FilterTypeInterceptor.cs @@ -15,7 +15,7 @@ public sealed class FilterTypeInterceptor : TypeInterceptor public override void OnBeforeRegisterDependencies( ITypeDiscoveryContext discoveryContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { if (definition is not FilterInputTypeDefinition { EntityType: { }, } def) { @@ -41,7 +41,7 @@ public override void OnBeforeRegisterDependencies( public override void OnBeforeCompleteName( ITypeCompletionContext completionContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { if (definition is not FilterInputTypeDefinition def) { @@ -69,7 +69,7 @@ public override void OnBeforeCompleteName( public override void OnAfterCompleteName( ITypeCompletionContext completionContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { if (definition is not FilterInputTypeDefinition { EntityType: { }, } def) { @@ -122,7 +122,7 @@ private IFilterConvention GetConvention(IDescriptorContext context, string? scop } private static void ApplyCorrectScope( - InputObjectTypeDefinition definition, + InputObjectTypeConfiguration definition, ITypeDiscoveryContext discoveryContext) { foreach (var field in definition.Fields) @@ -157,7 +157,7 @@ private static void ApplyIdAttributesToFields( file static class Extensions { - public static bool HasIdAttribute(this InputFieldDefinition? definition) + public static bool HasIdAttribute(this InputFieldConfiguration? definition) { if (definition is not FilterFieldDefinition { Member: { } member }) { diff --git a/src/HotChocolate/Data/src/Data/Filters/Extensions/FilterObjectFieldDescriptorExtensions.cs b/src/HotChocolate/Data/src/Data/Filters/Extensions/FilterObjectFieldDescriptorExtensions.cs index dd55e0fc215..8018d05b3b3 100644 --- a/src/HotChocolate/Data/src/Data/Filters/Extensions/FilterObjectFieldDescriptorExtensions.cs +++ b/src/HotChocolate/Data/src/Data/Filters/Extensions/FilterObjectFieldDescriptorExtensions.cs @@ -125,7 +125,7 @@ private static IObjectFieldDescriptor UseFiltering( ITypeSystemMember? filterTypeInstance, string? scope) { - FieldMiddlewareDefinition placeholder = new(_ => _ => default); + FieldMiddlewareConfiguration placeholder = new(_ => _ => default); var argumentPlaceholder = "_" + Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture); @@ -166,7 +166,7 @@ private static IObjectFieldDescriptor UseFiltering( scope); } - var argumentDefinition = new ArgumentDefinition + var argumentDefinition = new ArgumentConfiguration { Name = argumentPlaceholder, Type = argumentTypeReference, @@ -176,7 +176,7 @@ private static IObjectFieldDescriptor UseFiltering( definition.Arguments.Add(argumentDefinition); definition.Configurations.Add( - new CompleteConfiguration( + new CompleteConfiguration( (ctx, d) => CompileMiddleware( ctx, @@ -190,7 +190,7 @@ private static IObjectFieldDescriptor UseFiltering( TypeDependencyFulfilled.Completed)); argumentDefinition.Configurations.Add( - new CompleteConfiguration( + new CompleteConfiguration( (context, argDef) => argDef.Name = context.GetFilterConvention(scope).GetArgumentName(), @@ -203,9 +203,9 @@ private static IObjectFieldDescriptor UseFiltering( private static void CompileMiddleware( ITypeCompletionContext context, - ObjectFieldDefinition definition, + ObjectFieldConfiguration definition, TypeReference argumentTypeReference, - FieldMiddlewareDefinition placeholder, + FieldMiddlewareConfiguration placeholder, string? scope) { var type = context.GetType(argumentTypeReference); diff --git a/src/HotChocolate/Data/src/Data/Filters/Fields/AndField.cs b/src/HotChocolate/Data/src/Data/Filters/Fields/AndField.cs index 863745494c2..b41bcce3a1c 100644 --- a/src/HotChocolate/Data/src/Data/Filters/Fields/AndField.cs +++ b/src/HotChocolate/Data/src/Data/Filters/Fields/AndField.cs @@ -21,7 +21,7 @@ internal AndField(IDescriptorContext context, int index, string? scope) protected override void OnCompleteField( ITypeCompletionContext context, ITypeSystemMember declaringMember, - InputFieldDefinition definition) + InputFieldConfiguration definition) { definition.Type = TypeReference.Parse( $"[{context.Type.Name}!]", diff --git a/src/HotChocolate/Data/src/Data/Filters/Fields/FilterField.cs b/src/HotChocolate/Data/src/Data/Filters/Fields/FilterField.cs index 39e4701b03b..283f2f92b68 100644 --- a/src/HotChocolate/Data/src/Data/Filters/Fields/FilterField.cs +++ b/src/HotChocolate/Data/src/Data/Filters/Fields/FilterField.cs @@ -38,7 +38,7 @@ internal FilterField(FilterFieldDefinition definition, int index) protected override void OnCompleteField( ITypeCompletionContext context, ITypeSystemMember declaringMember, - InputFieldDefinition definition) + InputFieldConfiguration definition) { base.OnCompleteField(context, declaringMember, definition); diff --git a/src/HotChocolate/Data/src/Data/Filters/Fields/OrField.cs b/src/HotChocolate/Data/src/Data/Filters/Fields/OrField.cs index b3866783816..56cac3c6961 100644 --- a/src/HotChocolate/Data/src/Data/Filters/Fields/OrField.cs +++ b/src/HotChocolate/Data/src/Data/Filters/Fields/OrField.cs @@ -21,7 +21,7 @@ internal OrField(IDescriptorContext context, int index, string? scope) protected override void OnCompleteField( ITypeCompletionContext context, ITypeSystemMember declaringMember, - InputFieldDefinition definition) + InputFieldConfiguration definition) { definition.Type = TypeReference.Parse( $"[{context.Type.Name}!]", diff --git a/src/HotChocolate/Data/src/Data/Filters/FilterFieldDefinition.cs b/src/HotChocolate/Data/src/Data/Filters/FilterFieldDefinition.cs index fa3f7da199f..94450ec8fac 100644 --- a/src/HotChocolate/Data/src/Data/Filters/FilterFieldDefinition.cs +++ b/src/HotChocolate/Data/src/Data/Filters/FilterFieldDefinition.cs @@ -5,7 +5,7 @@ namespace HotChocolate.Data.Filters; public class FilterFieldDefinition - : InputFieldDefinition + : InputFieldConfiguration , IFilterFieldDefinition { public MemberInfo? Member { get; set; } diff --git a/src/HotChocolate/Data/src/Data/Filters/FilterFieldDescriptor.cs b/src/HotChocolate/Data/src/Data/Filters/FilterFieldDescriptor.cs index ac4f61dcd24..90ba93b4be0 100644 --- a/src/HotChocolate/Data/src/Data/Filters/FilterFieldDescriptor.cs +++ b/src/HotChocolate/Data/src/Data/Filters/FilterFieldDescriptor.cs @@ -69,7 +69,7 @@ protected internal FilterFieldDescriptor( protected set => base.Definition = value; } - internal InputFieldDefinition CreateFieldDefinition() => CreateDefinition(); + internal InputFieldConfiguration CreateFieldDefinition() => CreateDefinition(); protected override void OnCreateDefinition( FilterFieldDefinition definition) diff --git a/src/HotChocolate/Data/src/Data/Filters/FilterInputType.cs b/src/HotChocolate/Data/src/Data/Filters/FilterInputType.cs index 5d9faecfc12..2818131a6e1 100644 --- a/src/HotChocolate/Data/src/Data/Filters/FilterInputType.cs +++ b/src/HotChocolate/Data/src/Data/Filters/FilterInputType.cs @@ -25,7 +25,7 @@ public FilterInputType(Action configure) public IExtendedType EntityType { get; private set; } = default!; - protected override InputObjectTypeDefinition CreateDefinition( + protected override InputObjectTypeConfiguration CreateDefinition( ITypeDiscoveryContext context) { try @@ -48,7 +48,7 @@ protected override InputObjectTypeDefinition CreateDefinition( protected override void OnRegisterDependencies( ITypeDiscoveryContext context, - InputObjectTypeDefinition definition) + InputObjectTypeConfiguration definition) { base.OnRegisterDependencies(context, definition); if (definition is FilterInputTypeDefinition { EntityType: { }, } filterDefinition) @@ -64,7 +64,7 @@ protected virtual void Configure(IFilterInputTypeDescriptor descriptor) protected override void OnCompleteType( ITypeCompletionContext context, - InputObjectTypeDefinition definition) + InputObjectTypeConfiguration definition) { base.OnCompleteType(context, definition); @@ -77,7 +77,7 @@ protected override void OnCompleteType( protected override FieldCollection OnCompleteFields( ITypeCompletionContext context, - InputObjectTypeDefinition definition) + InputObjectTypeConfiguration definition) { var fields = new InputField[definition.Fields.Count + 2]; var index = 0; diff --git a/src/HotChocolate/Data/src/Data/Filters/FilterInputTypeDefinition.cs b/src/HotChocolate/Data/src/Data/Filters/FilterInputTypeDefinition.cs index a998262f5a4..524938e0df6 100644 --- a/src/HotChocolate/Data/src/Data/Filters/FilterInputTypeDefinition.cs +++ b/src/HotChocolate/Data/src/Data/Filters/FilterInputTypeDefinition.cs @@ -4,7 +4,7 @@ namespace HotChocolate.Data.Filters; public class FilterInputTypeDefinition - : InputObjectTypeDefinition + : InputObjectTypeConfiguration , IHasScope , IFilterInputTypeDefinition { diff --git a/src/HotChocolate/Data/src/Data/Filters/FilterInputType`1.cs b/src/HotChocolate/Data/src/Data/Filters/FilterInputType`1.cs index 828dc1cb04a..9fbd0714810 100644 --- a/src/HotChocolate/Data/src/Data/Filters/FilterInputType`1.cs +++ b/src/HotChocolate/Data/src/Data/Filters/FilterInputType`1.cs @@ -20,7 +20,7 @@ public FilterInputType() _configure = Configure; } - protected override InputObjectTypeDefinition CreateDefinition( + protected override InputObjectTypeConfiguration CreateDefinition( ITypeDiscoveryContext context) { var descriptor = FilterInputTypeDescriptor.New( diff --git a/src/HotChocolate/Data/src/Data/Filters/FilterOperationFieldDescriptor.cs b/src/HotChocolate/Data/src/Data/Filters/FilterOperationFieldDescriptor.cs index e32d7e53cd4..b320ae3b792 100644 --- a/src/HotChocolate/Data/src/Data/Filters/FilterOperationFieldDescriptor.cs +++ b/src/HotChocolate/Data/src/Data/Filters/FilterOperationFieldDescriptor.cs @@ -128,7 +128,7 @@ public IFilterOperationFieldDescriptor Operation(int operation) return this; } - public InputFieldDefinition CreateFieldDefinition() => CreateDefinition(); + public InputFieldConfiguration CreateFieldDefinition() => CreateDefinition(); public static FilterOperationFieldDescriptor New( IDescriptorContext context, diff --git a/src/HotChocolate/Data/src/Data/Filters/IFilterFieldDefinition.cs b/src/HotChocolate/Data/src/Data/Filters/IFilterFieldDefinition.cs index 7bb56d603fd..b48754f6461 100644 --- a/src/HotChocolate/Data/src/Data/Filters/IFilterFieldDefinition.cs +++ b/src/HotChocolate/Data/src/Data/Filters/IFilterFieldDefinition.cs @@ -6,9 +6,9 @@ namespace HotChocolate.Data.Filters; public interface IFilterFieldDefinition - : IDefinition - , IHasDirectiveDefinition - , IHasIgnore + : ITypeSystemConfiguration + , IDirectiveConfigurationProvider + , IIgnoreConfiguration , IHasScope { MemberInfo? Member { get; } diff --git a/src/HotChocolate/Data/src/Data/Projections/Extensions/ProjectionObjectFieldDescriptorExtensions.cs b/src/HotChocolate/Data/src/Data/Projections/Extensions/ProjectionObjectFieldDescriptorExtensions.cs index c7a56a1b5cc..394127a622c 100644 --- a/src/HotChocolate/Data/src/Data/Projections/Extensions/ProjectionObjectFieldDescriptorExtensions.cs +++ b/src/HotChocolate/Data/src/Data/Projections/Extensions/ProjectionObjectFieldDescriptorExtensions.cs @@ -130,7 +130,7 @@ public static IObjectFieldDescriptor UseProjection( throw new ArgumentNullException(nameof(descriptor)); } - FieldMiddlewareDefinition placeholder = + FieldMiddlewareConfiguration placeholder = new(_ => _ => default, key: WellKnownMiddleware.Projection); var extension = descriptor.Extend(); @@ -158,7 +158,7 @@ public static IObjectFieldDescriptor UseProjection( } definition.Configurations.Add( - new CompleteConfiguration( + new CompleteConfiguration( (c, d) => CompileMiddleware(selectionType, d, placeholder, c, scope), definition, ApplyConfigurationOn.BeforeCompletion)); @@ -169,8 +169,8 @@ public static IObjectFieldDescriptor UseProjection( private static void CompileMiddleware( Type type, - ObjectFieldDefinition definition, - FieldMiddlewareDefinition placeholder, + ObjectFieldConfiguration definition, + FieldMiddlewareConfiguration placeholder, ITypeCompletionContext context, string? scope) { diff --git a/src/HotChocolate/Data/src/Data/Projections/Extensions/SingleOrDefaultObjectFieldDescriptorExtensions.cs b/src/HotChocolate/Data/src/Data/Projections/Extensions/SingleOrDefaultObjectFieldDescriptorExtensions.cs index 18ec3ec55a1..6fe3cdb83aa 100644 --- a/src/HotChocolate/Data/src/Data/Projections/Extensions/SingleOrDefaultObjectFieldDescriptorExtensions.cs +++ b/src/HotChocolate/Data/src/Data/Projections/Extensions/SingleOrDefaultObjectFieldDescriptorExtensions.cs @@ -27,7 +27,7 @@ private static IObjectFieldDescriptor ApplyMiddleware( throw new ArgumentNullException(nameof(descriptor)); } - FieldMiddlewareDefinition placeholder = + FieldMiddlewareConfiguration placeholder = new(_ => _ => default, key: WellKnownMiddleware.SingleOrDefault); descriptor.Extend().Definition.MiddlewareDefinitions.Add(placeholder); @@ -57,7 +57,7 @@ private static IObjectFieldDescriptor ApplyMiddleware( context.TypeInspector.GetTypeRef(selectionType, TypeContext.Output); definition.Configurations.Add( - new CompleteConfiguration( + new CompleteConfiguration( (_, d) => { CompileMiddleware( @@ -75,8 +75,8 @@ private static IObjectFieldDescriptor ApplyMiddleware( private static void CompileMiddleware( Type type, - ObjectFieldDefinition definition, - FieldMiddlewareDefinition placeholder, + ObjectFieldConfiguration definition, + FieldMiddlewareConfiguration placeholder, Type middlewareDefinition) { var middlewareType = middlewareDefinition.MakeGenericType(type); diff --git a/src/HotChocolate/Data/src/Data/Projections/ProjectionTypeInterceptor.cs b/src/HotChocolate/Data/src/Data/Projections/ProjectionTypeInterceptor.cs index 32ba2bec3c5..30f2677d82f 100644 --- a/src/HotChocolate/Data/src/Data/Projections/ProjectionTypeInterceptor.cs +++ b/src/HotChocolate/Data/src/Data/Projections/ProjectionTypeInterceptor.cs @@ -24,7 +24,7 @@ public override void OnAfterResolveRootType( public override void OnAfterMakeExecutable( ITypeCompletionContext completionContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { if (ReferenceEquals(completionContext, _queryContext) && completionContext.Type is ObjectType { Fields: var fields, }) @@ -73,7 +73,7 @@ public override void OnAfterMakeExecutable( public override void OnAfterCompleteName( ITypeCompletionContext completionContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { if (definition is ObjectTypeDefinition objectTypeDefinition) { diff --git a/src/HotChocolate/Data/src/Data/Sorting/Convention/ISortConvention.cs b/src/HotChocolate/Data/src/Data/Sorting/Convention/ISortConvention.cs index 832dc3b2fd6..00ce85c2f5b 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/Convention/ISortConvention.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/Convention/ISortConvention.cs @@ -133,7 +133,7 @@ bool TryGetFieldHandler( bool TryGetOperationHandler( ITypeCompletionContext context, - EnumTypeDefinition typeDefinition, + EnumTypeConfiguration typeDefinition, SortEnumValueDefinition fieldDefinition, [NotNullWhen(true)] out ISortOperationHandler? handler); diff --git a/src/HotChocolate/Data/src/Data/Sorting/Convention/SortConvention.cs b/src/HotChocolate/Data/src/Data/Sorting/Convention/SortConvention.cs index 54ff81383f9..522c1be3bb2 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/Convention/SortConvention.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/Convention/SortConvention.cs @@ -252,7 +252,7 @@ public virtual void ConfigureField(IObjectFieldDescriptor descriptor) => public bool TryGetOperationHandler( ITypeCompletionContext context, - EnumTypeDefinition typeDefinition, + EnumTypeConfiguration typeDefinition, SortEnumValueDefinition fieldDefinition, [NotNullWhen(true)] out ISortOperationHandler? handler) { diff --git a/src/HotChocolate/Data/src/Data/Sorting/Convention/SortTypeInterceptor.cs b/src/HotChocolate/Data/src/Data/Sorting/Convention/SortTypeInterceptor.cs index 94c078b9a1b..eca4cfb7abf 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/Convention/SortTypeInterceptor.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/Convention/SortTypeInterceptor.cs @@ -14,7 +14,7 @@ public sealed class SortTypeInterceptor : TypeInterceptor public override void OnBeforeRegisterDependencies( ITypeDiscoveryContext discoveryContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { switch (definition) { @@ -29,7 +29,7 @@ public override void OnBeforeRegisterDependencies( public override void OnBeforeCompleteName( ITypeCompletionContext completionContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { switch (definition) { @@ -44,7 +44,7 @@ public override void OnBeforeCompleteName( public override void OnBeforeCompleteType( ITypeCompletionContext completionContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { switch (definition) { diff --git a/src/HotChocolate/Data/src/Data/Sorting/Expressions/Handlers/QueryableOperationHandlerBase.cs b/src/HotChocolate/Data/src/Data/Sorting/Expressions/Handlers/QueryableOperationHandlerBase.cs index 25001676bf2..20c75942b81 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/Expressions/Handlers/QueryableOperationHandlerBase.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/Expressions/Handlers/QueryableOperationHandlerBase.cs @@ -18,7 +18,7 @@ protected QueryableOperationHandlerBase(int operation) public override bool CanHandle( ITypeCompletionContext context, - EnumTypeDefinition typeDefinition, + EnumTypeConfiguration typeDefinition, SortEnumValueDefinition valueDefinition) { return valueDefinition.Operation == _operation; diff --git a/src/HotChocolate/Data/src/Data/Sorting/Extensions/SortingObjectFieldDescriptorExtensions.cs b/src/HotChocolate/Data/src/Data/Sorting/Extensions/SortingObjectFieldDescriptorExtensions.cs index bd2635c53a0..3ec5a8ae2c1 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/Extensions/SortingObjectFieldDescriptorExtensions.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/Extensions/SortingObjectFieldDescriptorExtensions.cs @@ -130,7 +130,7 @@ private static IObjectFieldDescriptor UseSortingInternal( ITypeSystemMember? sortTypeInstance, string? scope) { - FieldMiddlewareDefinition sortQuery = new(_ => _ => default, key: WellKnownMiddleware.Sorting); + FieldMiddlewareConfiguration sortQuery = new(_ => _ => default, key: WellKnownMiddleware.Sorting); var argumentPlaceholder = "_" + Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture); var fieldDefinition = descriptor.Extend().Definition; @@ -171,7 +171,7 @@ private static IObjectFieldDescriptor UseSortingInternal( scope); } - var argumentDefinition = new ArgumentDefinition + var argumentDefinition = new ArgumentConfiguration { Name = argumentPlaceholder, Type = argumentTypeReference, @@ -179,7 +179,7 @@ private static IObjectFieldDescriptor UseSortingInternal( }; argumentDefinition.Configurations.Add( - new CompleteConfiguration((context, def) => + new CompleteConfiguration((context, def) => { var namedType = context.GetType(argumentTypeReference); def.Type = TypeReference.Parse($"[{namedType.Name}!]"); @@ -192,7 +192,7 @@ private static IObjectFieldDescriptor UseSortingInternal( definition.Arguments.Add(argumentDefinition); definition.Configurations.Add( - new CompleteConfiguration( + new CompleteConfiguration( (context, def) => CompileMiddleware( context, @@ -206,7 +206,7 @@ private static IObjectFieldDescriptor UseSortingInternal( TypeDependencyFulfilled.Completed)); argumentDefinition.Configurations.Add( - new CompleteConfiguration( + new CompleteConfiguration( (context, argDef) => argDef.Name = context.GetSortConvention(scope).GetArgumentName(), argumentDefinition, ApplyConfigurationOn.BeforeNaming)); @@ -217,9 +217,9 @@ private static IObjectFieldDescriptor UseSortingInternal( private static void CompileMiddleware( ITypeCompletionContext context, - ObjectFieldDefinition definition, - ArgumentDefinition argumentDefinition, - FieldMiddlewareDefinition placeholder, + ObjectFieldConfiguration definition, + ArgumentConfiguration argumentDefinition, + FieldMiddlewareConfiguration placeholder, string? scope) { var resolvedType = context.GetType(argumentDefinition.Type!); diff --git a/src/HotChocolate/Data/src/Data/Sorting/Fields/SortField.cs b/src/HotChocolate/Data/src/Data/Sorting/Fields/SortField.cs index 730ed9fb74f..ba9b986037b 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/Fields/SortField.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/Fields/SortField.cs @@ -34,7 +34,7 @@ internal SortField(SortFieldDefinition definition, int index) protected override void OnCompleteField( ITypeCompletionContext context, ITypeSystemMember declaringMember, - InputFieldDefinition definition) + InputFieldConfiguration definition) { base.OnCompleteField(context, declaringMember, definition); diff --git a/src/HotChocolate/Data/src/Data/Sorting/ISortFieldDefinition.cs b/src/HotChocolate/Data/src/Data/Sorting/ISortFieldDefinition.cs index aaf13b7ce7b..d73ce4e7947 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/ISortFieldDefinition.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/ISortFieldDefinition.cs @@ -6,9 +6,9 @@ namespace HotChocolate.Data.Sorting; public interface ISortFieldDefinition - : IDefinition - , IHasDirectiveDefinition - , IHasIgnore + : ITypeSystemConfiguration + , IDirectiveConfigurationProvider + , IIgnoreConfiguration , IHasScope { public MemberInfo? Member { get; } diff --git a/src/HotChocolate/Data/src/Data/Sorting/SortEnumType.cs b/src/HotChocolate/Data/src/Data/Sorting/SortEnumType.cs index 23cee296560..945e6ed9165 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/SortEnumType.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/SortEnumType.cs @@ -22,7 +22,7 @@ public SortEnumType(Action configure) throw new ArgumentNullException(nameof(configure)); } - protected override EnumTypeDefinition CreateDefinition( + protected override EnumTypeConfiguration CreateDefinition( ITypeDiscoveryContext context) { var descriptor = SortEnumTypeDescriptor.FromSchemaType( @@ -42,7 +42,7 @@ protected virtual void Configure(ISortEnumTypeDescriptor descriptor) protected override bool TryCreateEnumValue( ITypeCompletionContext context, - EnumValueDefinition definition, + EnumValueConfiguration definition, [NotNullWhen(true)] out IEnumValue? enumValue) { if (definition is SortEnumValueDefinition sortDefinition) diff --git a/src/HotChocolate/Data/src/Data/Sorting/SortEnumTypeDefinition.cs b/src/HotChocolate/Data/src/Data/Sorting/SortEnumTypeDefinition.cs index cc8c21f3872..4d2bdb6bd0e 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/SortEnumTypeDefinition.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/SortEnumTypeDefinition.cs @@ -4,7 +4,7 @@ namespace HotChocolate.Data.Sorting; public class SortEnumTypeDefinition - : EnumTypeDefinition, + : EnumTypeConfiguration, IHasScope { public string? Scope { get; set; } diff --git a/src/HotChocolate/Data/src/Data/Sorting/SortEnumValueDefinition.cs b/src/HotChocolate/Data/src/Data/Sorting/SortEnumValueDefinition.cs index 89f75d853ee..cc8401fde42 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/SortEnumValueDefinition.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/SortEnumValueDefinition.cs @@ -2,7 +2,7 @@ namespace HotChocolate.Data.Sorting; -public class SortEnumValueDefinition : EnumValueDefinition +public class SortEnumValueDefinition : EnumValueConfiguration { public ISortOperationHandler Handler { get; set; } = default!; diff --git a/src/HotChocolate/Data/src/Data/Sorting/SortEnumValueDescriptor.cs b/src/HotChocolate/Data/src/Data/Sorting/SortEnumValueDescriptor.cs index b03e921a280..3694a55d6a9 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/SortEnumValueDescriptor.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/SortEnumValueDescriptor.cs @@ -27,7 +27,7 @@ protected SortEnumValueDescriptor( { } - protected internal new EnumValueDefinition Definition + protected internal new EnumValueConfiguration Definition { get { return base.Definition; } set { base.Definition = value; } diff --git a/src/HotChocolate/Data/src/Data/Sorting/SortFieldDefinition.cs b/src/HotChocolate/Data/src/Data/Sorting/SortFieldDefinition.cs index e6eb9732d9e..0898ef0a68a 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/SortFieldDefinition.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/SortFieldDefinition.cs @@ -5,7 +5,7 @@ namespace HotChocolate.Data.Sorting; public class SortFieldDefinition - : InputFieldDefinition + : InputFieldConfiguration , ISortFieldDefinition { public MemberInfo? Member { get; set; } diff --git a/src/HotChocolate/Data/src/Data/Sorting/SortFieldDescriptor.cs b/src/HotChocolate/Data/src/Data/Sorting/SortFieldDescriptor.cs index 8ef78d4ff55..255dabcd4bd 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/SortFieldDescriptor.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/SortFieldDescriptor.cs @@ -73,7 +73,7 @@ protected internal SortFieldDescriptor( protected set => base.Definition = value; } - internal InputFieldDefinition CreateFieldDefinition() => CreateDefinition(); + internal InputFieldConfiguration CreateFieldDefinition() => CreateDefinition(); protected override void OnCreateDefinition( SortFieldDefinition definition) diff --git a/src/HotChocolate/Data/src/Data/Sorting/SortInputType.cs b/src/HotChocolate/Data/src/Data/Sorting/SortInputType.cs index a8250713460..1744944efb9 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/SortInputType.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/SortInputType.cs @@ -24,7 +24,7 @@ public SortInputType(Action configure) public IExtendedType EntityType { get; private set; } = default!; - protected override InputObjectTypeDefinition CreateDefinition(ITypeDiscoveryContext context) + protected override InputObjectTypeConfiguration CreateDefinition(ITypeDiscoveryContext context) { if (Definition is null) { @@ -48,7 +48,7 @@ protected virtual void Configure(ISortInputTypeDescriptor descriptor) protected override void OnRegisterDependencies( ITypeDiscoveryContext context, - InputObjectTypeDefinition definition) + InputObjectTypeConfiguration definition) { base.OnRegisterDependencies(context, definition); if (definition is SortInputTypeDefinition {EntityType: { }, } sortDefinition) @@ -60,7 +60,7 @@ protected override void OnRegisterDependencies( protected override void OnCompleteType( ITypeCompletionContext context, - InputObjectTypeDefinition definition) + InputObjectTypeConfiguration definition) { base.OnCompleteType(context, definition); @@ -72,7 +72,7 @@ protected override void OnCompleteType( protected override FieldCollection OnCompleteFields( ITypeCompletionContext context, - InputObjectTypeDefinition definition) + InputObjectTypeConfiguration definition) { var fields = new InputField[definition.Fields.Count]; var index = 0; diff --git a/src/HotChocolate/Data/src/Data/Sorting/SortInputTypeDefinition.cs b/src/HotChocolate/Data/src/Data/Sorting/SortInputTypeDefinition.cs index c6a060d84f5..c5f126e646e 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/SortInputTypeDefinition.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/SortInputTypeDefinition.cs @@ -3,7 +3,7 @@ namespace HotChocolate.Data.Sorting; public class SortInputTypeDefinition - : InputObjectTypeDefinition + : InputObjectTypeConfiguration , ISortInputTypeDefinition { public Type? EntityType { get; set; } diff --git a/src/HotChocolate/Data/src/Data/Sorting/SortInputType`1.cs b/src/HotChocolate/Data/src/Data/Sorting/SortInputType`1.cs index a0858e5ad13..fa406666aa5 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/SortInputType`1.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/SortInputType`1.cs @@ -20,7 +20,7 @@ public SortInputType() _configure = Configure; } - protected override InputObjectTypeDefinition CreateDefinition( + protected override InputObjectTypeConfiguration CreateDefinition( ITypeDiscoveryContext context) { var descriptor = SortInputTypeDescriptor.New( diff --git a/src/HotChocolate/Data/src/Data/Sorting/Visitor/ISortOperationHandler.cs b/src/HotChocolate/Data/src/Data/Sorting/Visitor/ISortOperationHandler.cs index fb5e274f94f..276c274db5b 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/Visitor/ISortOperationHandler.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/Visitor/ISortOperationHandler.cs @@ -19,6 +19,6 @@ public interface ISortOperationHandler /// Returns true if the field can be handled bool CanHandle( ITypeCompletionContext context, - EnumTypeDefinition typeDefinition, + EnumTypeConfiguration typeDefinition, SortEnumValueDefinition valueDefinition); } diff --git a/src/HotChocolate/Data/src/Data/Sorting/Visitor/SortOperationHandler.cs b/src/HotChocolate/Data/src/Data/Sorting/Visitor/SortOperationHandler.cs index cb3be267ad6..0baffa64e31 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/Visitor/SortOperationHandler.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/Visitor/SortOperationHandler.cs @@ -29,6 +29,6 @@ public virtual bool TryHandleEnter( /// public abstract bool CanHandle( ITypeCompletionContext context, - EnumTypeDefinition typeDefinition, + EnumTypeConfiguration typeDefinition, SortEnumValueDefinition valueDefinition); } diff --git a/src/HotChocolate/Data/src/Data/ThrowHelper.cs b/src/HotChocolate/Data/src/Data/ThrowHelper.cs index bec66dbd465..3b1828b46dc 100644 --- a/src/HotChocolate/Data/src/Data/ThrowHelper.cs +++ b/src/HotChocolate/Data/src/Data/ThrowHelper.cs @@ -236,7 +236,7 @@ public static SchemaException SortInterceptor_NoFieldHandlerFoundForField( .Build()); public static SchemaException SortInterceptor_NoOperationHandlerFoundForValue( - EnumTypeDefinition type, + EnumTypeConfiguration type, SortEnumValueDefinition value) => new SchemaException( SchemaErrorBuilder.New() diff --git a/src/HotChocolate/Data/test/Data.Sorting.Tests/Mock/MatchAnyQueryableOperationHandler.cs b/src/HotChocolate/Data/test/Data.Sorting.Tests/Mock/MatchAnyQueryableOperationHandler.cs index 755d0abe416..265f979b755 100644 --- a/src/HotChocolate/Data/test/Data.Sorting.Tests/Mock/MatchAnyQueryableOperationHandler.cs +++ b/src/HotChocolate/Data/test/Data.Sorting.Tests/Mock/MatchAnyQueryableOperationHandler.cs @@ -9,6 +9,6 @@ public class MatchAnyQueryableOperationHandler { public override bool CanHandle( ITypeCompletionContext context, - EnumTypeDefinition typeDefinition, + EnumTypeConfiguration typeDefinition, SortEnumValueDefinition valueDefinition) => true; } diff --git a/src/HotChocolate/MongoDb/src/Data/Sorting/Handlers/MongoDbSortOperationHandlerBase.cs b/src/HotChocolate/MongoDb/src/Data/Sorting/Handlers/MongoDbSortOperationHandlerBase.cs index 0f38d5fc97f..0830dc53724 100644 --- a/src/HotChocolate/MongoDb/src/Data/Sorting/Handlers/MongoDbSortOperationHandlerBase.cs +++ b/src/HotChocolate/MongoDb/src/Data/Sorting/Handlers/MongoDbSortOperationHandlerBase.cs @@ -29,7 +29,7 @@ protected MongoDbSortOperationHandlerBase( /// public override bool CanHandle( ITypeCompletionContext context, - EnumTypeDefinition typeDefinition, + EnumTypeConfiguration typeDefinition, SortEnumValueDefinition valueDefinition) { return valueDefinition.Operation == _operation; diff --git a/src/HotChocolate/Core/src/Abstractions/Types/IInputType.cs b/src/HotChocolate/Primitives/src/Primitives/Types/IInputType.cs similarity index 77% rename from src/HotChocolate/Core/src/Abstractions/Types/IInputType.cs rename to src/HotChocolate/Primitives/src/Primitives/Types/IInputType.cs index 092f5d0c048..bb91cb7eedc 100644 --- a/src/HotChocolate/Core/src/Abstractions/Types/IInputType.cs +++ b/src/HotChocolate/Primitives/src/Primitives/Types/IInputType.cs @@ -1,9 +1,12 @@ namespace HotChocolate.Types; /// +/// /// Represents types that can be used as argument types or as variable types. /// These types essentially specify the data that can be passed into a GraphQL server. -/// +/// +/// /// Spec: https://spec.graphql.org/draft/#sec-Input-and-Output-Types +/// /// -public interface IInputType : IType, IHasRuntimeType; +public interface IInputType : IType; diff --git a/src/HotChocolate/Primitives/src/Primitives/Types/IOutputType.cs b/src/HotChocolate/Primitives/src/Primitives/Types/IOutputType.cs new file mode 100644 index 00000000000..39b8be7afc7 --- /dev/null +++ b/src/HotChocolate/Primitives/src/Primitives/Types/IOutputType.cs @@ -0,0 +1,11 @@ +namespace HotChocolate.Types; + +/// +/// +/// Represent a type that can be used as an output type in a GraphQL schema. +/// +/// +/// Spec: https://spec.graphql.org/draft/#sec-Input-and-Output-Types +/// +/// +public interface IOutputType : IType; diff --git a/src/HotChocolate/Primitives/src/Primitives/Types/IWrapperType.cs b/src/HotChocolate/Primitives/src/Primitives/Types/IWrapperType.cs new file mode 100644 index 00000000000..4daa45b741a --- /dev/null +++ b/src/HotChocolate/Primitives/src/Primitives/Types/IWrapperType.cs @@ -0,0 +1,12 @@ +namespace HotChocolate.Types; + +/// +/// Represents a GraphQL type that wraps another type e.g. non-null types or list types. +/// +public interface IWrapperType : IType +{ + /// + /// Gets the inner type. + /// + IType InnerType { get; } +} diff --git a/src/HotChocolate/Raven/src/Data/DocumentStoreParameterExpressionBuilder.cs b/src/HotChocolate/Raven/src/Data/DocumentStoreParameterExpressionBuilder.cs index 177a461c4d0..9be73ec4f39 100644 --- a/src/HotChocolate/Raven/src/Data/DocumentStoreParameterExpressionBuilder.cs +++ b/src/HotChocolate/Raven/src/Data/DocumentStoreParameterExpressionBuilder.cs @@ -23,7 +23,7 @@ public void ApplyConfiguration(ParameterInfo parameter, ObjectFieldDescriptor de if (descriptor.Extend().Definition is { ResultType: { } resultType, } definition && TryExtractEntityType(resultType, out var entityType)) { - var middleware = new FieldMiddlewareDefinition( + var middleware = new FieldMiddlewareConfiguration( Create(typeof(ToListMiddleware<>).MakeGenericType(entityType)), key: WellKnownMiddleware.ToList); diff --git a/src/HotChocolate/Spatial/src/Types/GeoJsonInputType.cs b/src/HotChocolate/Spatial/src/Types/GeoJsonInputType.cs index 4e272fcb3a4..400e4fe374a 100644 --- a/src/HotChocolate/Spatial/src/Types/GeoJsonInputType.cs +++ b/src/HotChocolate/Spatial/src/Types/GeoJsonInputType.cs @@ -17,7 +17,7 @@ protected GeoJsonInputType(GeoJsonGeometryType geometryType) protected override Func OnCompleteCreateInstance( ITypeCompletionContext context, - InputObjectTypeDefinition definition) + InputObjectTypeConfiguration definition) => CreateInstance; private object CreateInstance(object?[] fieldValues) @@ -25,7 +25,7 @@ private object CreateInstance(object?[] fieldValues) protected override Action OnCompleteGetFieldValues( ITypeCompletionContext context, - InputObjectTypeDefinition definition) + InputObjectTypeConfiguration definition) => GetFieldData; private void GetFieldData(object runtimeValue, object?[] fieldValues) diff --git a/src/HotChocolate/Spatial/src/Types/Transformation/GeometryTransformerInterceptor.cs b/src/HotChocolate/Spatial/src/Types/Transformation/GeometryTransformerInterceptor.cs index 077edfc2cd5..93f11d44274 100644 --- a/src/HotChocolate/Spatial/src/Types/Transformation/GeometryTransformerInterceptor.cs +++ b/src/HotChocolate/Spatial/src/Types/Transformation/GeometryTransformerInterceptor.cs @@ -18,7 +18,7 @@ internal class GeometryTransformerInterceptor : TypeInterceptor /// public override void OnBeforeCompleteType( ITypeCompletionContext completionContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { var convention = completionContext.GetSpatialConvention(); if (convention.TransformerFactory.HasCoordinateSystems() && @@ -34,10 +34,10 @@ public override void OnBeforeCompleteType( case ObjectTypeDefinition def: HandleObjectType(completionContext, def, convention); break; - case InputObjectTypeDefinition def: + case InputObjectTypeConfiguration def: HandleInputObjectType(completionContext, def, convention); break; - case DirectiveTypeDefinition def: + case DirectiveTypeConfiguration def: HandleDirectiveType(completionContext, def, convention); break; } @@ -46,7 +46,7 @@ public override void OnBeforeCompleteType( private static void HandleInputObjectType( ITypeCompletionContext completionContext, - InputObjectTypeDefinition definition, + InputObjectTypeConfiguration definition, ISpatialConvention convention) { foreach (var field in definition.Fields) @@ -64,7 +64,7 @@ private static void HandleInputObjectType( private static void HandleDirectiveType( ITypeCompletionContext completionContext, - DirectiveTypeDefinition definition, + DirectiveTypeConfiguration definition, ISpatialConvention convention) { foreach (var arg in definition.Arguments) diff --git a/src/HotChocolate/Spatial/test/Types.Tests/TransformationIntegrationTests.cs b/src/HotChocolate/Spatial/test/Types.Tests/TransformationIntegrationTests.cs index 8c723ec9716..3c6b62faf59 100644 --- a/src/HotChocolate/Spatial/test/Types.Tests/TransformationIntegrationTests.cs +++ b/src/HotChocolate/Spatial/test/Types.Tests/TransformationIntegrationTests.cs @@ -646,7 +646,7 @@ public class RoundTypeIntercetor : TypeInterceptor { public override void OnBeforeCompleteType( ITypeCompletionContext completionContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { if (definition is ObjectTypeDefinition o) { diff --git a/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Utilities/EntityTypeInterceptor.cs b/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Utilities/EntityTypeInterceptor.cs index d308c3a9d21..aefc0314506 100644 --- a/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Utilities/EntityTypeInterceptor.cs +++ b/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Utilities/EntityTypeInterceptor.cs @@ -22,7 +22,7 @@ public EntityTypeInterceptor( public override void OnBeforeCompleteType( ITypeCompletionContext completionContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { if (completionContext.Type is IComplexOutputType outputType && definition is not null) diff --git a/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Utilities/LeafTypeInterceptor.cs b/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Utilities/LeafTypeInterceptor.cs index 787e9a357c4..c399ecfba94 100644 --- a/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Utilities/LeafTypeInterceptor.cs +++ b/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Utilities/LeafTypeInterceptor.cs @@ -18,7 +18,7 @@ public LeafTypeInterceptor(Dictionary scalarInfos) public override void OnBeforeCompleteName( ITypeCompletionContext completionContext, - DefinitionBase definition) + TypeSystemConfiguration definition) { if (completionContext.Type is ILeafType leafType && definition is not null) { From a66e02be1f97c43b1e224f0a41dce8a5d6a2c93a Mon Sep 17 00:00:00 2001 From: Michael Staib Date: Tue, 15 Apr 2025 14:30:46 +0200 Subject: [PATCH 2/9] Completed definition -> configuration rename --- .../FederationTypeInterceptor.cs | 32 +++++++++---------- .../ExternalSetterExpressionHelper.cs | 2 +- .../Descriptors/EntityResolverDescriptor.cs | 2 +- .../Types/Directives/KeyAttribute.cs | 4 +-- .../V1/ExternalLegacySupportAttribute.cs | 2 +- .../ApolloFederation/Types/ServerFields.cs | 4 +-- .../V1/FieldSetTypeLegacySupportAttribute.cs | 2 +- .../Caching/CacheControlTypeInterceptor.cs | 6 ++-- .../CacheControlValidationTypeInterceptor.cs | 2 +- ...orizationTypeInterceptor.ObjectTypeInfo.cs | 4 +-- ...horizationTypeInterceptor.UnionTypeInfo.cs | 4 +-- .../AuthorizationTypeInterceptor.cs | 16 +++++----- ...uthorizeObjectFieldDescriptorExtensions.cs | 2 +- ...estExecutorBuilderExtensions.Middleware.cs | 2 +- .../RequirementsTypeInterceptor.cs | 4 +-- .../DataLoaderRootFieldTypeInterceptor.cs | 4 +-- .../ObjectFieldDataLoaderExtensions.cs | 4 +-- .../Fetching/SkipDataLoaderCacheAttribute.cs | 2 +- .../Types.CursorPagination/ConnectionType.cs | 16 +++++----- .../src/Types.CursorPagination/EdgeType.cs | 10 +++--- .../PagingObjectFieldDescriptorExtensions.cs | 4 +-- .../Extensions/UseConnectionAttribute.cs | 6 ++-- .../Core/src/Types.Errors/ErrorObjectType.cs | 4 +-- .../src/Types.Errors/ExceptionObjectType.cs | 2 +- .../src/Types.Json/FromJsonSchemaDirective.cs | 2 +- .../MutationConventionTypeInterceptor.cs | 12 +++---- .../src/Types.Mutations/MutationDirective.cs | 2 +- .../CollectionSegmentType~1.cs | 12 +++---- ...etPagingObjectFieldDescriptorExtensions.cs | 2 +- .../QueryConventionTypeInterceptor.cs | 10 +++--- .../Configuration/AggregateTypeInterceptor.cs | 4 +-- .../Types/Configuration/TypeInterceptor.cs | 4 +-- .../Types/Internal/TypeDependencyHelper.cs | 6 ++-- .../src/Types/Internal/TypeExtensionHelper.cs | 4 +-- .../IsSelectedParameterExpressionBuilder.cs | 4 +-- .../Core/src/Types/Schema.Initialization.cs | 10 +++--- src/HotChocolate/Core/src/Types/Schema.cs | 2 +- .../Types/SemanticNonNullTypeInterceptor.cs | 6 ++-- ...StoreGlobalPagingOptionsTypeInterceptor.cs | 2 +- .../Attributes/DirectiveTypeAttribute.cs | 2 +- .../Attributes/ExtendObjectTypeAttribute.cs | 6 ++-- .../Attributes/InputObjectTypeAttribute.cs | 2 +- .../Attributes/InterfaceTypeAttribute.cs | 2 +- .../Types/Attributes/MutationTypeAttribute.cs | 2 +- .../Types/Attributes/ObjectTypeAttribute.cs | 2 +- .../Types/Attributes/QueryTypeAttribute.cs | 2 +- .../Attributes/SubscriptionTypeAttribute.cs | 2 +- .../UseListPostProcessorAttribute.cs | 2 +- ...UseResolverResultPostProcessorAttribute.cs | 2 +- .../Types/Contracts/IHasTypeDefinition.cs | 2 +- .../CompletedDependencyDescriptor~1.cs | 2 +- .../Descriptors/Contracts/IDescriptor.cs | 4 +-- .../Contracts/IDescriptorExtension~1.cs | 2 +- .../Contracts/IObjectTypeDescriptor.cs | 2 +- .../Contracts/IObjectTypeDescriptor~1.cs | 2 +- .../Contracts/IScalarTypeDescriptor.cs | 2 +- .../Contracts/ISchemaTypeDescriptor.cs | 2 +- .../Contracts/IUnionTypeDescriptor.cs | 2 +- .../Definitions/EnumTypeConfiguration.cs | 2 +- .../Definitions/EnumValueConfiguration.cs | 2 +- .../Definitions/IConfigurationFactory.cs | 12 +++++++ .../Definitions/IConfigurationFactory~1.cs | 16 ++++++++++ .../Definitions/IDefinitionFactory.cs | 6 ---- .../Definitions/IDefinitionFactory~1.cs | 8 ----- ...ypeDefinition.cs => ITypeConfiguration.cs} | 2 +- .../InputObjectTypeConfiguration.cs | 2 +- .../InterfaceFieldConfiguration.cs | 4 +-- .../Definitions/InterfaceTypeConfiguration.cs | 6 ++-- .../Definitions/ObjectFieldConfiguration.cs | 4 +-- ...finition.cs => ObjectTypeConfiguration.cs} | 16 +++++----- ... OnCompleteTypeSystemConfigurationTask.cs} | 15 +++++---- ...=> OnCreateTypeSystemConfigurationTask.cs} | 8 ++--- ...finition.cs => ScalarTypeConfiguration.cs} | 2 +- ...finition.cs => SchemaTypeConfiguration.cs} | 4 +-- ...finitionBase~1.cs => TypeConfiguration.cs} | 10 +++--- .../Definitions/UnionTypeDefinition.cs | 10 +++--- .../Types/Descriptors/DescriptorBase~1.cs | 18 +++++------ .../Descriptors/DirectiveTypeDescriptor.cs | 2 +- .../Descriptors/DirectiveTypeDescriptor~1.cs | 2 +- .../Types/Descriptors/EnumTypeDescriptor.cs | 4 +-- .../Extensions/DescriptorExtensions.cs | 4 +-- .../Descriptors/InputObjectTypeDescriptor.cs | 4 +-- .../Descriptors/InterfaceTypeDescriptor.cs | 2 +- .../Descriptors/InterfaceTypeDescriptor~1.cs | 2 +- .../NamedDependencyDescriptor~1.cs | 2 +- .../Types/Descriptors/ObjectTypeDescriptor.cs | 16 +++++----- .../Descriptors/ObjectTypeDescriptorBase~1.cs | 2 +- .../Descriptors/ObjectTypeDescriptor~1.cs | 2 +- .../Descriptors/OutputFieldDescriptorBase.cs | 2 +- .../Types/Descriptors/ScalarTypeDescriptor.cs | 6 ++-- .../Types/Descriptors/SchemaTypeDescriptor.cs | 8 ++--- .../Types/Descriptors/UnionTypeDescriptor.cs | 10 +++--- .../Types/DirectiveType.Initialization.cs | 2 +- .../Core/src/Types/Types/DirectiveType~1.cs | 2 +- .../Directives/TagDirectiveConfigAttribute.cs | 2 +- .../Directives/TagDirectiveExtensions.cs | 4 +-- .../Types/Types/EnumType.Initialization.cs | 2 +- .../Core/src/Types/Types/EnumTypeExtension.cs | 2 +- .../Core/src/Types/Types/EnumType~1.cs | 2 +- .../ObjectFieldDescriptorExtensions.cs | 4 +-- .../Types/Factories/ObjectTypeFactory.cs | 6 ++-- .../Factories/SchemaFirstTypeInterceptor.cs | 2 +- .../Types/Types/Factories/UnionTypeFactory.cs | 4 +-- .../Types/Helpers/FieldDescriptorUtilities.cs | 2 +- .../src/Types/Types/Helpers/TypeNameHelper.cs | 8 ++--- .../Types/InputObjectType.Initialization.cs | 2 +- .../Types/Types/InputObjectTypeExtension.cs | 2 +- .../Core/src/Types/Types/InputObjectType~1.cs | 2 +- .../Interceptors/FlagEnumTypeInterceptor.cs | 4 +-- .../InterfaceCompletionTypeInterceptor.cs | 6 ++-- .../MiddlewareValidationTypeInterceptor.cs | 2 +- .../Interceptors/ResolverTypeInterceptor.cs | 30 ++++++++--------- .../TypeValidationTypeInterceptor.cs | 8 ++--- .../Types/InterfaceType.Initialization.cs | 2 +- .../src/Types/Types/InterfaceTypeExtension.cs | 2 +- .../Core/src/Types/Types/InterfaceType~1.cs | 2 +- .../Introspection/IntrospectionFields.cs | 4 +-- .../IntrospectionTypeInterceptor.cs | 8 ++--- .../Types/Introspection/__AppliedDirective.cs | 4 +-- .../Types/Types/Introspection/__Directive.cs | 4 +-- .../Introspection/__DirectiveArgument.cs | 4 +-- .../Types/Types/Introspection/__EnumValue.cs | 4 +-- .../src/Types/Types/Introspection/__Field.cs | 4 +-- .../Types/Types/Introspection/__InputValue.cs | 4 +-- .../src/Types/Types/Introspection/__Schema.cs | 4 +-- .../src/Types/Types/Introspection/__Type.cs | 4 +-- .../Core/src/Types/Types/NamedTypeBase.cs | 6 ++-- .../src/Types/Types/NamedTypeExtensionBase.cs | 2 +- .../Types/Types/ObjectType.Initialization.cs | 18 +++++------ .../Core/src/Types/Types/ObjectType.cs | 4 +-- .../src/Types/Types/ObjectTypeExtension.cs | 14 ++++---- .../src/Types/Types/ObjectTypeExtension~1.cs | 4 +-- .../Core/src/Types/Types/ObjectType~1.cs | 4 +-- .../Types/Types/Pagination/PagingHelper.cs | 4 +-- .../Types/Relay/Attributes/NodeAttribute.cs | 2 +- .../Types/Relay/Descriptors/NodeDescriptor.cs | 2 +- .../Relay/Descriptors/NodeDescriptorBase.cs | 6 ++-- .../Relay/Descriptors/NodeDescriptor~1.cs | 8 ++--- .../Relay/Extensions/RelayIdFieldHelpers.cs | 4 +-- .../Types/Relay/NodeFieldTypeInterceptor.cs | 4 +-- .../Relay/NodeIdSerializerTypeInterceptor.cs | 2 +- .../Relay/NodeResolverTypeInterceptor.cs | 6 ++-- .../Types/Relay/QueryFieldTypeInterceptor.cs | 8 ++--- .../Core/src/Types/Types/Scalars/AnyType.cs | 2 +- .../Scalars/ScalarType.Initialization.cs | 8 ++--- .../src/Types/Types/Scalars/ScalarType.cs | 2 +- .../Types/Types/StaticObjectTypeExtension.cs | 2 +- .../src/Types/Types/TypeSystemObjectBase~1.cs | 2 +- .../Core/src/Types/Types/UnionType.cs | 16 +++++----- .../src/Types/Types/UnionTypeExtension.cs | 10 +++--- .../Core/src/Types/Types/UnionType~1.cs | 4 +-- .../Configuration/TypeModuleTests.cs | 4 +-- .../Errors/ErrorBehaviorTests.cs | 6 ++-- .../AnnotationBasedMutations.cs | 4 +-- .../TypeInitializationOrderTests.cs | 2 +- .../TypeScopeInterceptorTests.cs | 2 +- .../Resolvers/ResolverCompilerTests.cs | 2 +- .../test/Types.Tests/SchemaBuilderTests.cs | 2 +- .../Descriptors/ArgumentDescriptorTests.cs | 28 ++++++++-------- .../DirectiveArgumentDescriptorTests.cs | 2 +- .../Descriptors/DirectiveDescriptorTests.cs | 24 +++++++------- .../Descriptors/EnumTypeDescriptorTests.cs | 14 ++++---- .../Descriptors/InputFieldDescriptorTests.cs | 28 ++++++++-------- .../InputObjectTypeDescriptorTests.cs | 4 +-- .../InterfaceTypeDescriptorTests.cs | 4 +-- .../Descriptors/ObjectFieldDescriptorTests.cs | 20 ++++++------ .../Descriptors/ObjectTypeDescriptorTests.cs | 20 ++++++------ .../Types/Relay/IdAttributeTests.cs | 2 +- .../src/CostAnalysis/CostTypeInterceptor.cs | 4 +-- .../Convention/FilterTypeInterceptor.cs | 4 +-- .../Expressions/QueryableFilterProvider.cs | 2 +- .../FilterObjectFieldDescriptorExtensions.cs | 6 ++-- .../Data/src/Data/Filters/Fields/AndField.cs | 2 +- .../Data/src/Data/Filters/Fields/OrField.cs | 2 +- .../src/Data/Filters/FilterFieldDescriptor.cs | 2 +- .../Data/src/Data/Filters/FilterInputType.cs | 2 +- .../Data/Filters/FilterInputTypeDescriptor.cs | 4 +-- .../Filters/FilterInputTypeDescriptor`1.cs | 2 +- .../src/Data/Filters/FilterInputType`1.cs | 2 +- .../Filters/FilterOperationFieldDescriptor.cs | 2 +- .../Types/StringOperationFilterInputType.cs | 2 +- ...ojectionObjectFieldDescriptorExtensions.cs | 6 ++-- ...rDefaultObjectFieldDescriptorExtensions.cs | 4 +-- .../Projections/ProjectionTypeInterceptor.cs | 4 +-- .../Data/Sorting/Convention/SortConvention.cs | 2 +- .../Sorting/Convention/SortTypeInterceptor.cs | 8 ++--- .../Expressions/QueryableSortProvider.cs | 2 +- .../SortingObjectFieldDescriptorExtensions.cs | 8 ++--- .../Data/src/Data/Sorting/SortEnumType.cs | 2 +- .../Data/Sorting/SortEnumTypeDescriptor.cs | 2 +- .../src/Data/Sorting/SortFieldDescriptor.cs | 2 +- .../Data/src/Data/Sorting/SortInputType.cs | 2 +- .../Data/Sorting/SortInputTypeDescriptor.cs | 2 +- .../Data/Sorting/SortInputTypeDescriptor`1.cs | 2 +- .../Data/src/Data/Sorting/SortInputType`1.cs | 2 +- .../Convention/SortConventionTests.cs | 2 +- ...DocumentStoreParameterExpressionBuilder.cs | 2 +- .../GeometryTransformerInterceptor.cs | 6 ++-- .../TransformationIntegrationTests.cs | 2 +- 199 files changed, 525 insertions(+), 512 deletions(-) create mode 100644 src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IConfigurationFactory.cs create mode 100644 src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IConfigurationFactory~1.cs delete mode 100644 src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IDefinitionFactory.cs delete mode 100644 src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IDefinitionFactory~1.cs rename src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/{ITypeDefinition.cs => ITypeConfiguration.cs} (95%) rename src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/{ObjectTypeDefinition.cs => ObjectTypeConfiguration.cs} (95%) rename src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/{CompleteConfiguration.cs => OnCompleteTypeSystemConfigurationTask.cs} (86%) rename src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/{CreateConfiguration.cs => OnCreateTypeSystemConfigurationTask.cs} (83%) rename src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/{ScalarTypeDefinition.cs => ScalarTypeConfiguration.cs} (75%) rename src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/{SchemaTypeDefinition.cs => SchemaTypeConfiguration.cs} (87%) rename src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/{TypeDefinitionBase~1.cs => TypeConfiguration.cs} (88%) diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationTypeInterceptor.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationTypeInterceptor.cs index f562639cde2..7e0543e49fc 100644 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationTypeInterceptor.cs +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationTypeInterceptor.cs @@ -43,7 +43,7 @@ internal sealed class FederationTypeInterceptor : TypeInterceptor private TypeRegistry _typeRegistry = default!; private ObjectType _queryType = default!; private ExtendedTypeDirectiveReference _keyDirectiveReference = default!; - private SchemaTypeDefinition _schemaTypeDefinition = default!; + private SchemaTypeConfiguration _schemaTypeDefinition = default!; private RegisteredType _schemaType = default!; private bool _registeredTypes; @@ -66,7 +66,7 @@ public override void OnAfterInitialize( TypeSystemConfiguration definition) { if (discoveryContext.Type is ObjectType objectType && - definition is ObjectTypeDefinition objectTypeDefinition) + definition is ObjectTypeConfiguration objectTypeDefinition) { ApplyMethodLevelReferenceResolvers( objectType, @@ -116,7 +116,7 @@ public override void OnBeforeCompleteName( ITypeCompletionContext completionContext, TypeSystemConfiguration definition) { - if (definition is SchemaTypeDefinition schemaDef) + if (definition is SchemaTypeConfiguration schemaDef) { _schemaType = (RegisteredType)completionContext; _schemaTypeDefinition = schemaDef; @@ -128,13 +128,13 @@ public override void OnAfterCompleteName( TypeSystemConfiguration definition) { if (_context.GetFederationVersion() == FederationVersion.Federation10 - || definition is not ITypeDefinition and not DirectiveTypeConfiguration) + || definition is not ITypeConfiguration and not DirectiveTypeConfiguration) { return; } // if we find a PagingInfo we will make all fields sharable. - if (definition is ObjectTypeDefinition typeDef + if (definition is ObjectTypeConfiguration typeDef && typeDef.Name.Equals(PageInfoType.Names.PageInfo)) { foreach (var fieldDef in typeDef.Fields) @@ -316,7 +316,7 @@ private void RegisterExportedDirectives() public override void OnAfterResolveRootType( ITypeCompletionContext completionContext, - ObjectTypeDefinition definition, + ObjectTypeConfiguration definition, OperationType operationType) { if (operationType is OperationType.Query) @@ -343,17 +343,17 @@ public override void OnAfterMakeExecutable( TypeSystemConfiguration definition) { if (completionContext.Type is ObjectType type && - definition is ObjectTypeDefinition typeDef) + definition is ObjectTypeConfiguration typeDef) { CompleteExternalFieldSetters(type, typeDef); CompleteReferenceResolver(typeDef); } } - private void CompleteExternalFieldSetters(ObjectType type, ObjectTypeDefinition typeDef) + private void CompleteExternalFieldSetters(ObjectType type, ObjectTypeConfiguration typeDef) => ExternalSetterExpressionHelper.TryAddExternalSetter(type, typeDef); - private void CompleteReferenceResolver(ObjectTypeDefinition typeDef) + private void CompleteReferenceResolver(ObjectTypeConfiguration typeDef) { IReadOnlyList resolvers; { @@ -418,7 +418,7 @@ private void AddServiceTypeToQueryType( return; } - var objectTypeDefinition = (ObjectTypeDefinition)definition!; + var objectTypeDefinition = (ObjectTypeConfiguration)definition!; objectTypeDefinition.Fields.Add(ServerFields.CreateServiceField(_context)); if (_entityTypes.Count > 0) { @@ -428,7 +428,7 @@ private void AddServiceTypeToQueryType( private void ApplyMethodLevelReferenceResolvers( ObjectType objectType, - ObjectTypeDefinition objectTypeDefinition) + ObjectTypeConfiguration objectTypeDefinition) { if (objectType.RuntimeType == typeof(object)) { @@ -460,12 +460,12 @@ private void ApplyMethodLevelReferenceResolvers( } // This seems to re-detect the entity resolver and save it into the context data. - descriptor.CreateDefinition(); + descriptor.CreateConfiguration(); } private void AddToUnionIfHasTypeLevelKeyDirective( ObjectType objectType, - ObjectTypeDefinition objectTypeDefinition) + ObjectTypeConfiguration objectTypeDefinition) { if (objectTypeDefinition.Directives.FirstOrDefault(d => d.Value is KeyDirective) is { } keyDirective && ((KeyDirective)keyDirective.Value).Resolvable) @@ -483,7 +483,7 @@ private void AddToUnionIfHasTypeLevelKeyDirective( private void AggregatePropertyLevelKeyDirectives( ObjectType objectType, - ObjectTypeDefinition objectTypeDefinition, + ObjectTypeConfiguration objectTypeDefinition, ITypeDiscoveryContext discoveryContext) { // if we find key markers on our fields, we need to construct the key directive @@ -552,7 +552,7 @@ private void AddMemberTypesToTheEntityUnionType( TypeSystemConfiguration? definition) { if (completionContext.Type is _EntityType && - definition is UnionTypeDefinition unionTypeDefinition) + definition is UnionTypeConfiguration unionTypeDefinition) { foreach (var objectType in _entityTypes) { @@ -562,7 +562,7 @@ private void AddMemberTypesToTheEntityUnionType( } private void AddKeyDirective( - ObjectTypeDefinition objectTypeDefinition, + ObjectTypeConfiguration objectTypeDefinition, string fieldSet, bool resolvable) { diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Resolvers/ExternalSetterExpressionHelper.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Resolvers/ExternalSetterExpressionHelper.cs index 6f86592ad3f..d3b6dceb317 100644 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Resolvers/ExternalSetterExpressionHelper.cs +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Resolvers/ExternalSetterExpressionHelper.cs @@ -24,7 +24,7 @@ internal static class ExternalSetterExpressionHelper private static readonly ParameterExpression _data = Parameter(typeof(IValueNode), "data"); private static readonly ParameterExpression _entity = Parameter(typeof(object), "entity"); - public static void TryAddExternalSetter(ObjectType type, ObjectTypeDefinition typeDef) + public static void TryAddExternalSetter(ObjectType type, ObjectTypeConfiguration typeDef) { List? block = null; diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Descriptors/EntityResolverDescriptor.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Descriptors/EntityResolverDescriptor.cs index bc08e05a68f..35449f29707 100644 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Descriptors/EntityResolverDescriptor.cs +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Descriptors/EntityResolverDescriptor.cs @@ -41,7 +41,7 @@ internal EntityResolverDescriptor( Definition.EntityType = entityType; } - private void OnCompleteDefinition(ObjectTypeDefinition definition) + private void OnCompleteDefinition(ObjectTypeConfiguration definition) { if (Definition.ResolverDefinition is not null) { diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/KeyAttribute.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/KeyAttribute.cs index f656baef4d9..84fc88dbf8a 100644 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/KeyAttribute.cs +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/KeyAttribute.cs @@ -126,11 +126,11 @@ private void ConfigureField(MemberInfo member, IDescriptor descriptor) switch (descriptor) { case IObjectFieldDescriptor fieldDesc: - fieldDesc.Extend().Definition.ContextData.TryAdd(KeyMarker, Resolvable); + fieldDesc.Extend().Configuration.ContextData.TryAdd(KeyMarker, Resolvable); break; case IInterfaceFieldDescriptor fieldDesc: - fieldDesc.Extend().Definition.ContextData.TryAdd(KeyMarker, Resolvable); + fieldDesc.Extend().Configuration.ContextData.TryAdd(KeyMarker, Resolvable); break; } } diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/V1/ExternalLegacySupportAttribute.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/V1/ExternalLegacySupportAttribute.cs index b4d89102418..614d894a2fa 100644 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/V1/ExternalLegacySupportAttribute.cs +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Directives/V1/ExternalLegacySupportAttribute.cs @@ -13,7 +13,7 @@ protected override void OnConfigure( if (descriptor.GetFederationVersion() == FederationVersion.Federation10) { var desc = (IDirectiveTypeDescriptor)descriptor; - desc.Extend().Definition.Locations = DirectiveLocation.FieldDefinition; + desc.Extend().Configuration.Locations = DirectiveLocation.FieldDefinition; } } } diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/ServerFields.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/ServerFields.cs index 60967e53713..4392650b435 100644 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/ServerFields.cs +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/ServerFields.cs @@ -18,7 +18,7 @@ internal static ObjectFieldConfiguration CreateServiceField(IDescriptorContext c static _Service Resolve(IResolverContext ctx) => _service; - return descriptor.CreateDefinition(); + return descriptor.CreateConfiguration(); } internal static ObjectFieldConfiguration CreateEntitiesField(IDescriptorContext context) @@ -37,6 +37,6 @@ internal static ObjectFieldConfiguration CreateEntitiesField(IDescriptorContext WellKnownArgumentNames.Representations), c)); - return descriptor.CreateDefinition(); + return descriptor.CreateConfiguration(); } } diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/V1/FieldSetTypeLegacySupportAttribute.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/V1/FieldSetTypeLegacySupportAttribute.cs index 9c8fd19b1ce..b1af97c3a05 100644 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/V1/FieldSetTypeLegacySupportAttribute.cs +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/V1/FieldSetTypeLegacySupportAttribute.cs @@ -12,7 +12,7 @@ protected override void OnConfigure( // federation v1 uses a different name for the scalar. if (descriptor.GetFederationVersion() == FederationVersion.Federation10) { - descriptor.Extend().Definition.Name = FederationTypeNames.LegacyFieldSetType_Name; + descriptor.Extend().Configuration.Name = FederationTypeNames.LegacyFieldSetType_Name; } } } diff --git a/src/HotChocolate/Caching/src/Caching/CacheControlTypeInterceptor.cs b/src/HotChocolate/Caching/src/Caching/CacheControlTypeInterceptor.cs index 586aa9f626b..490dccffc03 100644 --- a/src/HotChocolate/Caching/src/Caching/CacheControlTypeInterceptor.cs +++ b/src/HotChocolate/Caching/src/Caching/CacheControlTypeInterceptor.cs @@ -12,7 +12,7 @@ internal sealed class CacheControlTypeInterceptor( ICacheControlOptionsAccessor accessor) : TypeInterceptor { - private readonly List<(RegisteredType Type, ObjectTypeDefinition TypeDef)> _types = []; + private readonly List<(RegisteredType Type, ObjectTypeConfiguration TypeDef)> _types = []; private readonly ICacheControlOptions _cacheControlOptions = accessor.CacheControl; private TypeDependency? _cacheControlDependency; @@ -25,7 +25,7 @@ public override void OnBeforeCompleteName( return; } - if (completionContext.Type is ObjectType && definition is ObjectTypeDefinition typeDef) + if (completionContext.Type is ObjectType && definition is ObjectTypeConfiguration typeDef) { _types.Add(((RegisteredType)completionContext, typeDef)); } @@ -39,7 +39,7 @@ public override void OnAfterMergeTypeExtensions() } } - private void TryApplyDefaults(RegisteredType type, ObjectTypeDefinition objectDef) + private void TryApplyDefaults(RegisteredType type, ObjectTypeConfiguration objectDef) { if (!_cacheControlOptions.Enable || !_cacheControlOptions.ApplyDefaults) { diff --git a/src/HotChocolate/Caching/src/Caching/CacheControlValidationTypeInterceptor.cs b/src/HotChocolate/Caching/src/Caching/CacheControlValidationTypeInterceptor.cs index 66d25133c9e..516cf908937 100644 --- a/src/HotChocolate/Caching/src/Caching/CacheControlValidationTypeInterceptor.cs +++ b/src/HotChocolate/Caching/src/Caching/CacheControlValidationTypeInterceptor.cs @@ -12,7 +12,7 @@ internal sealed class CacheControlValidationTypeInterceptor : TypeInterceptor public override void OnAfterResolveRootType( ITypeCompletionContext completionContext, - ObjectTypeDefinition definition, + ObjectTypeConfiguration definition, OperationType operationType) { if (operationType is OperationType.Query) diff --git a/src/HotChocolate/Core/src/Authorization/AuthorizationTypeInterceptor.ObjectTypeInfo.cs b/src/HotChocolate/Core/src/Authorization/AuthorizationTypeInterceptor.ObjectTypeInfo.cs index f1ff07cb0f9..5d81cdeca99 100644 --- a/src/HotChocolate/Core/src/Authorization/AuthorizationTypeInterceptor.ObjectTypeInfo.cs +++ b/src/HotChocolate/Core/src/Authorization/AuthorizationTypeInterceptor.ObjectTypeInfo.cs @@ -6,9 +6,9 @@ namespace HotChocolate.Authorization; internal sealed partial class AuthorizationTypeInterceptor { - private sealed class ObjectTypeInfo : TypeInfo + private sealed class ObjectTypeInfo : TypeInfo { - public ObjectTypeInfo(ITypeCompletionContext context, ObjectTypeDefinition typeDef) + public ObjectTypeInfo(ITypeCompletionContext context, ObjectTypeConfiguration typeDef) : base(context, typeDef) { TypeRef = TypeReg.TypeReference; diff --git a/src/HotChocolate/Core/src/Authorization/AuthorizationTypeInterceptor.UnionTypeInfo.cs b/src/HotChocolate/Core/src/Authorization/AuthorizationTypeInterceptor.UnionTypeInfo.cs index aa5b27ace2e..1820faf50d5 100644 --- a/src/HotChocolate/Core/src/Authorization/AuthorizationTypeInterceptor.UnionTypeInfo.cs +++ b/src/HotChocolate/Core/src/Authorization/AuthorizationTypeInterceptor.UnionTypeInfo.cs @@ -5,9 +5,9 @@ namespace HotChocolate.Authorization; internal sealed partial class AuthorizationTypeInterceptor { - private sealed class UnionTypeInfo : TypeInfo + private sealed class UnionTypeInfo : TypeInfo { - public UnionTypeInfo(ITypeCompletionContext context, UnionTypeDefinition typeDef) + public UnionTypeInfo(ITypeCompletionContext context, UnionTypeConfiguration typeDef) : base(context, typeDef) { } } } diff --git a/src/HotChocolate/Core/src/Authorization/AuthorizationTypeInterceptor.cs b/src/HotChocolate/Core/src/Authorization/AuthorizationTypeInterceptor.cs index dbc5b9a2f4f..55b50ce11e2 100644 --- a/src/HotChocolate/Core/src/Authorization/AuthorizationTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Authorization/AuthorizationTypeInterceptor.cs @@ -50,7 +50,7 @@ internal override void OnBeforeCreateSchemaInternal( { // we capture the schema context data before everything else so that we can // set a marker if the authorization validation rules need to be executed. - schemaBuilder.SetSchema(d => _schemaContextData = d.Extend().Definition.ContextData); + schemaBuilder.SetSchema(d => _schemaContextData = d.Extend().Configuration.ContextData); } private ITypeCompletionContext _tc = default!; @@ -63,13 +63,13 @@ public override void OnBeforeCompleteName( switch (completionContext.Type) { // at this point we collect object types so we can check if they need to be authorized. - case ObjectType when definition is ObjectTypeDefinition objectTypeDef: + case ObjectType when definition is ObjectTypeConfiguration objectTypeDef: _objectTypes.Add(new ObjectTypeInfo(completionContext, objectTypeDef)); break; // also we collect union types so we can see if a union exposes // an authorized object type. - case UnionType when definition is UnionTypeDefinition unionTypeDef: + case UnionType when definition is UnionTypeConfiguration unionTypeDef: _unionTypes.Add(new UnionTypeInfo(completionContext, unionTypeDef)); break; @@ -85,7 +85,7 @@ public override void OnBeforeCompleteName( public override void OnAfterResolveRootType( ITypeCompletionContext completionContext, - ObjectTypeDefinition definition, + ObjectTypeConfiguration definition, OperationType operationType) { if (operationType is OperationType.Query) @@ -128,7 +128,7 @@ public override void OnBeforeCompleteMetadata( // last in the initialization we need to intercept the query type and ensure that // authorization configuration is applied to the special introspection and node fields. if (ReferenceEquals(_queryContext, completionContext) && - definition is ObjectTypeDefinition typeDef) + definition is ObjectTypeConfiguration typeDef) { var state = _state ?? throw ThrowHelper.StateNotInitialized(); HandleSpecialQueryFields(new ObjectTypeInfo(completionContext, typeDef), state); @@ -308,7 +308,7 @@ private void HandleSpecialQueryFields(ObjectTypeInfo type, State state) var descriptor = ObjectFieldDescriptor.From(_context, fieldDef); options.ConfigureTypeField?.Invoke(descriptor); - descriptor.CreateDefinition(); + descriptor.CreateConfiguration(); } else if (fieldDef.Name.EqualsOrdinal(IntrospectionFields.Schema)) { @@ -319,7 +319,7 @@ private void HandleSpecialQueryFields(ObjectTypeInfo type, State state) var descriptor = ObjectFieldDescriptor.From(_context, fieldDef); options.ConfigureSchemaField?.Invoke(descriptor); - descriptor.CreateDefinition(); + descriptor.CreateConfiguration(); } else if (fieldDef.IsNodeField()) { @@ -330,7 +330,7 @@ private void HandleSpecialQueryFields(ObjectTypeInfo type, State state) var descriptor = ObjectFieldDescriptor.From(_context, fieldDef); options.ConfigureNodeFields?.Invoke(descriptor); - descriptor.CreateDefinition(); + descriptor.CreateConfiguration(); } } } diff --git a/src/HotChocolate/Core/src/Authorization/Extensions/AuthorizeObjectFieldDescriptorExtensions.cs b/src/HotChocolate/Core/src/Authorization/Extensions/AuthorizeObjectFieldDescriptorExtensions.cs index 25d86f7bd44..0dfc202c32a 100644 --- a/src/HotChocolate/Core/src/Authorization/Extensions/AuthorizeObjectFieldDescriptorExtensions.cs +++ b/src/HotChocolate/Core/src/Authorization/Extensions/AuthorizeObjectFieldDescriptorExtensions.cs @@ -109,7 +109,7 @@ public static IObjectFieldDescriptor AllowAnonymous( } descriptor.Directive(AllowAnonymousDirectiveType.Names.AllowAnonymous); - descriptor.Extend().Definition.ContextData[WellKnownContextData.AllowAnonymous] = true; + descriptor.Extend().Configuration.ContextData[WellKnownContextData.AllowAnonymous] = true; return descriptor; } } diff --git a/src/HotChocolate/Core/src/Execution/DependencyInjection/SchemaRequestExecutorBuilderExtensions.Middleware.cs b/src/HotChocolate/Core/src/Execution/DependencyInjection/SchemaRequestExecutorBuilderExtensions.Middleware.cs index 2f464321dd1..42d3b934429 100644 --- a/src/HotChocolate/Core/src/Execution/DependencyInjection/SchemaRequestExecutorBuilderExtensions.Middleware.cs +++ b/src/HotChocolate/Core/src/Execution/DependencyInjection/SchemaRequestExecutorBuilderExtensions.Middleware.cs @@ -149,7 +149,7 @@ public override void OnAfterCompleteName( return; } - if (definition is not ObjectTypeDefinition def) + if (definition is not ObjectTypeConfiguration def) { return; } diff --git a/src/HotChocolate/Core/src/Execution/Requirements/RequirementsTypeInterceptor.cs b/src/HotChocolate/Core/src/Execution/Requirements/RequirementsTypeInterceptor.cs index 0ed9b7a0f70..7a2d98cb0ce 100644 --- a/src/HotChocolate/Core/src/Execution/Requirements/RequirementsTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Execution/Requirements/RequirementsTypeInterceptor.cs @@ -13,7 +13,7 @@ public override void OnBeforeCompleteName( ITypeCompletionContext completionContext, TypeSystemConfiguration definition) { - if (definition is SchemaTypeDefinition schema) + if (definition is SchemaTypeConfiguration schema) { schema.Features.Set(_metadata); } @@ -23,7 +23,7 @@ public override void OnBeforeCompleteType( ITypeCompletionContext completionContext, TypeSystemConfiguration definition) { - if (definition is not ObjectTypeDefinition typeDef) + if (definition is not ObjectTypeConfiguration typeDef) { return; } diff --git a/src/HotChocolate/Core/src/Fetching/DataLoaderRootFieldTypeInterceptor.cs b/src/HotChocolate/Core/src/Fetching/DataLoaderRootFieldTypeInterceptor.cs index 75a219efc75..8fea0b7140d 100644 --- a/src/HotChocolate/Core/src/Fetching/DataLoaderRootFieldTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Fetching/DataLoaderRootFieldTypeInterceptor.cs @@ -31,7 +31,7 @@ public override bool IsEnabled(IDescriptorContext context) public override void OnAfterResolveRootType( ITypeCompletionContext completionContext, - ObjectTypeDefinition definition, + ObjectTypeConfiguration definition, OperationType operationType) { if (operationType == OperationType.Query) @@ -45,7 +45,7 @@ public override void OnBeforeCompleteType( TypeSystemConfiguration definition) { if (completionContext.Type == _queryType - && definition is ObjectTypeDefinition typeDef) + && definition is ObjectTypeConfiguration typeDef) { if (_services is null) { diff --git a/src/HotChocolate/Core/src/Fetching/Extensions/ObjectFieldDataLoaderExtensions.cs b/src/HotChocolate/Core/src/Fetching/Extensions/ObjectFieldDataLoaderExtensions.cs index ddb8da03f48..a63dbb85126 100644 --- a/src/HotChocolate/Core/src/Fetching/Extensions/ObjectFieldDataLoaderExtensions.cs +++ b/src/HotChocolate/Core/src/Fetching/Extensions/ObjectFieldDataLoaderExtensions.cs @@ -29,7 +29,7 @@ public static IObjectFieldDescriptor UseDataLoader( throw DataLoader_InvalidType(dataLoaderType); } - descriptor.Extend().Definition.MiddlewareDefinitions.Add(placeholder); + descriptor.Extend().Configuration.MiddlewareDefinitions.Add(placeholder); descriptor .Extend() @@ -53,7 +53,7 @@ public static IObjectFieldDescriptor UseDataLoader( definition.Type = TypeReference.Create(schemaType, TypeContext.Output); definition.Configurations.Add( - new CompleteConfiguration( + new OnCompleteTypeSystemConfigurationTask( (_, def) => { CompileMiddleware( diff --git a/src/HotChocolate/Core/src/Fetching/SkipDataLoaderCacheAttribute.cs b/src/HotChocolate/Core/src/Fetching/SkipDataLoaderCacheAttribute.cs index 3731a71a7ad..7aa9788ef6d 100644 --- a/src/HotChocolate/Core/src/Fetching/SkipDataLoaderCacheAttribute.cs +++ b/src/HotChocolate/Core/src/Fetching/SkipDataLoaderCacheAttribute.cs @@ -14,5 +14,5 @@ protected override void OnConfigure( IDescriptorContext context, IObjectFieldDescriptor descriptor, MemberInfo member) - => descriptor.Extend().Definition.Flags |= FieldFlags.UsesProjections; + => descriptor.Extend().Configuration.Flags |= FieldFlags.UsesProjections; } diff --git a/src/HotChocolate/Core/src/Types.CursorPagination/ConnectionType.cs b/src/HotChocolate/Core/src/Types.CursorPagination/ConnectionType.cs index 723589fbc97..13d28b0ee85 100644 --- a/src/HotChocolate/Core/src/Types.CursorPagination/ConnectionType.cs +++ b/src/HotChocolate/Core/src/Types.CursorPagination/ConnectionType.cs @@ -43,7 +43,7 @@ internal ConnectionType( Definition.Name = NameHelper.CreateConnectionName(connectionName); Definition.Dependencies.Add(new(nodeType)); Definition.Configurations.Add( - new CompleteConfiguration( + new OnCompleteTypeSystemConfigurationTask( (c, _) => EdgeType = c.GetType(TypeReference.Create(edgeTypeName)), Definition, ApplyConfigurationOn.BeforeCompletion)); @@ -51,10 +51,10 @@ internal ConnectionType( if (includeNodesField) { Definition.Configurations.Add( - new CompleteConfiguration( + new OnCompleteTypeSystemConfigurationTask( (c, d) => { - var definition = (ObjectTypeDefinition)d; + var definition = (ObjectTypeConfiguration)d; var nodes = definition.Fields.First(IsNodesField); nodes.Type = TypeReference.Parse( $"[{c.GetType(nodeType).Print()}]", @@ -89,13 +89,13 @@ internal ConnectionType(TypeReference nodeType, bool includeTotalCount, bool inc Definition.NeedsNameCompletion = true; Definition.Configurations.Add( - new CompleteConfiguration( + new OnCompleteTypeSystemConfigurationTask( (c, d) => { var type = c.GetType(nodeType); ConnectionName = type.NamedType().Name; - var definition = (ObjectTypeDefinition)d; + var definition = (ObjectTypeConfiguration)d; var edges = definition.Fields.First(IsEdgesField); definition.Name = NameHelper.CreateConnectionName(ConnectionName); @@ -116,7 +116,7 @@ internal ConnectionType(TypeReference nodeType, bool includeTotalCount, bool inc nodeType, TypeDependencyFulfilled.Named)); Definition.Configurations.Add( - new CompleteConfiguration( + new OnCompleteTypeSystemConfigurationTask( (c, _) => { EdgeType = c.GetType(edgeType); @@ -158,12 +158,12 @@ private bool IsOfTypeWithRuntimeType( object? result) => result is null || RuntimeType.IsInstanceOfType(result); - private static ObjectTypeDefinition CreateTypeDefinition( + private static ObjectTypeConfiguration CreateTypeDefinition( bool includeTotalCount, bool includeNodesField, TypeReference? edgesType = null) { - var definition = new ObjectTypeDefinition + var definition = new ObjectTypeConfiguration { Description = ConnectionType_Description, RuntimeType = typeof(Connection) diff --git a/src/HotChocolate/Core/src/Types.CursorPagination/EdgeType.cs b/src/HotChocolate/Core/src/Types.CursorPagination/EdgeType.cs index f8400a6bc4b..39d2ec69676 100644 --- a/src/HotChocolate/Core/src/Types.CursorPagination/EdgeType.cs +++ b/src/HotChocolate/Core/src/Types.CursorPagination/EdgeType.cs @@ -28,7 +28,7 @@ internal EdgeType( Definition = CreateTypeDefinition(nodeType); Definition.Name = NameHelper.CreateEdgeName(connectionName); Definition.Configurations.Add( - new CompleteConfiguration( + new OnCompleteTypeSystemConfigurationTask( (c, _) => NodeType = c.GetType(nodeType), Definition, ApplyConfigurationOn.BeforeCompletion)); @@ -45,19 +45,19 @@ internal EdgeType(TypeReference nodeType) ConnectionName = default!; Definition = CreateTypeDefinition(nodeType); Definition.Configurations.Add( - new CompleteConfiguration( + new OnCompleteTypeSystemConfigurationTask( (c, d) => { var type = c.GetType(nodeType); ConnectionName = type.NamedType().Name; - ((ObjectTypeDefinition)d).Name = NameHelper.CreateEdgeName(ConnectionName); + ((ObjectTypeConfiguration)d).Name = NameHelper.CreateEdgeName(ConnectionName); }, Definition, ApplyConfigurationOn.BeforeNaming, nodeType, TypeDependencyFulfilled.Named)); Definition.Configurations.Add( - new CompleteConfiguration( + new OnCompleteTypeSystemConfigurationTask( (c, _) => NodeType = c.GetType(nodeType), Definition, ApplyConfigurationOn.BeforeCompletion)); @@ -95,7 +95,7 @@ public override bool IsInstanceOfType(IResolverContext context, object resolverR return false; } - private static ObjectTypeDefinition CreateTypeDefinition(TypeReference nodeType) + private static ObjectTypeConfiguration CreateTypeDefinition(TypeReference nodeType) => new() { Description = EdgeType_Description, diff --git a/src/HotChocolate/Core/src/Types.CursorPagination/Extensions/PagingObjectFieldDescriptorExtensions.cs b/src/HotChocolate/Core/src/Types.CursorPagination/Extensions/PagingObjectFieldDescriptorExtensions.cs index b19f9c05e25..13c3fa3c640 100644 --- a/src/HotChocolate/Core/src/Types.CursorPagination/Extensions/PagingObjectFieldDescriptorExtensions.cs +++ b/src/HotChocolate/Core/src/Types.CursorPagination/Extensions/PagingObjectFieldDescriptorExtensions.cs @@ -261,7 +261,7 @@ public static IObjectFieldDescriptor AddPagingArguments( } CreatePagingArguments( - descriptor.Extend().Definition.Arguments, + descriptor.Extend().Configuration.Arguments, allowBackwardPagination); return descriptor; @@ -281,7 +281,7 @@ public static IInterfaceFieldDescriptor AddPagingArguments( } CreatePagingArguments( - descriptor.Extend().Definition.Arguments, + descriptor.Extend().Configuration.Arguments, allowBackwardPagination); return descriptor; diff --git a/src/HotChocolate/Core/src/Types.CursorPagination/Extensions/UseConnectionAttribute.cs b/src/HotChocolate/Core/src/Types.CursorPagination/Extensions/UseConnectionAttribute.cs index e911e88580d..6b24d2f7219 100644 --- a/src/HotChocolate/Core/src/Types.CursorPagination/Extensions/UseConnectionAttribute.cs +++ b/src/HotChocolate/Core/src/Types.CursorPagination/Extensions/UseConnectionAttribute.cs @@ -124,9 +124,9 @@ protected internal override void TryConfigure( if (descriptor is IObjectFieldDescriptor fieldDesc) { - var definition = fieldDesc.Extend().Definition; + var definition = fieldDesc.Extend().Configuration; definition.Configurations.Add( - new CreateConfiguration( + new OnCreateTypeSystemConfigurationTask( (_, d) => { ((ObjectFieldConfiguration)d).State = @@ -136,7 +136,7 @@ protected internal override void TryConfigure( }, definition)); definition.Configurations.Add( - new CompleteConfiguration( + new OnCompleteTypeSystemConfigurationTask( (c, d) => ApplyPagingOptions(c.DescriptorContext, d, options), definition, ApplyConfigurationOn.BeforeCompletion)); diff --git a/src/HotChocolate/Core/src/Types.Errors/ErrorObjectType.cs b/src/HotChocolate/Core/src/Types.Errors/ErrorObjectType.cs index d87ca32898f..d82e6974f88 100644 --- a/src/HotChocolate/Core/src/Types.Errors/ErrorObjectType.cs +++ b/src/HotChocolate/Core/src/Types.Errors/ErrorObjectType.cs @@ -5,13 +5,13 @@ internal sealed class ErrorObjectType : ObjectType protected override void Configure(IObjectTypeDescriptor descriptor) { descriptor.Extend().OnBeforeCreate(RewriteMessageFieldToNonNullableStringType); - descriptor.Extend().Definition.ContextData.MarkAsError(); + descriptor.Extend().Configuration.ContextData.MarkAsError(); descriptor.BindFieldsImplicitly(); } private void RewriteMessageFieldToNonNullableStringType( IDescriptorContext context, - ObjectTypeDefinition definition) + ObjectTypeConfiguration definition) { // if a user provides his/her own error interface we will not rewrite the message type // and the user is responsible for ensuring that type and interface align. diff --git a/src/HotChocolate/Core/src/Types.Errors/ExceptionObjectType.cs b/src/HotChocolate/Core/src/Types.Errors/ExceptionObjectType.cs index 682e43d4d32..116a86c1b41 100644 --- a/src/HotChocolate/Core/src/Types.Errors/ExceptionObjectType.cs +++ b/src/HotChocolate/Core/src/Types.Errors/ExceptionObjectType.cs @@ -14,7 +14,7 @@ protected override void Configure(IObjectTypeDescriptor descriptor) descriptor.Ignore(x => x.TargetSite); descriptor.Ignore(x => x.GetBaseException()); descriptor.Field(x => x.Message).Type>(); - descriptor.Extend().Definition.ContextData.MarkAsError(); + descriptor.Extend().Configuration.ContextData.MarkAsError(); descriptor.BindFieldsImplicitly(); } diff --git a/src/HotChocolate/Core/src/Types.Json/FromJsonSchemaDirective.cs b/src/HotChocolate/Core/src/Types.Json/FromJsonSchemaDirective.cs index 2d01de16197..ac8d0f56b20 100644 --- a/src/HotChocolate/Core/src/Types.Json/FromJsonSchemaDirective.cs +++ b/src/HotChocolate/Core/src/Types.Json/FromJsonSchemaDirective.cs @@ -18,7 +18,7 @@ public void ApplyConfiguration( if (definition is ObjectFieldConfiguration fieldDef) { fieldDef.Configurations.Add( - new CompleteConfiguration( + new OnCompleteTypeSystemConfigurationTask( (ctx, def) => { var propertyName = GetPropertyName(directiveNode); diff --git a/src/HotChocolate/Core/src/Types.Mutations/MutationConventionTypeInterceptor.cs b/src/HotChocolate/Core/src/Types.Mutations/MutationConventionTypeInterceptor.cs index 4add84d5110..25d77207636 100644 --- a/src/HotChocolate/Core/src/Types.Mutations/MutationConventionTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types.Mutations/MutationConventionTypeInterceptor.cs @@ -19,7 +19,7 @@ internal sealed class MutationConventionTypeInterceptor : TypeInterceptor private IDescriptorContext _context = default!; private List _mutations = default!; private ITypeCompletionContext _completionContext = default!; - private ObjectTypeDefinition? _mutationTypeDef; + private ObjectTypeConfiguration? _mutationTypeDef; private FieldMiddlewareConfiguration? _errorNullMiddleware; private TypeInterceptor[] _siblings = []; @@ -65,7 +65,7 @@ public override void OnBeforeRegisterDependencies( TypeSystemConfiguration definition) { // we will use the error interface and implement it with each error type. - if (definition is ObjectTypeDefinition objectTypeDef) + if (definition is ObjectTypeConfiguration objectTypeDef) { TryAddErrorInterface(objectTypeDef, _errorTypeHelper.ErrorTypeInterfaceRef); } @@ -76,7 +76,7 @@ public override void OnAfterCompleteTypeNames() internal override void OnBeforeCompleteMutation( ITypeCompletionContext completionContext, - ObjectTypeDefinition definition) + ObjectTypeConfiguration definition) { // we first invoke our siblings to gather configurations. foreach (var sibling in _siblings) @@ -488,7 +488,7 @@ private static ObjectType CreatePayloadType( FieldDef data, FieldDef? error) { - var objectDef = new ObjectTypeDefinition(typeName); + var objectDef = new ObjectTypeConfiguration(typeName); var dataFieldDef = new ObjectFieldConfiguration( data.Name, @@ -530,7 +530,7 @@ private UnionType CreateErrorType( string typeName, IReadOnlyList errorDefinitions) { - var unionDef = new UnionTypeDefinition(typeName); + var unionDef = new UnionTypeConfiguration(typeName); foreach (var error in errorDefinitions) { @@ -541,7 +541,7 @@ private UnionType CreateErrorType( } private static void TryAddErrorInterface( - ObjectTypeDefinition objectTypeDef, + ObjectTypeConfiguration objectTypeDef, TypeReference errorInterfaceTypeRef) { if (objectTypeDef.ContextData.IsError()) diff --git a/src/HotChocolate/Core/src/Types.Mutations/MutationDirective.cs b/src/HotChocolate/Core/src/Types.Mutations/MutationDirective.cs index 541210cd86e..8e6f1a411c6 100644 --- a/src/HotChocolate/Core/src/Types.Mutations/MutationDirective.cs +++ b/src/HotChocolate/Core/src/Types.Mutations/MutationDirective.cs @@ -19,7 +19,7 @@ public void ApplyConfiguration( } fieldDef.Configurations.Add( - new CompleteConfiguration( + new OnCompleteTypeSystemConfigurationTask( (c, d) => { c.ContextData diff --git a/src/HotChocolate/Core/src/Types.OffsetPagination/CollectionSegmentType~1.cs b/src/HotChocolate/Core/src/Types.OffsetPagination/CollectionSegmentType~1.cs index 003812df7e2..2c4212b38e1 100644 --- a/src/HotChocolate/Core/src/Types.OffsetPagination/CollectionSegmentType~1.cs +++ b/src/HotChocolate/Core/src/Types.OffsetPagination/CollectionSegmentType~1.cs @@ -27,11 +27,11 @@ internal CollectionSegmentType( else { Definition.Configurations.Add( - new CompleteConfiguration( + new OnCompleteTypeSystemConfigurationTask( (c, d) => { var type = c.GetType(nodeType); - var definition = (ObjectTypeDefinition)d; + var definition = (ObjectTypeConfiguration)d; definition.Name = type.NamedType().Name + "CollectionSegment"; }, Definition, @@ -41,12 +41,12 @@ internal CollectionSegmentType( } Definition.Configurations.Add( - new CompleteConfiguration( + new OnCompleteTypeSystemConfigurationTask( (c, d) => { ItemType = c.GetType(nodeType); - var definition = (ObjectTypeDefinition)d; + var definition = (ObjectTypeConfiguration)d; var nodes = definition.Fields.First(IsItemsField); nodes.Type = TypeReference.Parse($"[{ItemType.Print()}]", TypeContext.Output); }, @@ -72,9 +72,9 @@ protected override void OnBeforeRegisterDependencies( base.OnBeforeRegisterDependencies(context, definition); } - private static ObjectTypeDefinition CreateTypeDefinition(bool withTotalCount) + private static ObjectTypeConfiguration CreateTypeDefinition(bool withTotalCount) { - var definition = new ObjectTypeDefinition + var definition = new ObjectTypeConfiguration { Description = CollectionSegmentType_Description, RuntimeType = typeof(CollectionSegment), diff --git a/src/HotChocolate/Core/src/Types.OffsetPagination/Extensions/OffsetPagingObjectFieldDescriptorExtensions.cs b/src/HotChocolate/Core/src/Types.OffsetPagination/Extensions/OffsetPagingObjectFieldDescriptorExtensions.cs index 98dfe553ec3..95f7654894f 100644 --- a/src/HotChocolate/Core/src/Types.OffsetPagination/Extensions/OffsetPagingObjectFieldDescriptorExtensions.cs +++ b/src/HotChocolate/Core/src/Types.OffsetPagination/Extensions/OffsetPagingObjectFieldDescriptorExtensions.cs @@ -268,7 +268,7 @@ public static IObjectFieldDescriptor AddOffsetPagingArguments( } var skip = descriptor.Argument(OffsetPagingArgumentNames.Skip, a => a.Type()); - skip.Extend().Definition.Flags |= FieldFlags.SkipArgument; + skip.Extend().Configuration.Flags |= FieldFlags.SkipArgument; return descriptor .Argument(OffsetPagingArgumentNames.Take, a => a.Type()); diff --git a/src/HotChocolate/Core/src/Types.Queries/QueryConventionTypeInterceptor.cs b/src/HotChocolate/Core/src/Types.Queries/QueryConventionTypeInterceptor.cs index 3796f460c51..66c9cbce7b1 100644 --- a/src/HotChocolate/Core/src/Types.Queries/QueryConventionTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types.Queries/QueryConventionTypeInterceptor.cs @@ -7,11 +7,11 @@ internal sealed class QueryConventionTypeInterceptor : TypeInterceptor { private readonly ErrorTypeHelper _errorTypeHelper = new(); private readonly StringBuilder _sb = new(); - private readonly List _typeDefs = new(); + private readonly List _typeDefs = new(); private TypeInitializer _typeInitializer = default!; private TypeRegistry _typeRegistry = default!; private IDescriptorContext _context = default!; - private ObjectTypeDefinition _mutationDef = default!; + private ObjectTypeConfiguration _mutationDef = default!; internal override void InitializeContext( IDescriptorContext context, @@ -28,7 +28,7 @@ internal override void InitializeContext( public override void OnAfterResolveRootType( ITypeCompletionContext completionContext, - ObjectTypeDefinition definition, + ObjectTypeConfiguration definition, OperationType operationType) { if (operationType is OperationType.Mutation) @@ -41,7 +41,7 @@ public override void OnAfterCompleteName( ITypeCompletionContext completionContext, TypeSystemConfiguration definition) { - if (completionContext.Type is ObjectType && definition is ObjectTypeDefinition typeDef) + if (completionContext.Type is ObjectType && definition is ObjectTypeConfiguration typeDef) { _typeDefs.Add(typeDef); } @@ -175,7 +175,7 @@ private TypeReference CreateFieldResultType(string fieldName, IReadOnlyList dependencies) { if (definition is null) @@ -189,7 +189,7 @@ public static void CollectDependencies( } internal static void CollectDirectiveDependencies( - TypeDefinitionBase definition, + TypeConfiguration definition, ICollection dependencies) { if (definition.HasDirectives) @@ -267,7 +267,7 @@ private static void CollectArgumentDependencies( public static void RegisterDependencies( this ITypeDiscoveryContext context, - ObjectTypeDefinition definition) + ObjectTypeConfiguration definition) { if (context is null) { diff --git a/src/HotChocolate/Core/src/Types/Internal/TypeExtensionHelper.cs b/src/HotChocolate/Core/src/Types/Internal/TypeExtensionHelper.cs index 581f1b81108..a1a7234e15c 100644 --- a/src/HotChocolate/Core/src/Types/Internal/TypeExtensionHelper.cs +++ b/src/HotChocolate/Core/src/Types/Internal/TypeExtensionHelper.cs @@ -160,8 +160,8 @@ public static void MergeContextData( } public static void MergeInterfaces( - ObjectTypeDefinition extension, - ObjectTypeDefinition type) + ObjectTypeConfiguration extension, + ObjectTypeConfiguration type) { if (extension.GetInterfaces().Count > 0) { diff --git a/src/HotChocolate/Core/src/Types/Resolvers/Expressions/Parameters/IsSelectedParameterExpressionBuilder.cs b/src/HotChocolate/Core/src/Types/Resolvers/Expressions/Parameters/IsSelectedParameterExpressionBuilder.cs index 25f1332dd07..de5e93797da 100644 --- a/src/HotChocolate/Core/src/Types/Resolvers/Expressions/Parameters/IsSelectedParameterExpressionBuilder.cs +++ b/src/HotChocolate/Core/src/Types/Resolvers/Expressions/Parameters/IsSelectedParameterExpressionBuilder.cs @@ -41,9 +41,9 @@ public void ApplyConfiguration(ParameterInfo parameter, ObjectFieldDescriptor de if (attribute.Fields is not null) { - var definition = descriptor.Extend().Definition; + var definition = descriptor.Extend().Configuration; definition.Configurations.Add( - new CompleteConfiguration((ctx, def) => + new OnCompleteTypeSystemConfigurationTask((ctx, def) => { if (!ctx.DescriptorContext.ContextData.TryGetValue(WellKnownContextData.PatternValidationTasks, out var value)) diff --git a/src/HotChocolate/Core/src/Types/Schema.Initialization.cs b/src/HotChocolate/Core/src/Types/Schema.Initialization.cs index 183355bae09..9afaa9c9c18 100644 --- a/src/HotChocolate/Core/src/Types/Schema.Initialization.cs +++ b/src/HotChocolate/Core/src/Types/Schema.Initialization.cs @@ -24,7 +24,7 @@ public Schema(Action configure) protected virtual void Configure(ISchemaTypeDescriptor descriptor) { } - protected sealed override SchemaTypeDefinition CreateDefinition(ITypeDiscoveryContext context) + protected sealed override SchemaTypeConfiguration CreateDefinition(ITypeDiscoveryContext context) { var descriptor = SchemaTypeDescriptor.New(context.DescriptorContext, GetType()); @@ -32,7 +32,7 @@ protected sealed override SchemaTypeDefinition CreateDefinition(ITypeDiscoveryCo context.DescriptorContext.ApplySchemaConfigurations(descriptor); - return descriptor.CreateDefinition(); + return descriptor.CreateConfiguration(); } protected override void OnAfterInitialize( @@ -52,7 +52,7 @@ protected override void OnAfterInitialize( protected override void OnRegisterDependencies( ITypeDiscoveryContext context, - SchemaTypeDefinition definition) + SchemaTypeConfiguration definition) { base.OnRegisterDependencies(context, definition); @@ -72,7 +72,7 @@ protected override void OnRegisterDependencies( protected override void OnCompleteType( ITypeCompletionContext context, - SchemaTypeDefinition definition) + SchemaTypeConfiguration definition) { base.OnCompleteType(context, definition); @@ -82,7 +82,7 @@ protected override void OnCompleteType( protected override void OnCompleteMetadata( ITypeCompletionContext context, - SchemaTypeDefinition definition) + SchemaTypeConfiguration definition) { base.OnCompleteMetadata(context, definition); diff --git a/src/HotChocolate/Core/src/Types/Schema.cs b/src/HotChocolate/Core/src/Types/Schema.cs index 9d38ce2d729..47e8718341f 100644 --- a/src/HotChocolate/Core/src/Types/Schema.cs +++ b/src/HotChocolate/Core/src/Types/Schema.cs @@ -18,7 +18,7 @@ namespace HotChocolate; /// the entry points for query, mutation, and subscription operations. /// public partial class Schema - : TypeSystemObjectBase + : TypeSystemObjectBase , ISchema { private readonly DateTimeOffset _createdAt = DateTimeOffset.UtcNow; diff --git a/src/HotChocolate/Core/src/Types/SemanticNonNullTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/SemanticNonNullTypeInterceptor.cs index 340f18b2603..b4ce30ced75 100644 --- a/src/HotChocolate/Core/src/Types/SemanticNonNullTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/SemanticNonNullTypeInterceptor.cs @@ -14,7 +14,7 @@ namespace HotChocolate; internal sealed class SemanticNonNullTypeInterceptor : TypeInterceptor { private ITypeInspector _typeInspector = null!; - private ObjectTypeDefinition? _mutationDef; + private ObjectTypeConfiguration? _mutationDef; public override bool IsEnabled(IDescriptorContext context) => context.Options.EnableSemanticNonNull; @@ -29,7 +29,7 @@ internal override void InitializeContext( _typeInspector = context.TypeInspector; } - public override void OnAfterResolveRootType(ITypeCompletionContext completionContext, ObjectTypeDefinition definition, + public override void OnAfterResolveRootType(ITypeCompletionContext completionContext, ObjectTypeConfiguration definition, OperationType operationType) { if (operationType is OperationType.Mutation) @@ -45,7 +45,7 @@ public override void OnBeforeCompleteType(ITypeCompletionContext completionConte return; } - if (definition is ObjectTypeDefinition objectDef) + if (definition is ObjectTypeConfiguration objectDef) { if (objectDef.Name is "CollectionSegmentInfo" or "PageInfo") { diff --git a/src/HotChocolate/Core/src/Types/StoreGlobalPagingOptionsTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/StoreGlobalPagingOptionsTypeInterceptor.cs index defceae8c64..6c5880ce281 100644 --- a/src/HotChocolate/Core/src/Types/StoreGlobalPagingOptionsTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/StoreGlobalPagingOptionsTypeInterceptor.cs @@ -12,7 +12,7 @@ public override void OnBeforeCompleteType( ITypeCompletionContext completionContext, TypeSystemConfiguration definition) { - if(definition is SchemaTypeDefinition schemaDef) + if(definition is SchemaTypeConfiguration schemaDef) { var options = completionContext.DescriptorContext.GetPagingOptions(null); schemaDef.Features.Set(options); diff --git a/src/HotChocolate/Core/src/Types/Types/Attributes/DirectiveTypeAttribute.cs b/src/HotChocolate/Core/src/Types/Types/Attributes/DirectiveTypeAttribute.cs index ac1378bac16..597e2b5aedf 100644 --- a/src/HotChocolate/Core/src/Types/Types/Attributes/DirectiveTypeAttribute.cs +++ b/src/HotChocolate/Core/src/Types/Types/Attributes/DirectiveTypeAttribute.cs @@ -58,6 +58,6 @@ protected override void OnConfigure( descriptor.Repeatable(); } - descriptor.Extend().Definition.Arguments.BindingBehavior = BindingBehavior.Implicit; + descriptor.Extend().Configuration.Arguments.BindingBehavior = BindingBehavior.Implicit; } } diff --git a/src/HotChocolate/Core/src/Types/Types/Attributes/ExtendObjectTypeAttribute.cs b/src/HotChocolate/Core/src/Types/Types/Attributes/ExtendObjectTypeAttribute.cs index 035e92f2724..5993955cebb 100644 --- a/src/HotChocolate/Core/src/Types/Types/Attributes/ExtendObjectTypeAttribute.cs +++ b/src/HotChocolate/Core/src/Types/Types/Attributes/ExtendObjectTypeAttribute.cs @@ -101,7 +101,7 @@ protected override void OnConfigure( descriptor.Name(Name); } - var definition = descriptor.Extend().Definition; + var definition = descriptor.Extend().Configuration; definition.Fields.BindingBehavior = BindingBehavior.Implicit; if (IncludeStaticMembers) @@ -203,12 +203,12 @@ protected override void OnConfigure( descriptor.ExtendsType(ExtendsType); } - var definition = descriptor.Extend().Definition; + var definition = descriptor.Extend().Configuration; definition.Fields.BindingBehavior = BindingBehavior.Implicit; if (IncludeStaticMembers) { - descriptor.Extend().Definition.FieldBindingFlags = Instance | Static; + descriptor.Extend().Configuration.FieldBindingFlags = Instance | Static; } if (IgnoreFields is not null) diff --git a/src/HotChocolate/Core/src/Types/Types/Attributes/InputObjectTypeAttribute.cs b/src/HotChocolate/Core/src/Types/Types/Attributes/InputObjectTypeAttribute.cs index 85fc315d89a..177c41f4b7e 100644 --- a/src/HotChocolate/Core/src/Types/Types/Attributes/InputObjectTypeAttribute.cs +++ b/src/HotChocolate/Core/src/Types/Types/Attributes/InputObjectTypeAttribute.cs @@ -41,6 +41,6 @@ protected override void OnConfigure( descriptor.Name(Name); } - descriptor.Extend().Definition.Fields.BindingBehavior = BindingBehavior.Implicit; + descriptor.Extend().Configuration.Fields.BindingBehavior = BindingBehavior.Implicit; } } diff --git a/src/HotChocolate/Core/src/Types/Types/Attributes/InterfaceTypeAttribute.cs b/src/HotChocolate/Core/src/Types/Types/Attributes/InterfaceTypeAttribute.cs index 25ce6f2595e..108bcf5042a 100644 --- a/src/HotChocolate/Core/src/Types/Types/Attributes/InterfaceTypeAttribute.cs +++ b/src/HotChocolate/Core/src/Types/Types/Attributes/InterfaceTypeAttribute.cs @@ -36,7 +36,7 @@ protected override void OnConfigure( descriptor.Name(Name); } - descriptor.Extend().Definition.Fields.BindingBehavior = BindingBehavior.Implicit; + descriptor.Extend().Configuration.Fields.BindingBehavior = BindingBehavior.Implicit; } } diff --git a/src/HotChocolate/Core/src/Types/Types/Attributes/MutationTypeAttribute.cs b/src/HotChocolate/Core/src/Types/Types/Attributes/MutationTypeAttribute.cs index 185a641e3a3..e52ce136905 100644 --- a/src/HotChocolate/Core/src/Types/Types/Attributes/MutationTypeAttribute.cs +++ b/src/HotChocolate/Core/src/Types/Types/Attributes/MutationTypeAttribute.cs @@ -31,7 +31,7 @@ protected override void OnConfigure( { descriptor.Name(OperationTypeNames.Mutation); - var definition = descriptor.Extend().Definition; + var definition = descriptor.Extend().Configuration; definition.Fields.BindingBehavior = BindingBehavior.Implicit; if (IncludeStaticMembers) diff --git a/src/HotChocolate/Core/src/Types/Types/Attributes/ObjectTypeAttribute.cs b/src/HotChocolate/Core/src/Types/Types/Attributes/ObjectTypeAttribute.cs index 9cd6b7ee917..f90036f922b 100644 --- a/src/HotChocolate/Core/src/Types/Types/Attributes/ObjectTypeAttribute.cs +++ b/src/HotChocolate/Core/src/Types/Types/Attributes/ObjectTypeAttribute.cs @@ -52,7 +52,7 @@ protected override void OnConfigure( descriptor.Name(Name); } - var definition = descriptor.Extend().Definition; + var definition = descriptor.Extend().Configuration; definition.Fields.BindingBehavior = BindingBehavior.Implicit; if (IncludeStaticMembers) diff --git a/src/HotChocolate/Core/src/Types/Types/Attributes/QueryTypeAttribute.cs b/src/HotChocolate/Core/src/Types/Types/Attributes/QueryTypeAttribute.cs index 25951776227..666a5cd5576 100644 --- a/src/HotChocolate/Core/src/Types/Types/Attributes/QueryTypeAttribute.cs +++ b/src/HotChocolate/Core/src/Types/Types/Attributes/QueryTypeAttribute.cs @@ -31,7 +31,7 @@ protected override void OnConfigure( { descriptor.Name(OperationTypeNames.Query); - var definition = descriptor.Extend().Definition; + var definition = descriptor.Extend().Configuration; definition.Fields.BindingBehavior = BindingBehavior.Implicit; if (IncludeStaticMembers) diff --git a/src/HotChocolate/Core/src/Types/Types/Attributes/SubscriptionTypeAttribute.cs b/src/HotChocolate/Core/src/Types/Types/Attributes/SubscriptionTypeAttribute.cs index 74ea370ba2b..0efe11ecb6f 100644 --- a/src/HotChocolate/Core/src/Types/Types/Attributes/SubscriptionTypeAttribute.cs +++ b/src/HotChocolate/Core/src/Types/Types/Attributes/SubscriptionTypeAttribute.cs @@ -31,7 +31,7 @@ protected override void OnConfigure( { descriptor.Name(OperationTypeNames.Subscription); - var definition = descriptor.Extend().Definition; + var definition = descriptor.Extend().Configuration; definition.Fields.BindingBehavior = BindingBehavior.Implicit; if (IncludeStaticMembers) diff --git a/src/HotChocolate/Core/src/Types/Types/Attributes/UseListPostProcessorAttribute.cs b/src/HotChocolate/Core/src/Types/Types/Attributes/UseListPostProcessorAttribute.cs index 50bec4e77c0..410c3dc9e37 100644 --- a/src/HotChocolate/Core/src/Types/Types/Attributes/UseListPostProcessorAttribute.cs +++ b/src/HotChocolate/Core/src/Types/Types/Attributes/UseListPostProcessorAttribute.cs @@ -12,5 +12,5 @@ protected override void OnConfigure( IObjectFieldDescriptor descriptor, MemberInfo member) => descriptor.ExtendWith( - c => c.Definition.ResultPostProcessor = ListPostProcessor.Default); + c => c.Configuration.ResultPostProcessor = ListPostProcessor.Default); } diff --git a/src/HotChocolate/Core/src/Types/Types/Attributes/UseResolverResultPostProcessorAttribute.cs b/src/HotChocolate/Core/src/Types/Types/Attributes/UseResolverResultPostProcessorAttribute.cs index f0d5dda7bd5..3adadad0925 100644 --- a/src/HotChocolate/Core/src/Types/Types/Attributes/UseResolverResultPostProcessorAttribute.cs +++ b/src/HotChocolate/Core/src/Types/Types/Attributes/UseResolverResultPostProcessorAttribute.cs @@ -15,6 +15,6 @@ protected override void OnConfigure( { var services = context.Services.GetRequiredService(); var postProcessor = ActivatorUtilities.GetServiceOrCreateInstance(services); - descriptor.ExtendWith(c => c.Definition.ResultPostProcessor = postProcessor); + descriptor.ExtendWith(c => c.Configuration.ResultPostProcessor = postProcessor); } } diff --git a/src/HotChocolate/Core/src/Types/Types/Contracts/IHasTypeDefinition.cs b/src/HotChocolate/Core/src/Types/Types/Contracts/IHasTypeDefinition.cs index 2d035b8364a..77cbc0dedee 100644 --- a/src/HotChocolate/Core/src/Types/Types/Contracts/IHasTypeDefinition.cs +++ b/src/HotChocolate/Core/src/Types/Types/Contracts/IHasTypeDefinition.cs @@ -9,5 +9,5 @@ internal interface IHasTypeDefinition /// /// Gets the inner type definition if it is still available. /// - ITypeDefinition? Definition { get; } + ITypeConfiguration? Definition { get; } } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/CompletedDependencyDescriptor~1.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/CompletedDependencyDescriptor~1.cs index eed9cd8db8e..6b69b6c5b81 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/CompletedDependencyDescriptor~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/CompletedDependencyDescriptor~1.cs @@ -8,7 +8,7 @@ internal class CompletedDependencyDescriptor { public CompletedDependencyDescriptor( ITypeInspector typeInspector, - CompleteConfiguration configuration) + OnCompleteTypeSystemConfigurationTask configuration) : base(typeInspector, configuration) { } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IDescriptor.cs index 3c53837f357..5747cc89b5e 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IDescriptor.cs @@ -5,6 +5,4 @@ namespace HotChocolate.Types; /// The output of a descriptor is a definition which represents the configuration for a /// type system member. /// -public interface IDescriptor -{ -} +public interface IDescriptor; diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IDescriptorExtension~1.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IDescriptorExtension~1.cs index 7d5b5a5ffac..f5bb00c30ea 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IDescriptorExtension~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IDescriptorExtension~1.cs @@ -16,7 +16,7 @@ public interface IDescriptorExtension : IHasDescriptorContext /// /// The type definition. /// - T Definition { get; } + T Configuration { get; } /// /// Allows to rewrite the type definition before the type diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IObjectTypeDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IObjectTypeDescriptor.cs index 44eb3205a25..61840d123e2 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IObjectTypeDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IObjectTypeDescriptor.cs @@ -11,7 +11,7 @@ namespace HotChocolate.Types; /// A fluent configuration API for GraphQL object types. /// public interface IObjectTypeDescriptor - : IDescriptor + : IDescriptor , IFluent { /// diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IObjectTypeDescriptor~1.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IObjectTypeDescriptor~1.cs index 97099705326..567de4610b9 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IObjectTypeDescriptor~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IObjectTypeDescriptor~1.cs @@ -14,7 +14,7 @@ namespace HotChocolate.Types; /// The runtime type. /// public interface IObjectTypeDescriptor - : IDescriptor + : IDescriptor , IFluent { /// diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IScalarTypeDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IScalarTypeDescriptor.cs index 32526b4b80e..1d6155d1644 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IScalarTypeDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IScalarTypeDescriptor.cs @@ -9,7 +9,7 @@ namespace HotChocolate.Types; /// A fluent configuration API for GraphQL scalar types. /// public interface IScalarTypeDescriptor - : IDescriptor + : IDescriptor , IFluent { /// diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/ISchemaTypeDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/ISchemaTypeDescriptor.cs index 9fdc3f6d9b2..8f400ea514a 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/ISchemaTypeDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/ISchemaTypeDescriptor.cs @@ -4,7 +4,7 @@ namespace HotChocolate.Types; public interface ISchemaTypeDescriptor - : IDescriptor + : IDescriptor , IFluent { ISchemaTypeDescriptor Name(string value); diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IUnionTypeDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IUnionTypeDescriptor.cs index 67c0c734d37..f427f688730 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IUnionTypeDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IUnionTypeDescriptor.cs @@ -4,7 +4,7 @@ namespace HotChocolate.Types; public interface IUnionTypeDescriptor - : IDescriptor + : IDescriptor , IFluent { IUnionTypeDescriptor Name(string value); diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/EnumTypeConfiguration.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/EnumTypeConfiguration.cs index 62c0892de30..5fc7ccc93bd 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/EnumTypeConfiguration.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/EnumTypeConfiguration.cs @@ -7,7 +7,7 @@ namespace HotChocolate.Types.Descriptors.Definitions; /// /// Defines the properties of a GraphQL enum type. /// -public class EnumTypeConfiguration : TypeDefinitionBase +public class EnumTypeConfiguration : TypeConfiguration { /// /// Initializes a new instance of . diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/EnumValueConfiguration.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/EnumValueConfiguration.cs index c9e932c346a..7f1e7aa355d 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/EnumValueConfiguration.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/EnumValueConfiguration.cs @@ -9,7 +9,7 @@ namespace HotChocolate.Types.Descriptors.Definitions; /// Defines the properties of a GraphQL enum value. /// public class EnumValueConfiguration - : TypeDefinitionBase + : TypeConfiguration , IDeprecationConfiguration , IIgnoreConfiguration { diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IConfigurationFactory.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IConfigurationFactory.cs new file mode 100644 index 00000000000..a726750397a --- /dev/null +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IConfigurationFactory.cs @@ -0,0 +1,12 @@ +namespace HotChocolate.Types.Descriptors.Definitions; + +/// +/// Defines a factory for creating a type system configuration. +/// +public interface IConfigurationFactory +{ + /// + /// Creates a new type system configuration. + /// + TypeSystemConfiguration CreateConfiguration(); +} diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IConfigurationFactory~1.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IConfigurationFactory~1.cs new file mode 100644 index 00000000000..90f49c7c7f2 --- /dev/null +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IConfigurationFactory~1.cs @@ -0,0 +1,16 @@ +namespace HotChocolate.Types.Descriptors.Definitions; + +/// +/// Defines a factory for creating a type system configuration. +/// +/// +/// The type of the type system configuration. +/// +public interface IConfigurationFactory : IConfigurationFactory where T : TypeSystemConfiguration +{ + /// + /// Creates a new type system configuration. + /// + /// + new T CreateConfiguration(); +} diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IDefinitionFactory.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IDefinitionFactory.cs deleted file mode 100644 index 196287db876..00000000000 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IDefinitionFactory.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace HotChocolate.Types.Descriptors.Definitions; - -public interface IDefinitionFactory -{ - TypeSystemConfiguration CreateDefinition(); -} diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IDefinitionFactory~1.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IDefinitionFactory~1.cs deleted file mode 100644 index 5700a6632df..00000000000 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IDefinitionFactory~1.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace HotChocolate.Types.Descriptors.Definitions; - -public interface IDefinitionFactory - : IDefinitionFactory - where T : TypeSystemConfiguration -{ - new T CreateDefinition(); -} diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ITypeDefinition.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ITypeConfiguration.cs similarity index 95% rename from src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ITypeDefinition.cs rename to src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ITypeConfiguration.cs index e2298f9ee3b..a835868e7e5 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ITypeDefinition.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ITypeConfiguration.cs @@ -3,7 +3,7 @@ namespace HotChocolate.Types.Descriptors.Definitions; /// /// Represents a type definition. /// -public interface ITypeDefinition +public interface ITypeConfiguration : ITypeSystemConfiguration , IHasRuntimeType , IDirectiveConfigurationProvider diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InputObjectTypeConfiguration.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InputObjectTypeConfiguration.cs index 499514fc165..824cef6d3cd 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InputObjectTypeConfiguration.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InputObjectTypeConfiguration.cs @@ -7,7 +7,7 @@ namespace HotChocolate.Types.Descriptors.Definitions; /// /// Defines the properties of a GraphQL input object type. /// -public class InputObjectTypeConfiguration : TypeDefinitionBase +public class InputObjectTypeConfiguration : TypeConfiguration { /// /// Initializes a new instance of . diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InterfaceFieldConfiguration.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InterfaceFieldConfiguration.cs index 2e1fdc02c8f..8599ebf7bca 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InterfaceFieldConfiguration.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InterfaceFieldConfiguration.cs @@ -22,7 +22,7 @@ public class InterfaceFieldConfiguration : OutputFieldConfiguration private bool _resultConvertersCleaned; /// - /// Initializes a new instance of . + /// Initializes a new instance of . /// public InterfaceFieldConfiguration() { @@ -30,7 +30,7 @@ public InterfaceFieldConfiguration() } /// - /// Initializes a new instance of . + /// Initializes a new instance of . /// public InterfaceFieldConfiguration( string name, diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InterfaceTypeConfiguration.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InterfaceTypeConfiguration.cs index 4c78aba4bed..4b5d2640ef9 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InterfaceTypeConfiguration.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InterfaceTypeConfiguration.cs @@ -4,18 +4,18 @@ namespace HotChocolate.Types.Descriptors.Definitions; -public class InterfaceTypeConfiguration : TypeDefinitionBase, IComplexOutputTypeConfiguration +public class InterfaceTypeConfiguration : TypeConfiguration, IComplexOutputTypeConfiguration { private List? _knownClrTypes; private List? _interfaces; /// - /// Initializes a new instance of . + /// Initializes a new instance of . /// public InterfaceTypeConfiguration() { } /// - /// Initializes a new instance of . + /// Initializes a new instance of . /// public InterfaceTypeConfiguration( string name, diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ObjectFieldConfiguration.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ObjectFieldConfiguration.cs index 269ee25244e..b4a399884ff 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ObjectFieldConfiguration.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ObjectFieldConfiguration.cs @@ -23,7 +23,7 @@ public class ObjectFieldConfiguration : OutputFieldConfiguration private bool _resultConvertersCleaned; /// - /// Initializes a new instance of . + /// Initializes a new instance of . /// public ObjectFieldConfiguration() { @@ -31,7 +31,7 @@ public ObjectFieldConfiguration() } /// - /// Initializes a new instance of . + /// Initializes a new instance of . /// public ObjectFieldConfiguration( string name, diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ObjectTypeDefinition.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ObjectTypeConfiguration.cs similarity index 95% rename from src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ObjectTypeDefinition.cs rename to src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ObjectTypeConfiguration.cs index dbdab92dd3e..830bdf8bf02 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ObjectTypeDefinition.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ObjectTypeConfiguration.cs @@ -9,8 +9,8 @@ namespace HotChocolate.Types.Descriptors.Definitions; /// /// Defines the properties of a GraphQL object type. /// -public class ObjectTypeDefinition - : TypeDefinitionBase +public class ObjectTypeConfiguration + : TypeConfiguration , IComplexOutputTypeConfiguration { private List? _knownClrTypes; @@ -19,14 +19,14 @@ public class ObjectTypeDefinition private FieldBindingFlags _fieldBindingFlags = FieldBindingFlags.Instance; /// - /// Initializes a new instance of . + /// Initializes a new instance of . /// - public ObjectTypeDefinition() { } + public ObjectTypeConfiguration() { } /// - /// Initializes a new instance of . + /// Initializes a new instance of . /// - public ObjectTypeDefinition( + public ObjectTypeConfiguration( string name, string? description = null, Type? runtimeType = null) @@ -179,7 +179,7 @@ internal IReadOnlyList GetFieldIgnores() return _fieldIgnores; } - protected internal void CopyTo(ObjectTypeDefinition target) + protected internal void CopyTo(ObjectTypeConfiguration target) { base.CopyTo(target); @@ -218,7 +218,7 @@ protected internal void CopyTo(ObjectTypeDefinition target) target.IsExtension = IsExtension; } - protected internal void MergeInto(ObjectTypeDefinition target) + protected internal void MergeInto(ObjectTypeConfiguration target) { base.MergeInto(target); diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/CompleteConfiguration.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/OnCompleteTypeSystemConfigurationTask.cs similarity index 86% rename from src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/CompleteConfiguration.cs rename to src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/OnCompleteTypeSystemConfigurationTask.cs index 11f131aab64..05a73dd137b 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/CompleteConfiguration.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/OnCompleteTypeSystemConfigurationTask.cs @@ -4,10 +4,11 @@ namespace HotChocolate.Types.Descriptors.Definitions; -public sealed class CompleteConfiguration : CompleteConfiguration +public sealed class OnCompleteTypeSystemConfigurationTask + : OnCompleteTypeSystemConfigurationTask where TDefinition : ITypeSystemConfiguration { - public CompleteConfiguration( + public OnCompleteTypeSystemConfigurationTask( Action configure, TDefinition owner, ApplyConfigurationOn on, @@ -17,7 +18,7 @@ public CompleteConfiguration( { } - public CompleteConfiguration( + public OnCompleteTypeSystemConfigurationTask( Action configure, TDefinition owner, ApplyConfigurationOn on, @@ -27,12 +28,12 @@ public CompleteConfiguration( } } -public class CompleteConfiguration : ITypeSystemConfigurationTask +public class OnCompleteTypeSystemConfigurationTask : ITypeSystemConfigurationTask { private readonly Action _configure; private List? _dependencies; - public CompleteConfiguration( + public OnCompleteTypeSystemConfigurationTask( Action configure, ITypeSystemConfiguration owner, ApplyConfigurationOn on, @@ -54,7 +55,7 @@ public CompleteConfiguration( } } - public CompleteConfiguration( + public OnCompleteTypeSystemConfigurationTask( Action configure, ITypeSystemConfiguration owner, ApplyConfigurationOn on, @@ -104,6 +105,6 @@ public ITypeSystemConfigurationTask Copy(TypeSystemConfiguration newOwner) throw new ArgumentNullException(nameof(newOwner)); } - return new CompleteConfiguration(_configure, newOwner, On, Dependencies); + return new OnCompleteTypeSystemConfigurationTask(_configure, newOwner, On, Dependencies); } } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/CreateConfiguration.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/OnCreateTypeSystemConfigurationTask.cs similarity index 83% rename from src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/CreateConfiguration.cs rename to src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/OnCreateTypeSystemConfigurationTask.cs index 21d33a191ed..4ced5bff680 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/CreateConfiguration.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/OnCreateTypeSystemConfigurationTask.cs @@ -2,11 +2,11 @@ namespace HotChocolate.Types.Descriptors.Definitions; -public sealed class CreateConfiguration : ITypeSystemConfigurationTask +public sealed class OnCreateTypeSystemConfigurationTask : ITypeSystemConfigurationTask { private readonly Action _configure; - public CreateConfiguration( + public OnCreateTypeSystemConfigurationTask( Action configure, ITypeSystemConfiguration owner) { @@ -18,7 +18,7 @@ public CreateConfiguration( public ApplyConfigurationOn On => ApplyConfigurationOn.Create; - public IReadOnlyList Dependencies { get; } = Array.Empty(); + public IReadOnlyList Dependencies { get; } = []; public void AddDependency(TypeDependency dependency) => throw new NotSupportedException( @@ -34,6 +34,6 @@ public ITypeSystemConfigurationTask Copy(TypeSystemConfiguration newOwner) throw new ArgumentNullException(nameof(newOwner)); } - return new CreateConfiguration(_configure, newOwner); + return new OnCreateTypeSystemConfigurationTask(_configure, newOwner); } } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ScalarTypeDefinition.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ScalarTypeConfiguration.cs similarity index 75% rename from src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ScalarTypeDefinition.cs rename to src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ScalarTypeConfiguration.cs index cc1a58975f6..96e812d2027 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ScalarTypeDefinition.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ScalarTypeConfiguration.cs @@ -5,7 +5,7 @@ namespace HotChocolate.Types.Descriptors.Definitions; /// /// Defines the properties of a GraphQL scalar type. /// -public sealed class ScalarTypeDefinition : TypeDefinitionBase +public sealed class ScalarTypeConfiguration : TypeConfiguration { public Uri? SpecifiedBy { get; set; } } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/SchemaTypeDefinition.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/SchemaTypeConfiguration.cs similarity index 87% rename from src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/SchemaTypeDefinition.cs rename to src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/SchemaTypeConfiguration.cs index 65e64f6bfeb..06ea707d568 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/SchemaTypeDefinition.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/SchemaTypeConfiguration.cs @@ -4,7 +4,7 @@ namespace HotChocolate.Types.Descriptors.Definitions; -public class SchemaTypeDefinition : TypeSystemConfiguration, IFeatureProvider +public class SchemaTypeConfiguration : TypeSystemConfiguration, IFeatureProvider { private List? _directives; @@ -37,7 +37,7 @@ internal IReadOnlyList GetDirectives() internal IDirectiveConfigurationProvider GetLegacyDefinition() => new CompatibilityLayer(this); - private class CompatibilityLayer(SchemaTypeDefinition definition) : IDirectiveConfigurationProvider + private class CompatibilityLayer(SchemaTypeConfiguration definition) : IDirectiveConfigurationProvider { public bool HasDirectives => definition.HasDirectives; diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/TypeDefinitionBase~1.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/TypeConfiguration.cs similarity index 88% rename from src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/TypeDefinitionBase~1.cs rename to src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/TypeConfiguration.cs index 87fe0aa12d1..a8987baf846 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/TypeDefinitionBase~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/TypeConfiguration.cs @@ -5,14 +5,14 @@ namespace HotChocolate.Types.Descriptors.Definitions; /// /// A definition that represents a type. /// -public class TypeDefinitionBase : TypeSystemConfiguration, ITypeDefinition +public abstract class TypeConfiguration : TypeSystemConfiguration, ITypeConfiguration { private List? _directives; private Type _runtimeType = typeof(object); - protected TypeDefinitionBase() { } + protected TypeConfiguration() { } - protected TypeDefinitionBase(Type runtimeType) + protected TypeConfiguration(Type runtimeType) { _runtimeType = runtimeType; } @@ -61,7 +61,7 @@ public IReadOnlyList GetDirectives() return _directives; } - protected void CopyTo(TypeDefinitionBase target) + protected void CopyTo(TypeConfiguration target) { base.CopyTo(target); @@ -74,7 +74,7 @@ protected void CopyTo(TypeDefinitionBase target) } } - protected void MergeInto(TypeDefinitionBase target) + protected void MergeInto(TypeConfiguration target) { base.MergeInto(target); diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/UnionTypeDefinition.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/UnionTypeDefinition.cs index f7130b36f3d..e518ee7de06 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/UnionTypeDefinition.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/UnionTypeDefinition.cs @@ -7,17 +7,17 @@ namespace HotChocolate.Types.Descriptors.Definitions; /// /// Defines the properties of a GraphQL union type. /// -public class UnionTypeDefinition : TypeDefinitionBase +public class UnionTypeConfiguration : TypeConfiguration { /// - /// Initializes a new instance of . + /// Initializes a new instance of . /// - public UnionTypeDefinition() { } + public UnionTypeConfiguration() { } /// - /// Initializes a new instance of . + /// Initializes a new instance of . /// - public UnionTypeDefinition( + public UnionTypeConfiguration( string name, string? description = null, Type? runtimeType = null) diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/DescriptorBase~1.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/DescriptorBase~1.cs index a8ced815351..4e7c5108e7e 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/DescriptorBase~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/DescriptorBase~1.cs @@ -9,7 +9,7 @@ public abstract class DescriptorBase(IDescriptorContext context) : IDescriptor , IDescriptorExtension , IDescriptorExtension - , IDefinitionFactory + , IConfigurationFactory where T : TypeSystemConfiguration { protected internal IDescriptorContext Context { get; } = @@ -19,7 +19,7 @@ public abstract class DescriptorBase(IDescriptorContext context) protected internal abstract T Definition { get; protected set; } - T IDescriptorExtension.Definition => Definition; + T IDescriptorExtension.Configuration => Definition; public IDescriptorExtension Extend() => this; @@ -49,7 +49,7 @@ public IDescriptorExtension ExtendWith( } - public T CreateDefinition() + public T CreateConfiguration() { OnCreateDefinition(Definition); @@ -63,7 +63,7 @@ public T CreateDefinition() if (configurations[i] is { On: ApplyConfigurationOn.Create, } config) { configurations.RemoveAt(i); - ((CreateConfiguration)config).Configure(Context); + ((OnCreateTypeSystemConfigurationTask)config).Configure(Context); } else { @@ -79,8 +79,8 @@ protected virtual void OnCreateDefinition(T definition) { } - TypeSystemConfiguration IDefinitionFactory.CreateDefinition() - => CreateDefinition(); + TypeSystemConfiguration IConfigurationFactory.CreateConfiguration() + => CreateConfiguration(); void IDescriptorExtension.OnBeforeCreate( Action configure) @@ -105,7 +105,7 @@ private void OnBeforeCreate(Action configure) throw new ArgumentNullException(nameof(configure)); } - Definition.Configurations.Add(new CreateConfiguration( + Definition.Configurations.Add(new OnCreateTypeSystemConfigurationTask( (c, d) => configure(c, (T)d), Definition)); } @@ -126,7 +126,7 @@ private INamedDependencyDescriptor OnBeforeNaming( throw new ArgumentNullException(nameof(configure)); } - var configuration = new CompleteConfiguration( + var configuration = new OnCompleteTypeSystemConfigurationTask( (c, d) => configure(c, (T)d), Definition, ApplyConfigurationOn.BeforeNaming); @@ -147,7 +147,7 @@ ICompletedDependencyDescriptor IDescriptorExtension.OnBeforeCompletion( private ICompletedDependencyDescriptor OnBeforeCompletion( Action configure) { - var configuration = new CompleteConfiguration( + var configuration = new OnCompleteTypeSystemConfigurationTask( (c, d) => configure(c, (T)d), Definition, ApplyConfigurationOn.BeforeCompletion); diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/DirectiveTypeDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/DirectiveTypeDescriptor.cs index b18fb200f4e..d664addd2e1 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/DirectiveTypeDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/DirectiveTypeDescriptor.cs @@ -68,7 +68,7 @@ protected override void OnCreateDefinition( var handledMembers = new HashSet(); FieldDescriptorUtilities.AddExplicitFields( - Arguments.Select(t => t.CreateDefinition()), + Arguments.Select(t => t.CreateConfiguration()), f => f.Property, arguments, handledMembers); diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/DirectiveTypeDescriptor~1.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/DirectiveTypeDescriptor~1.cs index 338e299beb5..801981c9a0b 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/DirectiveTypeDescriptor~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/DirectiveTypeDescriptor~1.cs @@ -39,7 +39,7 @@ protected override void OnCompleteArguments( this, p => DirectiveArgumentDescriptor .New(Context, p) - .CreateDefinition(), + .CreateConfiguration(), arguments, handledProperties); } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/EnumTypeDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/EnumTypeDescriptor.cs index 2c0cad5ee98..35fc60ddc0f 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/EnumTypeDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/EnumTypeDescriptor.cs @@ -49,7 +49,7 @@ protected override void OnCreateDefinition( Definition.AttributesAreApplied = true; } - var values = Values.Select(t => t.CreateDefinition()).ToDictionary(t => t.RuntimeValue); + var values = Values.Select(t => t.CreateConfiguration()).ToDictionary(t => t.RuntimeValue); AddImplicitValues(definition, values); definition.Values.Clear(); @@ -79,7 +79,7 @@ protected void AddImplicitValues( var valueDefinition = EnumValueDescriptor.New(Context, value) - .CreateDefinition(); + .CreateConfiguration(); if (valueDefinition.RuntimeValue is not null) { diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Extensions/DescriptorExtensions.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Extensions/DescriptorExtensions.cs index a2e89850fe3..d7154d37fc2 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Extensions/DescriptorExtensions.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Extensions/DescriptorExtensions.cs @@ -6,7 +6,7 @@ namespace HotChocolate.Types.Descriptors; public static class DescriptorExtensions { public static ObjectTypeDescriptor ToDescriptor( - this ObjectTypeDefinition definition, + this ObjectTypeConfiguration definition, IDescriptorContext context) => ObjectTypeDescriptor.From(context, definition); @@ -32,6 +32,6 @@ public static EnumValueDescriptor ToDescriptor( public static T ToDefinition(this IDescriptor descriptor) where T : TypeSystemConfiguration => descriptor is DescriptorBase desc - ? desc.CreateDefinition() + ? desc.CreateConfiguration() : throw new NotSupportedException("The specified descriptor is not supported."); } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/InputObjectTypeDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/InputObjectTypeDescriptor.cs index cb2584471b2..cf783f5887e 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/InputObjectTypeDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/InputObjectTypeDescriptor.cs @@ -73,7 +73,7 @@ protected override void OnCreateDefinition( foreach (var fieldDescriptor in _fields) { - var fieldDefinition = fieldDescriptor.CreateDefinition(); + var fieldDefinition = fieldDescriptor.CreateConfiguration(); if (!fieldDefinition.Ignore && !string.IsNullOrEmpty(fieldDefinition.Name)) { @@ -128,7 +128,7 @@ protected void InferFieldsFromFieldBindingType( // the create definition call will trigger the OnCompleteField call // on the field description and trigger the initialization of the // fields arguments. - fields[name] = descriptor.CreateDefinition(); + fields[name] = descriptor.CreateConfiguration(); } } } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/InterfaceTypeDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/InterfaceTypeDescriptor.cs index 89b6ff8210b..378f854d78a 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/InterfaceTypeDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/InterfaceTypeDescriptor.cs @@ -70,7 +70,7 @@ protected override void OnCreateDefinition( var handledMembers = new HashSet(); FieldDescriptorUtilities.AddExplicitFields( - Fields.Select(t => t.CreateDefinition()), + Fields.Select(t => t.CreateConfiguration()), f => f.Member, fields, handledMembers); diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/InterfaceTypeDescriptor~1.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/InterfaceTypeDescriptor~1.cs index c263c0ac1ad..05359b57062 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/InterfaceTypeDescriptor~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/InterfaceTypeDescriptor~1.cs @@ -36,7 +36,7 @@ protected override void OnCompleteFields( { FieldDescriptorUtilities.AddImplicitFields( this, - p => InterfaceFieldDescriptor.New(Context, p).CreateDefinition(), + p => InterfaceFieldDescriptor.New(Context, p).CreateConfiguration(), fields, handledMembers); } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/NamedDependencyDescriptor~1.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/NamedDependencyDescriptor~1.cs index b764411c347..2908dbfaca3 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/NamedDependencyDescriptor~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/NamedDependencyDescriptor~1.cs @@ -8,7 +8,7 @@ internal class NamedDependencyDescriptor { public NamedDependencyDescriptor( ITypeInspector typeInspector, - CompleteConfiguration configuration) + OnCompleteTypeSystemConfigurationTask configuration) : base(typeInspector, configuration) { } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/ObjectTypeDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/ObjectTypeDescriptor.cs index a78e36d0e9f..5a7b600f40b 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/ObjectTypeDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/ObjectTypeDescriptor.cs @@ -12,7 +12,7 @@ namespace HotChocolate.Types.Descriptors; public class ObjectTypeDescriptor - : DescriptorBase + : DescriptorBase , IObjectTypeDescriptor { private readonly List _fields = []; @@ -38,7 +38,7 @@ protected ObjectTypeDescriptor(IDescriptorContext context) protected ObjectTypeDescriptor( IDescriptorContext context, - ObjectTypeDefinition definition) + ObjectTypeConfiguration definition) : base(context) { Definition = definition ?? throw new ArgumentNullException(nameof(definition)); @@ -49,12 +49,12 @@ protected ObjectTypeDescriptor( } } - protected internal override ObjectTypeDefinition Definition { get; protected set; } = new(); + protected internal override ObjectTypeConfiguration Definition { get; protected set; } = new(); protected ICollection Fields => _fields; protected override void OnCreateDefinition( - ObjectTypeDefinition definition) + ObjectTypeConfiguration definition) { Context.Descriptors.Push(this); @@ -96,7 +96,7 @@ protected override void OnCreateDefinition( foreach (var fieldDescriptor in _fields) { - var fieldDefinition = fieldDescriptor.CreateDefinition(); + var fieldDefinition = fieldDescriptor.CreateConfiguration(); if (!fieldDefinition.Ignore && !string.IsNullOrEmpty(fieldDefinition.Name)) { @@ -192,7 +192,7 @@ private protected void InferFieldsFromFieldBindingType( // the create definition call will trigger the OnCompleteField call // on the field description and trigger the initialization of the // fields arguments. - fields[name] = descriptor.CreateDefinition(); + fields[name] = descriptor.CreateConfiguration(); } } } @@ -442,11 +442,11 @@ public static ObjectTypeDescriptor FromSchemaType( public static ObjectTypeDescriptor From( IDescriptorContext context, - ObjectTypeDefinition definition) => + ObjectTypeConfiguration definition) => new(context, definition); public static ObjectTypeDescriptor From( IDescriptorContext context, - ObjectTypeDefinition definition) => + ObjectTypeConfiguration definition) => new(context, definition); } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/ObjectTypeDescriptorBase~1.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/ObjectTypeDescriptorBase~1.cs index f43f5125b69..3b181c71700 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/ObjectTypeDescriptorBase~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/ObjectTypeDescriptorBase~1.cs @@ -22,7 +22,7 @@ protected ObjectTypeDescriptorBase( protected ObjectTypeDescriptorBase( IDescriptorContext context, - ObjectTypeDefinition definition) + ObjectTypeConfiguration definition) : base(context, definition) { } Type IHasRuntimeType.RuntimeType => Definition.RuntimeType; diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/ObjectTypeDescriptor~1.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/ObjectTypeDescriptor~1.cs index 980018d99a3..39486a351bd 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/ObjectTypeDescriptor~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/ObjectTypeDescriptor~1.cs @@ -13,7 +13,7 @@ protected internal ObjectTypeDescriptor(IDescriptorContext context) protected internal ObjectTypeDescriptor( IDescriptorContext context, - ObjectTypeDefinition definition) + ObjectTypeConfiguration definition) : base(context, definition) { Definition = definition; diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/OutputFieldDescriptorBase.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/OutputFieldDescriptorBase.cs index 8758e156247..f728ae9fe4e 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/OutputFieldDescriptorBase.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/OutputFieldDescriptorBase.cs @@ -36,7 +36,7 @@ protected override void OnCreateDefinition(TDefinition definition) { foreach (var argument in Arguments) { - Definition.Arguments.Add(argument.CreateDefinition()); + Definition.Arguments.Add(argument.CreateConfiguration()); } } } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/ScalarTypeDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/ScalarTypeDescriptor.cs index b69ba5bfb83..9b9b36af7b8 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/ScalarTypeDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/ScalarTypeDescriptor.cs @@ -7,7 +7,7 @@ namespace HotChocolate.Types.Descriptors; public class ScalarTypeDescriptor - : DescriptorBase + : DescriptorBase , IScalarTypeDescriptor { protected ScalarTypeDescriptor(IDescriptorContext context) @@ -15,9 +15,9 @@ protected ScalarTypeDescriptor(IDescriptorContext context) { } - protected internal override ScalarTypeDefinition Definition { get; protected set; } = new(); + protected internal override ScalarTypeConfiguration Definition { get; protected set; } = new(); - protected override void OnCreateDefinition(ScalarTypeDefinition definition) + protected override void OnCreateDefinition(ScalarTypeConfiguration definition) { Context.Descriptors.Push(this); diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/SchemaTypeDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/SchemaTypeDescriptor.cs index 88def0c7357..65b1f424332 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/SchemaTypeDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/SchemaTypeDescriptor.cs @@ -5,7 +5,7 @@ namespace HotChocolate.Types.Descriptors; public class SchemaTypeDescriptor - : DescriptorBase + : DescriptorBase , ISchemaTypeDescriptor { protected SchemaTypeDescriptor(IDescriptorContext context, Type type) @@ -20,13 +20,13 @@ protected SchemaTypeDescriptor(IDescriptorContext context, Type type) protected SchemaTypeDescriptor( IDescriptorContext context, - SchemaTypeDefinition definition) + SchemaTypeConfiguration definition) : base(context) { Definition = definition; } - protected internal override SchemaTypeDefinition Definition { get; protected set; } = new(); + protected internal override SchemaTypeConfiguration Definition { get; protected set; } = new(); public ISchemaTypeDescriptor Name(string value) { @@ -69,6 +69,6 @@ public static SchemaTypeDescriptor New( public static SchemaTypeDescriptor From( IDescriptorContext context, - SchemaTypeDefinition definition) => + SchemaTypeConfiguration definition) => new SchemaTypeDescriptor(context, definition); } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/UnionTypeDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/UnionTypeDescriptor.cs index 0995daf928a..4f9cc65aad9 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/UnionTypeDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/UnionTypeDescriptor.cs @@ -5,7 +5,7 @@ namespace HotChocolate.Types.Descriptors; public class UnionTypeDescriptor - : DescriptorBase + : DescriptorBase , IUnionTypeDescriptor { protected UnionTypeDescriptor(IDescriptorContext context, Type clrType) @@ -23,7 +23,7 @@ protected UnionTypeDescriptor(IDescriptorContext context, Type clrType) protected UnionTypeDescriptor( IDescriptorContext context, - UnionTypeDefinition definition) + UnionTypeConfiguration definition) : base(context) { Definition = definition; @@ -35,9 +35,9 @@ protected UnionTypeDescriptor(IDescriptorContext context) Definition.RuntimeType = typeof(object); } - protected internal override UnionTypeDefinition Definition { get; protected set; } = new(); + protected internal override UnionTypeConfiguration Definition { get; protected set; } = new(); - protected override void OnCreateDefinition(UnionTypeDefinition definition) + protected override void OnCreateDefinition(UnionTypeConfiguration definition) { Context.Descriptors.Push(this); @@ -143,6 +143,6 @@ public static UnionTypeDescriptor FromSchemaType( public static UnionTypeDescriptor From( IDescriptorContext context, - UnionTypeDefinition definition) => + UnionTypeConfiguration definition) => new(context, definition); } diff --git a/src/HotChocolate/Core/src/Types/Types/DirectiveType.Initialization.cs b/src/HotChocolate/Core/src/Types/Types/DirectiveType.Initialization.cs index b008a28d47c..0e6ba49530b 100644 --- a/src/HotChocolate/Core/src/Types/Types/DirectiveType.Initialization.cs +++ b/src/HotChocolate/Core/src/Types/Types/DirectiveType.Initialization.cs @@ -25,7 +25,7 @@ protected override DirectiveTypeConfiguration CreateDefinition(ITypeDiscoveryCon context.DescriptorContext, GetType()); _configure!(descriptor); - return descriptor.CreateDefinition(); + return descriptor.CreateConfiguration(); } return Definition; diff --git a/src/HotChocolate/Core/src/Types/Types/DirectiveType~1.cs b/src/HotChocolate/Core/src/Types/Types/DirectiveType~1.cs index 7f68eb1c4b0..3fe160d4818 100644 --- a/src/HotChocolate/Core/src/Types/Types/DirectiveType~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/DirectiveType~1.cs @@ -30,7 +30,7 @@ protected override DirectiveTypeConfiguration CreateDefinition( _configure!(descriptor); _configure = null; - return descriptor.CreateDefinition(); + return descriptor.CreateConfiguration(); } protected virtual void Configure(IDirectiveTypeDescriptor descriptor) diff --git a/src/HotChocolate/Core/src/Types/Types/Directives/TagDirectiveConfigAttribute.cs b/src/HotChocolate/Core/src/Types/Types/Directives/TagDirectiveConfigAttribute.cs index 9690e529e37..485ff248061 100644 --- a/src/HotChocolate/Core/src/Types/Types/Directives/TagDirectiveConfigAttribute.cs +++ b/src/HotChocolate/Core/src/Types/Types/Directives/TagDirectiveConfigAttribute.cs @@ -13,7 +13,7 @@ protected override void OnConfigure( if (context.ContextData.TryGetValue(WellKnownContextData.TagOptions, out var value) && value is TagOptions { Mode: TagMode.ApolloFederation, }) { - descriptor.Extend().Definition.Locations = + descriptor.Extend().Configuration.Locations = DirectiveLocation.Object | DirectiveLocation.Interface | DirectiveLocation.Union | diff --git a/src/HotChocolate/Core/src/Types/Types/Directives/TagDirectiveExtensions.cs b/src/HotChocolate/Core/src/Types/Types/Directives/TagDirectiveExtensions.cs index e91dfefeef9..c14497326a3 100644 --- a/src/HotChocolate/Core/src/Types/Types/Directives/TagDirectiveExtensions.cs +++ b/src/HotChocolate/Core/src/Types/Types/Directives/TagDirectiveExtensions.cs @@ -461,10 +461,10 @@ private static void ApplyTag( case IDirectiveArgumentDescriptor desc: var extend = desc.Extend(); - extend.Definition.AddDirective( + extend.Configuration.AddDirective( new Tag(name), extend.Context.TypeInspector); - extend.Definition.Dependencies.Add( + extend.Configuration.Dependencies.Add( new TypeDependency( extend.Context.TypeInspector.GetTypeRef(typeof(Tag)), TypeDependencyFulfilled.Completed)); diff --git a/src/HotChocolate/Core/src/Types/Types/EnumType.Initialization.cs b/src/HotChocolate/Core/src/Types/Types/EnumType.Initialization.cs index e8002cf3e9e..349cbc9db11 100644 --- a/src/HotChocolate/Core/src/Types/Types/EnumType.Initialization.cs +++ b/src/HotChocolate/Core/src/Types/Types/EnumType.Initialization.cs @@ -70,7 +70,7 @@ protected override EnumTypeConfiguration CreateDefinition(ITypeDiscoveryContext context.DescriptorContext, GetType()); _configure!(descriptor); - return descriptor.CreateDefinition(); + return descriptor.CreateConfiguration(); } return Definition; diff --git a/src/HotChocolate/Core/src/Types/Types/EnumTypeExtension.cs b/src/HotChocolate/Core/src/Types/Types/EnumTypeExtension.cs index 50dd8f4e1b4..69fe987fdd2 100644 --- a/src/HotChocolate/Core/src/Types/Types/EnumTypeExtension.cs +++ b/src/HotChocolate/Core/src/Types/Types/EnumTypeExtension.cs @@ -61,7 +61,7 @@ protected override EnumTypeConfiguration CreateDefinition(ITypeDiscoveryContext { var descriptor = EnumTypeDescriptor.New(context.DescriptorContext); _configure!(descriptor); - return descriptor.CreateDefinition(); + return descriptor.CreateConfiguration(); } return Definition; diff --git a/src/HotChocolate/Core/src/Types/Types/EnumType~1.cs b/src/HotChocolate/Core/src/Types/Types/EnumType~1.cs index e188f9ba985..0be0480f95a 100644 --- a/src/HotChocolate/Core/src/Types/Types/EnumType~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/EnumType~1.cs @@ -85,6 +85,6 @@ protected override EnumTypeConfiguration CreateDefinition( _configure!(descriptor); _configure = null; - return descriptor.CreateDefinition(); + return descriptor.CreateConfiguration(); } } diff --git a/src/HotChocolate/Core/src/Types/Types/Extensions/ObjectFieldDescriptorExtensions.cs b/src/HotChocolate/Core/src/Types/Types/Extensions/ObjectFieldDescriptorExtensions.cs index e1727cf7df0..06c807d57da 100644 --- a/src/HotChocolate/Core/src/Types/Types/Extensions/ObjectFieldDescriptorExtensions.cs +++ b/src/HotChocolate/Core/src/Types/Types/Extensions/ObjectFieldDescriptorExtensions.cs @@ -130,7 +130,7 @@ public static IObjectFieldDescriptor UseRequestScope( throw new ArgumentNullException(nameof(descriptor)); } - descriptor.Extend().Definition.DependencyInjectionScope = DependencyInjectionScope.Request; + descriptor.Extend().Configuration.DependencyInjectionScope = DependencyInjectionScope.Request; return descriptor; } @@ -154,7 +154,7 @@ public static IObjectFieldDescriptor UseResolverScope( throw new ArgumentNullException(nameof(descriptor)); } - descriptor.Extend().Definition.DependencyInjectionScope = DependencyInjectionScope.Resolver; + descriptor.Extend().Configuration.DependencyInjectionScope = DependencyInjectionScope.Resolver; return descriptor; } } diff --git a/src/HotChocolate/Core/src/Types/Types/Factories/ObjectTypeFactory.cs b/src/HotChocolate/Core/src/Types/Types/Factories/ObjectTypeFactory.cs index 0aeef79b800..9efaf686c4f 100644 --- a/src/HotChocolate/Core/src/Types/Types/Factories/ObjectTypeFactory.cs +++ b/src/HotChocolate/Core/src/Types/Types/Factories/ObjectTypeFactory.cs @@ -15,7 +15,7 @@ public ObjectType Create(IDescriptorContext context, ObjectTypeDefinitionNode no var path = context.GetOrCreateDefinitionStack(); path.Clear(); - var typeDefinition = new ObjectTypeDefinition( + var typeDefinition = new ObjectTypeConfiguration( node.Name.Value, node.Description?.Value) { @@ -39,7 +39,7 @@ public ObjectTypeExtension Create(IDescriptorContext context, ObjectTypeExtensio var path = context.GetOrCreateDefinitionStack(); path.Clear(); - var typeDefinition = new ObjectTypeDefinition(node.Name.Value) + var typeDefinition = new ObjectTypeConfiguration(node.Name.Value) { BindTo = node.GetBindingValue(), }; @@ -58,7 +58,7 @@ public ObjectTypeExtension Create(IDescriptorContext context, ObjectTypeExtensio private static void DeclareFields( IDescriptorContext context, - ObjectTypeDefinition parent, + ObjectTypeConfiguration parent, IReadOnlyCollection fields, Stack path) { diff --git a/src/HotChocolate/Core/src/Types/Types/Factories/SchemaFirstTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/Types/Factories/SchemaFirstTypeInterceptor.cs index 3acb0381ab6..2d672c3791a 100644 --- a/src/HotChocolate/Core/src/Types/Types/Factories/SchemaFirstTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Factories/SchemaFirstTypeInterceptor.cs @@ -20,7 +20,7 @@ public override void OnAfterCompleteName( TypeSystemConfiguration definition) { if (_directives.TryGetValue(completionContext.Type.Name, out var directives) - && definition is ScalarTypeDefinition scalarTypeDef) + && definition is ScalarTypeConfiguration scalarTypeDef) { foreach (var directive in directives) { diff --git a/src/HotChocolate/Core/src/Types/Types/Factories/UnionTypeFactory.cs b/src/HotChocolate/Core/src/Types/Types/Factories/UnionTypeFactory.cs index e908912d0ff..176aa8e8aa7 100644 --- a/src/HotChocolate/Core/src/Types/Types/Factories/UnionTypeFactory.cs +++ b/src/HotChocolate/Core/src/Types/Types/Factories/UnionTypeFactory.cs @@ -13,7 +13,7 @@ public UnionType Create(IDescriptorContext context, UnionTypeDefinitionNode node var path = context.GetOrCreateDefinitionStack(); path.Clear(); - var typeDefinition = new UnionTypeDefinition( + var typeDefinition = new UnionTypeConfiguration( node.Name.Value, node.Description?.Value) { @@ -35,7 +35,7 @@ public UnionTypeExtension Create(IDescriptorContext context, UnionTypeExtensionN var path = context.GetOrCreateDefinitionStack(); path.Clear(); - var typeDefinition = new UnionTypeDefinition(node.Name.Value); + var typeDefinition = new UnionTypeConfiguration(node.Name.Value); typeDefinition.BindTo = node.GetBindingValue(); foreach (var namedType in node.Types) diff --git a/src/HotChocolate/Core/src/Types/Types/Helpers/FieldDescriptorUtilities.cs b/src/HotChocolate/Core/src/Types/Types/Helpers/FieldDescriptorUtilities.cs index 18cfd50ac75..c5b6e6e5ca3 100644 --- a/src/HotChocolate/Core/src/Types/Types/Helpers/FieldDescriptorUtilities.cs +++ b/src/HotChocolate/Core/src/Types/Types/Helpers/FieldDescriptorUtilities.cs @@ -127,7 +127,7 @@ public static void DiscoverArguments( var argumentDefinition = ArgumentDescriptor .New(context, parameter) - .CreateDefinition(); + .CreateConfiguration(); if (!string.IsNullOrEmpty(argumentDefinition.Name) && processedNames.Add(argumentDefinition.Name)) diff --git a/src/HotChocolate/Core/src/Types/Types/Helpers/TypeNameHelper.cs b/src/HotChocolate/Core/src/Types/Types/Helpers/TypeNameHelper.cs index b541112b3f7..4826be99b71 100644 --- a/src/HotChocolate/Core/src/Types/Types/Helpers/TypeNameHelper.cs +++ b/src/HotChocolate/Core/src/Types/Types/Helpers/TypeNameHelper.cs @@ -11,7 +11,7 @@ public static void AddNameFunction( IDescriptor descriptor, Func createName, Type dependency) - where TDefinition : TypeSystemConfiguration, ITypeDefinition + where TDefinition : TypeSystemConfiguration, ITypeConfiguration { if (descriptor is null) { @@ -42,7 +42,7 @@ public static void AddNameFunction( nameof(dependency)); } - descriptor.Extend().Definition.NeedsNameCompletion = true; + descriptor.Extend().Configuration.NeedsNameCompletion = true; descriptor .Extend() @@ -59,7 +59,7 @@ public static void AddNameFunction( IDescriptor descriptor, Func createName, TypeReference dependency) - where TDefinition : TypeSystemConfiguration, ITypeDefinition + where TDefinition : TypeSystemConfiguration, ITypeConfiguration { if (descriptor is null) { @@ -76,7 +76,7 @@ public static void AddNameFunction( throw new ArgumentNullException(nameof(dependency)); } - descriptor.Extend().Definition.NeedsNameCompletion = true; + descriptor.Extend().Configuration.NeedsNameCompletion = true; descriptor .Extend() diff --git a/src/HotChocolate/Core/src/Types/Types/InputObjectType.Initialization.cs b/src/HotChocolate/Core/src/Types/Types/InputObjectType.Initialization.cs index 63aaa35010c..fc9350ee78a 100644 --- a/src/HotChocolate/Core/src/Types/Types/InputObjectType.Initialization.cs +++ b/src/HotChocolate/Core/src/Types/Types/InputObjectType.Initialization.cs @@ -32,7 +32,7 @@ protected override InputObjectTypeConfiguration CreateDefinition(ITypeDiscoveryC context.DescriptorContext, GetType()); _configure!(descriptor); - return descriptor.CreateDefinition(); + return descriptor.CreateConfiguration(); } return Definition; diff --git a/src/HotChocolate/Core/src/Types/Types/InputObjectTypeExtension.cs b/src/HotChocolate/Core/src/Types/Types/InputObjectTypeExtension.cs index a6a4e881098..6b9d7832d39 100644 --- a/src/HotChocolate/Core/src/Types/Types/InputObjectTypeExtension.cs +++ b/src/HotChocolate/Core/src/Types/Types/InputObjectTypeExtension.cs @@ -65,7 +65,7 @@ protected override InputObjectTypeConfiguration CreateDefinition(ITypeDiscoveryC var descriptor = InputObjectTypeDescriptor.New( context.DescriptorContext); _configure!(descriptor); - return descriptor.CreateDefinition(); + return descriptor.CreateConfiguration(); } return Definition; diff --git a/src/HotChocolate/Core/src/Types/Types/InputObjectType~1.cs b/src/HotChocolate/Core/src/Types/Types/InputObjectType~1.cs index 183c1dff15e..c26a1c2539a 100644 --- a/src/HotChocolate/Core/src/Types/Types/InputObjectType~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/InputObjectType~1.cs @@ -29,7 +29,7 @@ protected override InputObjectTypeConfiguration CreateDefinition( _configure!(descriptor); _configure = null; - return descriptor.CreateDefinition(); + return descriptor.CreateConfiguration(); } protected virtual void Configure( diff --git a/src/HotChocolate/Core/src/Types/Types/Interceptors/FlagEnumTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/Types/Interceptors/FlagEnumTypeInterceptor.cs index 9079184ab63..8c97f400397 100644 --- a/src/HotChocolate/Core/src/Types/Types/Interceptors/FlagEnumTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Interceptors/FlagEnumTypeInterceptor.cs @@ -37,7 +37,7 @@ public override void OnBeforeRegisterDependencies( { switch (definition) { - case ObjectTypeDefinition o: + case ObjectTypeConfiguration o: ProcessOutputFields(o.Fields); break; @@ -113,7 +113,7 @@ private string CreateObjectType(Type type) var typeName = _namingConventions.GetTypeName(type) + _flagNameAddition; var desc = _namingConventions.GetTypeDescription(type, TypeKind.Enum); - var objectTypeDefinition = new ObjectTypeDefinition(typeName, desc) + var objectTypeDefinition = new ObjectTypeConfiguration(typeName, desc) { RuntimeType = typeof(Dictionary), }; diff --git a/src/HotChocolate/Core/src/Types/Types/Interceptors/InterfaceCompletionTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/Types/Interceptors/InterfaceCompletionTypeInterceptor.cs index 80c76124ca9..7617ab634d5 100644 --- a/src/HotChocolate/Core/src/Types/Types/Interceptors/InterfaceCompletionTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Interceptors/InterfaceCompletionTypeInterceptor.cs @@ -75,7 +75,7 @@ public override void OnTypesInitialized() // defines if this type has a concrete runtime type. private bool IsRelevant(TypeInfo typeInfo) { - if (typeInfo.Definition is ObjectTypeDefinition { IsExtension: true, } objectDef && + if (typeInfo.Definition is ObjectTypeConfiguration { IsExtension: true, } objectDef && objectDef.FieldBindingType != typeof(object)) { return true; @@ -87,7 +87,7 @@ private bool IsRelevant(TypeInfo typeInfo) private Type GetRuntimeType(TypeInfo typeInfo) { - if (typeInfo.Definition is ObjectTypeDefinition { IsExtension: true, } objectDef) + if (typeInfo.Definition is ObjectTypeConfiguration { IsExtension: true, } objectDef) { return objectDef.FieldBindingType ?? typeof(object); } @@ -124,7 +124,7 @@ public override void OnBeforeCompleteType( CompleteInterfacesAndFields(typeDef); } - if (definition is ObjectTypeDefinition { Interfaces: { Count: > 0, }, } objectTypeDef) + if (definition is ObjectTypeConfiguration { Interfaces: { Count: > 0, }, } objectTypeDef) { _completed.Clear(); _completedFields.Clear(); diff --git a/src/HotChocolate/Core/src/Types/Types/Interceptors/MiddlewareValidationTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/Types/Interceptors/MiddlewareValidationTypeInterceptor.cs index 98771b0fa39..25b75cfbddd 100644 --- a/src/HotChocolate/Core/src/Types/Types/Interceptors/MiddlewareValidationTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Interceptors/MiddlewareValidationTypeInterceptor.cs @@ -22,7 +22,7 @@ public override void OnAfterCompleteType( TypeSystemConfiguration definition) { if (completionContext.DescriptorContext.Options.ValidatePipelineOrder && - definition is ObjectTypeDefinition objectTypeDef) + definition is ObjectTypeConfiguration objectTypeDef) { foreach (var field in objectTypeDef.Fields) { diff --git a/src/HotChocolate/Core/src/Types/Types/Interceptors/ResolverTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/Types/Interceptors/ResolverTypeInterceptor.cs index 5edbfa74768..8ffa79c88be 100644 --- a/src/HotChocolate/Core/src/Types/Types/Interceptors/ResolverTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Interceptors/ResolverTypeInterceptor.cs @@ -12,7 +12,7 @@ namespace HotChocolate.Types.Interceptors; internal sealed class ResolverTypeInterceptor : TypeInterceptor { - private readonly List _typeDefs = []; + private readonly List _typeDefs = []; private readonly List _fieldResolvers; private readonly List<(string, Type)> _resolverTypeList; private readonly Dictionary _runtimeTypes; @@ -56,7 +56,7 @@ public override void OnAfterInitialize( TypeSystemConfiguration definition) { if (discoveryContext is { IsIntrospectionType: false, Type: IHasName namedType, } && - definition is ITypeDefinition { NeedsNameCompletion: false, } typeDef) + definition is ITypeConfiguration { NeedsNameCompletion: false, } typeDef) { if (typeDef.RuntimeType == typeof(object) && _runtimeTypes.TryGetValue(typeDef.Name, out var type)) @@ -82,7 +82,7 @@ public override IEnumerable RegisterMoreTypes( { switch (typeDef) { - case ObjectTypeDefinition otd: + case ObjectTypeConfiguration otd: TypeDependencyHelper.CollectDependencies(otd, list); break; @@ -100,7 +100,7 @@ public override void OnAfterCompleteName( TypeSystemConfiguration definition) { if (completionContext is { IsIntrospectionType: false, Type: IHasName namedType, } && - definition is ITypeDefinition typeDef) + definition is ITypeConfiguration typeDef) { if (typeDef.RuntimeType == typeof(object) && _runtimeTypes.TryGetValue(typeDef.Name, out var type)) @@ -124,7 +124,7 @@ private void ApplyResolver(CompletionContext context) { var completed = 0; - foreach (var objectTypeDef in _typeDefs.OfType()) + foreach (var objectTypeDef in _typeDefs.OfType()) { if (_configs.Contains(objectTypeDef.Name)) { @@ -157,7 +157,7 @@ private void ApplyResolver(CompletionContext context) private void ApplyResolverTypes( CompletionContext context, - ObjectTypeDefinition objectTypeDef) + ObjectTypeConfiguration objectTypeDef) { CollectResolverMembers(context, objectTypeDef.Name); @@ -172,7 +172,7 @@ private void ApplyResolverTypes( { field.ResolverMember = member; - ObjectFieldDescriptor.From(_context, field).CreateDefinition(); + ObjectFieldDescriptor.From(_context, field).CreateConfiguration(); map.Clear(); @@ -212,7 +212,7 @@ private void ApplySourceMembers(CompletionContext context) { switch (context.TypesToAnalyze.Dequeue()) { - case ObjectTypeDefinition objectTypeDef: + case ObjectTypeConfiguration objectTypeDef: ApplyObjectSourceMembers(context, objectTypeDef); break; @@ -229,7 +229,7 @@ private void ApplySourceMembers(CompletionContext context) private void ApplyObjectSourceMembers( CompletionContext context, - ObjectTypeDefinition objectTypeDef) + ObjectTypeConfiguration objectTypeDef) { var initialized = false; var map = TypeMemHelper.RentArgumentNameMap(); @@ -248,7 +248,7 @@ private void ApplyObjectSourceMembers( field.Member = member; TryBindArgumentRuntimeType(field, member); - ObjectFieldDescriptor.From(_context, field).CreateDefinition(); + ObjectFieldDescriptor.From(_context, field).CreateConfiguration(); if (!field.Resolvers.HasResolvers) { @@ -427,14 +427,14 @@ private void TryBindArgumentRuntimeType( } } - private IReadOnlyCollection? TrySetRuntimeTypeFromMember( + private IReadOnlyCollection? TrySetRuntimeTypeFromMember( CompletionContext context, TypeReference? typeRef, MemberInfo member) { if (typeRef is not null && _typeReferenceResolver.TryGetType(typeRef, out var type)) { - List? updated = null; + List? updated = null; Type? runtimeType = null; foreach (var typeDef in context.TypeDefs[type.NamedType().Name]) @@ -485,10 +485,10 @@ private sealed class CompletionContext public readonly Dictionary Members = new(); public readonly Dictionary Values = new(); public readonly Dictionary ValuesToName = new(); - public readonly Queue TypesToAnalyze = new(); - public readonly ILookup TypeDefs; + public readonly Queue TypesToAnalyze = new(); + public readonly ILookup TypeDefs; - public CompletionContext(List typeDefs) + public CompletionContext(List typeDefs) { TypeDefs = typeDefs.ToLookup(t => t.Name); } diff --git a/src/HotChocolate/Core/src/Types/Types/Interceptors/TypeValidationTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/Types/Interceptors/TypeValidationTypeInterceptor.cs index 91467a322ba..e00d9d5d778 100644 --- a/src/HotChocolate/Core/src/Types/Types/Interceptors/TypeValidationTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Interceptors/TypeValidationTypeInterceptor.cs @@ -19,7 +19,7 @@ public override void OnBeforeRegisterDependencies( switch (definition) { - case ObjectTypeDefinition od: + case ObjectTypeConfiguration od: ValidateObjectType(discoveryContext, od); return; @@ -31,7 +31,7 @@ public override void OnBeforeRegisterDependencies( ValidateInterfaceType(discoveryContext, id); return; - case UnionTypeDefinition ud: + case UnionTypeConfiguration ud: ValidateUnionType(discoveryContext, ud); return; @@ -70,7 +70,7 @@ private void ValidateDirectiveType( private void ValidateUnionType( ITypeDiscoveryContext context, - UnionTypeDefinition? definition) + UnionTypeConfiguration? definition) { if (definition is { RuntimeType: { } runtimeType, } && IsTypeSystemType(definition.RuntimeType)) @@ -83,7 +83,7 @@ private void ValidateUnionType( private void ValidateObjectType( ITypeDiscoveryContext context, - ObjectTypeDefinition definition) + ObjectTypeConfiguration definition) { if (definition is { RuntimeType: { } runtimeType, } && IsTypeSystemType(definition.RuntimeType)) diff --git a/src/HotChocolate/Core/src/Types/Types/InterfaceType.Initialization.cs b/src/HotChocolate/Core/src/Types/Types/InterfaceType.Initialization.cs index 0718618744e..3a9c59d552b 100644 --- a/src/HotChocolate/Core/src/Types/Types/InterfaceType.Initialization.cs +++ b/src/HotChocolate/Core/src/Types/Types/InterfaceType.Initialization.cs @@ -28,7 +28,7 @@ protected override InterfaceTypeConfiguration CreateDefinition( context.DescriptorContext, GetType()); _configure!(descriptor); - return descriptor.CreateDefinition(); + return descriptor.CreateConfiguration(); } return Definition; diff --git a/src/HotChocolate/Core/src/Types/Types/InterfaceTypeExtension.cs b/src/HotChocolate/Core/src/Types/Types/InterfaceTypeExtension.cs index acab6b2136b..c79013021eb 100644 --- a/src/HotChocolate/Core/src/Types/Types/InterfaceTypeExtension.cs +++ b/src/HotChocolate/Core/src/Types/Types/InterfaceTypeExtension.cs @@ -65,7 +65,7 @@ protected override InterfaceTypeConfiguration CreateDefinition(ITypeDiscoveryCon { var descriptor = InterfaceTypeDescriptor.New(context.DescriptorContext); _configure!(descriptor); - return descriptor.CreateDefinition(); + return descriptor.CreateConfiguration(); } return Definition; diff --git a/src/HotChocolate/Core/src/Types/Types/InterfaceType~1.cs b/src/HotChocolate/Core/src/Types/Types/InterfaceType~1.cs index 2e711ece486..5d7932a50d3 100644 --- a/src/HotChocolate/Core/src/Types/Types/InterfaceType~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/InterfaceType~1.cs @@ -26,7 +26,7 @@ protected override InterfaceTypeConfiguration CreateDefinition(ITypeDiscoveryCon context.DescriptorContext.TypeConfiguration.Apply(typeof(T), descriptor); - return descriptor.CreateDefinition(); + return descriptor.CreateConfiguration(); } protected virtual void Configure(IInterfaceTypeDescriptor descriptor) { } diff --git a/src/HotChocolate/Core/src/Types/Types/Introspection/IntrospectionFields.cs b/src/HotChocolate/Core/src/Types/Types/Introspection/IntrospectionFields.cs index 1e416f03084..74959889cf3 100644 --- a/src/HotChocolate/Core/src/Types/Types/Introspection/IntrospectionFields.cs +++ b/src/HotChocolate/Core/src/Types/Types/Introspection/IntrospectionFields.cs @@ -72,7 +72,7 @@ internal static ObjectFieldConfiguration CreateTypeNameField(IDescriptorContext .Description(TypeResources.TypeNameField_Description) .Type>(); - var definition = descriptor.Extend().Definition; + var definition = descriptor.Extend().Configuration; definition.PureResolver = _typeNameResolver; definition.Flags |= FieldFlags.TypeNameField; @@ -81,7 +81,7 @@ internal static ObjectFieldConfiguration CreateTypeNameField(IDescriptorContext private static ObjectFieldConfiguration CreateDefinition(ObjectFieldDescriptor descriptor) { - var definition = descriptor.CreateDefinition(); + var definition = descriptor.CreateConfiguration(); definition.IsIntrospectionField = true; return definition; } diff --git a/src/HotChocolate/Core/src/Types/Types/Introspection/IntrospectionTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/Types/Introspection/IntrospectionTypeInterceptor.cs index 8c3637eccf3..c412bdc6ec5 100644 --- a/src/HotChocolate/Core/src/Types/Types/Introspection/IntrospectionTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Introspection/IntrospectionTypeInterceptor.cs @@ -10,9 +10,9 @@ namespace HotChocolate.Types.Introspection; internal sealed class IntrospectionTypeInterceptor : TypeInterceptor { - private readonly List _objectTypeDefinitions = []; + private readonly List _objectTypeDefinitions = []; private IDescriptorContext _context = default!; - private ObjectTypeDefinition? _queryTypeDefinition; + private ObjectTypeConfiguration? _queryTypeDefinition; internal override uint Position => uint.MaxValue - 200; @@ -30,7 +30,7 @@ public override void OnAfterCompleteName( ITypeCompletionContext completionContext, TypeSystemConfiguration definition) { - if(completionContext.Type is ObjectType && definition is ObjectTypeDefinition typeDef) + if(completionContext.Type is ObjectType && definition is ObjectTypeConfiguration typeDef) { _objectTypeDefinitions.Add(typeDef); } @@ -38,7 +38,7 @@ public override void OnAfterCompleteName( public override void OnAfterResolveRootType( ITypeCompletionContext completionContext, - ObjectTypeDefinition definition, + ObjectTypeConfiguration definition, OperationType operationType) { if (operationType is OperationType.Query) diff --git a/src/HotChocolate/Core/src/Types/Types/Introspection/__AppliedDirective.cs b/src/HotChocolate/Core/src/Types/Types/Introspection/__AppliedDirective.cs index 9ce5a0d4628..fb96bc83b78 100644 --- a/src/HotChocolate/Core/src/Types/Types/Introspection/__AppliedDirective.cs +++ b/src/HotChocolate/Core/src/Types/Types/Introspection/__AppliedDirective.cs @@ -18,12 +18,12 @@ namespace HotChocolate.Types.Introspection; // ReSharper disable once InconsistentNaming internal sealed class __AppliedDirective : ObjectType { - protected override ObjectTypeDefinition CreateDefinition(ITypeDiscoveryContext context) + protected override ObjectTypeConfiguration CreateDefinition(ITypeDiscoveryContext context) { var nonNullStringType = Parse($"{ScalarNames.String}!"); var locationListType = Parse($"[{nameof(__DirectiveArgument)}!]!"); - return new ObjectTypeDefinition( + return new ObjectTypeConfiguration( Names.__AppliedDirective, TypeResources.AppliedDirective_Description, typeof(DirectiveNode)) diff --git a/src/HotChocolate/Core/src/Types/Types/Introspection/__Directive.cs b/src/HotChocolate/Core/src/Types/Types/Introspection/__Directive.cs index 5b8bc2c9473..5955114b3c5 100644 --- a/src/HotChocolate/Core/src/Types/Types/Introspection/__Directive.cs +++ b/src/HotChocolate/Core/src/Types/Types/Introspection/__Directive.cs @@ -14,7 +14,7 @@ namespace HotChocolate.Types.Introspection; // ReSharper disable once InconsistentNaming internal sealed class __Directive : ObjectType { - protected override ObjectTypeDefinition CreateDefinition(ITypeDiscoveryContext context) + protected override ObjectTypeConfiguration CreateDefinition(ITypeDiscoveryContext context) { var stringType = Create(ScalarNames.String); var nonNullStringType = Parse($"{ScalarNames.String}!"); @@ -22,7 +22,7 @@ protected override ObjectTypeDefinition CreateDefinition(ITypeDiscoveryContext c var argumentListType = Parse($"[{nameof(__InputValue)}!]!"); var locationListType = Parse($"[{nameof(__DirectiveLocation)}!]!"); - return new ObjectTypeDefinition( + return new ObjectTypeConfiguration( Names.__Directive, TypeResources.Directive_Description, typeof(DirectiveType)) diff --git a/src/HotChocolate/Core/src/Types/Types/Introspection/__DirectiveArgument.cs b/src/HotChocolate/Core/src/Types/Types/Introspection/__DirectiveArgument.cs index 56b096f5e23..e9e603e9825 100644 --- a/src/HotChocolate/Core/src/Types/Types/Introspection/__DirectiveArgument.cs +++ b/src/HotChocolate/Core/src/Types/Types/Introspection/__DirectiveArgument.cs @@ -20,11 +20,11 @@ namespace HotChocolate.Types.Introspection; // ReSharper disable once InconsistentNaming internal sealed class __DirectiveArgument : ObjectType { - protected override ObjectTypeDefinition CreateDefinition(ITypeDiscoveryContext context) + protected override ObjectTypeConfiguration CreateDefinition(ITypeDiscoveryContext context) { var nonNullStringType = Parse($"{ScalarNames.String}!"); - return new ObjectTypeDefinition( + return new ObjectTypeConfiguration( Names.__DirectiveArgument, TypeResources.DirectiveArgument_Description, runtimeType: typeof(ArgumentNode)) diff --git a/src/HotChocolate/Core/src/Types/Types/Introspection/__EnumValue.cs b/src/HotChocolate/Core/src/Types/Types/Introspection/__EnumValue.cs index 4f68af44f7b..c22a9d626d2 100644 --- a/src/HotChocolate/Core/src/Types/Types/Introspection/__EnumValue.cs +++ b/src/HotChocolate/Core/src/Types/Types/Introspection/__EnumValue.cs @@ -13,14 +13,14 @@ namespace HotChocolate.Types.Introspection; // ReSharper disable once InconsistentNaming internal sealed class __EnumValue : ObjectType { - protected override ObjectTypeDefinition CreateDefinition(ITypeDiscoveryContext context) + protected override ObjectTypeConfiguration CreateDefinition(ITypeDiscoveryContext context) { var stringType = Create(ScalarNames.String); var nonNullStringType = Parse($"{ScalarNames.String}!"); var nonNullBooleanType = Parse($"{ScalarNames.Boolean}!"); var appDirectiveListType = Parse($"[{nameof(__AppliedDirective)}!]!"); - var def = new ObjectTypeDefinition( + var def = new ObjectTypeConfiguration( Names.__EnumValue, EnumValue_Description, typeof(IEnumValue)) diff --git a/src/HotChocolate/Core/src/Types/Types/Introspection/__Field.cs b/src/HotChocolate/Core/src/Types/Types/Introspection/__Field.cs index 999418d7472..f127a0257f1 100644 --- a/src/HotChocolate/Core/src/Types/Types/Introspection/__Field.cs +++ b/src/HotChocolate/Core/src/Types/Types/Introspection/__Field.cs @@ -14,7 +14,7 @@ namespace HotChocolate.Types.Introspection; // ReSharper disable once InconsistentNaming internal sealed class __Field : ObjectType { - protected override ObjectTypeDefinition CreateDefinition(ITypeDiscoveryContext context) + protected override ObjectTypeConfiguration CreateDefinition(ITypeDiscoveryContext context) { var stringType = Create(ScalarNames.String); var nonNullStringType = Parse($"{ScalarNames.String}!"); @@ -23,7 +23,7 @@ protected override ObjectTypeDefinition CreateDefinition(ITypeDiscoveryContext c var argumentListType = Parse($"[{nameof(__InputValue)}!]!"); var directiveListType = Parse($"[{nameof(__AppliedDirective)}!]!"); - var def = new ObjectTypeDefinition( + var def = new ObjectTypeConfiguration( Names.__Field, TypeResources.Field_Description, typeof(IOutputField)) diff --git a/src/HotChocolate/Core/src/Types/Types/Introspection/__InputValue.cs b/src/HotChocolate/Core/src/Types/Types/Introspection/__InputValue.cs index eeffec1488d..06b9b7b2be2 100644 --- a/src/HotChocolate/Core/src/Types/Types/Introspection/__InputValue.cs +++ b/src/HotChocolate/Core/src/Types/Types/Introspection/__InputValue.cs @@ -15,7 +15,7 @@ namespace HotChocolate.Types.Introspection; // ReSharper disable once InconsistentNaming internal sealed class __InputValue : ObjectType { - protected override ObjectTypeDefinition CreateDefinition(ITypeDiscoveryContext context) + protected override ObjectTypeConfiguration CreateDefinition(ITypeDiscoveryContext context) { var stringType = Create(ScalarNames.String); var nonNullStringType = Parse($"{ScalarNames.String}!"); @@ -23,7 +23,7 @@ protected override ObjectTypeDefinition CreateDefinition(ITypeDiscoveryContext c var nonNullBooleanType = Parse($"{ScalarNames.Boolean}!"); var appDirectiveListType = Parse($"[{nameof(__AppliedDirective)}!]!"); - var def = new ObjectTypeDefinition( + var def = new ObjectTypeConfiguration( Names.__InputValue, InputValue_Description, typeof(IInputField)) diff --git a/src/HotChocolate/Core/src/Types/Types/Introspection/__Schema.cs b/src/HotChocolate/Core/src/Types/Types/Introspection/__Schema.cs index d9da3a034e5..050d53744a9 100644 --- a/src/HotChocolate/Core/src/Types/Types/Introspection/__Schema.cs +++ b/src/HotChocolate/Core/src/Types/Types/Introspection/__Schema.cs @@ -13,7 +13,7 @@ namespace HotChocolate.Types.Introspection; // ReSharper disable once InconsistentNaming internal sealed class __Schema : ObjectType { - protected override ObjectTypeDefinition CreateDefinition(ITypeDiscoveryContext context) + protected override ObjectTypeConfiguration CreateDefinition(ITypeDiscoveryContext context) { var stringType = Create(ScalarNames.String); var typeListType = Parse($"[{nameof(__Type)}!]!"); @@ -22,7 +22,7 @@ protected override ObjectTypeDefinition CreateDefinition(ITypeDiscoveryContext c var directiveListType = Parse($"[{nameof(__Directive)}!]!"); var appDirectiveListType = Parse($"[{nameof(__AppliedDirective)}!]!"); - var def = new ObjectTypeDefinition(Names.__Schema, Schema_Description, typeof(ISchema)) + var def = new ObjectTypeConfiguration(Names.__Schema, Schema_Description, typeof(ISchema)) { Fields = { diff --git a/src/HotChocolate/Core/src/Types/Types/Introspection/__Type.cs b/src/HotChocolate/Core/src/Types/Types/Introspection/__Type.cs index 74fa9ff852d..4015baae9f0 100644 --- a/src/HotChocolate/Core/src/Types/Types/Introspection/__Type.cs +++ b/src/HotChocolate/Core/src/Types/Types/Introspection/__Type.cs @@ -14,7 +14,7 @@ namespace HotChocolate.Types.Introspection; // ReSharper disable once InconsistentNaming internal sealed class __Type : ObjectType { - protected override ObjectTypeDefinition CreateDefinition(ITypeDiscoveryContext context) + protected override ObjectTypeConfiguration CreateDefinition(ITypeDiscoveryContext context) { var stringType = Create(ScalarNames.String); var booleanType = Create(ScalarNames.Boolean); @@ -27,7 +27,7 @@ protected override ObjectTypeDefinition CreateDefinition(ITypeDiscoveryContext c var inputValueListType = Parse($"[{nameof(__InputValue)}!]"); var directiveListType = Parse($"[{nameof(__AppliedDirective)}!]!"); - var def = new ObjectTypeDefinition( + var def = new ObjectTypeConfiguration( Names.__Type, TypeResources.Type_Description, typeof(IType)) diff --git a/src/HotChocolate/Core/src/Types/Types/NamedTypeBase.cs b/src/HotChocolate/Core/src/Types/Types/NamedTypeBase.cs index a3b1832c161..875a6b45ec4 100644 --- a/src/HotChocolate/Core/src/Types/Types/NamedTypeBase.cs +++ b/src/HotChocolate/Core/src/Types/Types/NamedTypeBase.cs @@ -18,12 +18,12 @@ public abstract class NamedTypeBase , IHasRuntimeType , IHasTypeIdentity , IHasTypeDefinition - where TDefinition : TypeSystemConfiguration, IDirectiveConfigurationProvider, ITypeDefinition + where TDefinition : TypeSystemConfiguration, IDirectiveConfigurationProvider, ITypeConfiguration { private IDirectiveCollection? _directives; private Type? _runtimeType; - ITypeDefinition? IHasTypeDefinition.Definition => Definition; + ITypeConfiguration? IHasTypeDefinition.Definition => Definition; /// public abstract TypeKind Kind { get; } @@ -132,7 +132,7 @@ protected void SetTypeIdentity(Type typeDefinitionOrIdentity) } } - private void UpdateRuntimeType(ITypeDefinition definition) + private void UpdateRuntimeType(ITypeConfiguration definition) => _runtimeType = definition.RuntimeType ?? typeof(object); public bool Equals(IType? other) diff --git a/src/HotChocolate/Core/src/Types/Types/NamedTypeExtensionBase.cs b/src/HotChocolate/Core/src/Types/Types/NamedTypeExtensionBase.cs index f34afcb99d2..7c2152917db 100644 --- a/src/HotChocolate/Core/src/Types/Types/NamedTypeExtensionBase.cs +++ b/src/HotChocolate/Core/src/Types/Types/NamedTypeExtensionBase.cs @@ -13,7 +13,7 @@ namespace HotChocolate.Types; public abstract class NamedTypeExtensionBase : TypeSystemObjectBase , INamedTypeExtensionMerger - where TDefinition : TypeSystemConfiguration, ITypeDefinition + where TDefinition : TypeSystemConfiguration, ITypeConfiguration { /// public abstract TypeKind Kind { get; } diff --git a/src/HotChocolate/Core/src/Types/Types/ObjectType.Initialization.cs b/src/HotChocolate/Core/src/Types/Types/ObjectType.Initialization.cs index 1aac10fbff0..9b7bb9f9c96 100644 --- a/src/HotChocolate/Core/src/Types/Types/ObjectType.Initialization.cs +++ b/src/HotChocolate/Core/src/Types/Types/ObjectType.Initialization.cs @@ -19,7 +19,7 @@ public partial class ObjectType private Action? _configure; private IsOfType? _isOfType; - protected override ObjectTypeDefinition CreateDefinition( + protected override ObjectTypeConfiguration CreateDefinition( ITypeDiscoveryContext context) { try @@ -36,7 +36,7 @@ protected override ObjectTypeDefinition CreateDefinition( context.DescriptorContext.TypeConfiguration.Apply(descriptor.Definition.Name, descriptor); } - return descriptor.CreateDefinition(); + return descriptor.CreateConfiguration(); } return Definition; @@ -49,7 +49,7 @@ protected override ObjectTypeDefinition CreateDefinition( protected override void OnRegisterDependencies( ITypeDiscoveryContext context, - ObjectTypeDefinition definition) + ObjectTypeConfiguration definition) { base.OnRegisterDependencies(context, definition); context.RegisterDependencies(definition); @@ -58,7 +58,7 @@ protected override void OnRegisterDependencies( protected override void OnCompleteType( ITypeCompletionContext context, - ObjectTypeDefinition definition) + ObjectTypeConfiguration definition) { base.OnCompleteType(context, definition); @@ -73,7 +73,7 @@ protected override void OnCompleteType( protected override void OnCompleteMetadata( ITypeCompletionContext context, - ObjectTypeDefinition definition) + ObjectTypeConfiguration definition) { base.OnCompleteMetadata(context, definition); @@ -85,7 +85,7 @@ protected override void OnCompleteMetadata( protected override void OnMakeExecutable( ITypeCompletionContext context, - ObjectTypeDefinition definition) + ObjectTypeConfiguration definition) { base.OnMakeExecutable(context, definition); @@ -97,7 +97,7 @@ protected override void OnMakeExecutable( protected override void OnFinalizeType( ITypeCompletionContext context, - ObjectTypeDefinition definition) + ObjectTypeConfiguration definition) { base.OnFinalizeType(context, definition); @@ -109,7 +109,7 @@ protected override void OnFinalizeType( protected virtual FieldCollection OnCompleteFields( ITypeCompletionContext context, - ObjectTypeDefinition definition) + ObjectTypeConfiguration definition) { var interfaceFields = TypeMemHelper.RentInterfaceFieldDefinitionMap(); var processed = TypeMemHelper.RentNameSet(); @@ -194,7 +194,7 @@ private void CompleteTypeResolver(ITypeCompletionContext context) private bool ValidateFields( ITypeCompletionContext context, - ObjectTypeDefinition definition) + ObjectTypeConfiguration definition) { var hasErrors = false; diff --git a/src/HotChocolate/Core/src/Types/Types/ObjectType.cs b/src/HotChocolate/Core/src/Types/Types/ObjectType.cs index c908831ace6..f30d7f4a090 100644 --- a/src/HotChocolate/Core/src/Types/Types/ObjectType.cs +++ b/src/HotChocolate/Core/src/Types/Types/ObjectType.cs @@ -21,7 +21,7 @@ namespace HotChocolate.Types; /// GraphQL’s introspection system. /// public partial class ObjectType - : NamedTypeBase + : NamedTypeBase , IObjectType { /// @@ -56,7 +56,7 @@ public ObjectType(Action configure) /// /// Returns the newly created object type. /// - public static ObjectType CreateUnsafe(ObjectTypeDefinition definition) + public static ObjectType CreateUnsafe(ObjectTypeConfiguration definition) => new() { Definition = definition, }; /// diff --git a/src/HotChocolate/Core/src/Types/Types/ObjectTypeExtension.cs b/src/HotChocolate/Core/src/Types/Types/ObjectTypeExtension.cs index 05a05c41787..b934a190d3f 100644 --- a/src/HotChocolate/Core/src/Types/Types/ObjectTypeExtension.cs +++ b/src/HotChocolate/Core/src/Types/Types/ObjectTypeExtension.cs @@ -19,7 +19,7 @@ namespace HotChocolate.Types; /// which is itself an extension of another GraphQL service. /// /// -public class ObjectTypeExtension : NamedTypeExtensionBase +public class ObjectTypeExtension : NamedTypeExtensionBase { private Action? _configure; @@ -55,13 +55,13 @@ public ObjectTypeExtension(Action configure) /// /// Returns the newly created object type. /// - public static ObjectTypeExtension CreateUnsafe(ObjectTypeDefinition definition) + public static ObjectTypeExtension CreateUnsafe(ObjectTypeConfiguration definition) => new() { Definition = definition, }; /// public override TypeKind Kind => TypeKind.Object; - protected override ObjectTypeDefinition CreateDefinition(ITypeDiscoveryContext context) + protected override ObjectTypeConfiguration CreateDefinition(ITypeDiscoveryContext context) { try { @@ -69,7 +69,7 @@ protected override ObjectTypeDefinition CreateDefinition(ITypeDiscoveryContext c { var descriptor = ObjectTypeDescriptor.New(context.DescriptorContext); _configure!(descriptor); - return descriptor.CreateDefinition(); + return descriptor.CreateConfiguration(); } return Definition; @@ -84,7 +84,7 @@ protected virtual void Configure(IObjectTypeDescriptor descriptor) { } protected override void OnRegisterDependencies( ITypeDiscoveryContext context, - ObjectTypeDefinition definition) + ObjectTypeConfiguration definition) { base.OnRegisterDependencies(context, definition); context.RegisterDependencies(definition); @@ -116,8 +116,8 @@ protected override void Merge( } private void ApplyGlobalFieldIgnores( - ObjectTypeDefinition extensionDef, - ObjectTypeDefinition typeDef) + ObjectTypeConfiguration extensionDef, + ObjectTypeConfiguration typeDef) { var fieldIgnores = extensionDef.GetFieldIgnores(); diff --git a/src/HotChocolate/Core/src/Types/Types/ObjectTypeExtension~1.cs b/src/HotChocolate/Core/src/Types/Types/ObjectTypeExtension~1.cs index b348d8baf25..1ed07e6f4ae 100644 --- a/src/HotChocolate/Core/src/Types/Types/ObjectTypeExtension~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/ObjectTypeExtension~1.cs @@ -38,7 +38,7 @@ public ObjectTypeExtension() _configure = Configure; } - protected override ObjectTypeDefinition CreateDefinition( + protected override ObjectTypeConfiguration CreateDefinition( ITypeDiscoveryContext context) { var descriptor = ObjectTypeDescriptor.NewExtension(context.DescriptorContext); @@ -46,7 +46,7 @@ protected override ObjectTypeDefinition CreateDefinition( _configure!(descriptor); _configure = null; - return descriptor.CreateDefinition(); + return descriptor.CreateConfiguration(); } /// diff --git a/src/HotChocolate/Core/src/Types/Types/ObjectType~1.cs b/src/HotChocolate/Core/src/Types/Types/ObjectType~1.cs index e36607a4018..9a87f117f40 100644 --- a/src/HotChocolate/Core/src/Types/Types/ObjectType~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/ObjectType~1.cs @@ -41,7 +41,7 @@ public ObjectType(Action> configure) public ObjectType() => _configure = Configure; - protected override ObjectTypeDefinition CreateDefinition( + protected override ObjectTypeConfiguration CreateDefinition( ITypeDiscoveryContext context) { var descriptor = ObjectTypeDescriptor.New(context.DescriptorContext); @@ -51,7 +51,7 @@ protected override ObjectTypeDefinition CreateDefinition( context.DescriptorContext.TypeConfiguration.Apply>(typeof(T), descriptor); - return descriptor.CreateDefinition(); + return descriptor.CreateConfiguration(); } /// diff --git a/src/HotChocolate/Core/src/Types/Types/Pagination/PagingHelper.cs b/src/HotChocolate/Core/src/Types/Types/Pagination/PagingHelper.cs index 6cb1860b91f..fc65ef6517a 100644 --- a/src/HotChocolate/Core/src/Types/Types/Pagination/PagingHelper.cs +++ b/src/HotChocolate/Core/src/Types/Types/Pagination/PagingHelper.cs @@ -32,10 +32,10 @@ internal static IObjectFieldDescriptor UsePaging( FieldMiddlewareConfiguration placeholder = new(_ => _ => default, key: Paging); - var definition = descriptor.Extend().Definition; + var definition = descriptor.Extend().Configuration; definition.MiddlewareDefinitions.Add(placeholder); definition.Configurations.Add( - new CompleteConfiguration( + new OnCompleteTypeSystemConfigurationTask( (c, d) => ApplyConfiguration( c, d, diff --git a/src/HotChocolate/Core/src/Types/Types/Relay/Attributes/NodeAttribute.cs b/src/HotChocolate/Core/src/Types/Types/Relay/Attributes/NodeAttribute.cs index f46e41a08f5..9d2d9467a5b 100644 --- a/src/HotChocolate/Core/src/Types/Types/Relay/Attributes/NodeAttribute.cs +++ b/src/HotChocolate/Core/src/Types/Types/Relay/Attributes/NodeAttribute.cs @@ -76,7 +76,7 @@ protected override void OnConfigure( completionContext.DescriptorContext, definition); nodeDescriptor.ConfigureNodeField(typeDescriptor); - typeDescriptor.CreateDefinition(); + typeDescriptor.CreateConfiguration(); // invoke completion explicitly. nodeDescriptor.OnCompleteDefinition(completionContext, definition); diff --git a/src/HotChocolate/Core/src/Types/Types/Relay/Descriptors/NodeDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Relay/Descriptors/NodeDescriptor.cs index 75da63c3954..8899df898ef 100644 --- a/src/HotChocolate/Core/src/Types/Types/Relay/Descriptors/NodeDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Relay/Descriptors/NodeDescriptor.cs @@ -41,7 +41,7 @@ public NodeDescriptor(IObjectTypeDescriptor descriptor, Type? nodeType = null) internal void OnCompleteDefinition( ITypeCompletionContext context, - ObjectTypeDefinition definition) + ObjectTypeConfiguration definition) => CompleteResolver(context, definition); internal void ConfigureNodeField(IObjectTypeDescriptor typeDescriptor) diff --git a/src/HotChocolate/Core/src/Types/Types/Relay/Descriptors/NodeDescriptorBase.cs b/src/HotChocolate/Core/src/Types/Types/Relay/Descriptors/NodeDescriptorBase.cs index 51d7e72a64f..8dbde929e82 100644 --- a/src/HotChocolate/Core/src/Types/Types/Relay/Descriptors/NodeDescriptorBase.cs +++ b/src/HotChocolate/Core/src/Types/Types/Relay/Descriptors/NodeDescriptorBase.cs @@ -114,7 +114,7 @@ public IObjectFieldDescriptor ResolveNodeWith(MethodInfo method) return ConfigureNodeField(); } - protected void CompleteResolver(ITypeCompletionContext context, ObjectTypeDefinition definition) + protected void CompleteResolver(ITypeCompletionContext context, ObjectTypeConfiguration definition) { var descriptorContext = context.DescriptorContext; @@ -123,7 +123,7 @@ protected void CompleteResolver(ITypeCompletionContext context, ObjectTypeDefini // we let the descriptor complete on the definition object. ObjectFieldDescriptor .From(descriptorContext, Definition.ResolverField) - .CreateDefinition(); + .CreateConfiguration(); // after that all middleware should be available on the field definition and we can // start compiling the resolver and the resolver pipeline. @@ -188,7 +188,7 @@ public static IObjectFieldDescriptor TryAdd(IObjectFieldDescriptor descriptor) } var formatter = (ResultFormatterConfiguration)value; - var converters = extensions.Definition.FormatterDefinitions; + var converters = extensions.Configuration.FormatterDefinitions; if (!converters.Contains(formatter)) { diff --git a/src/HotChocolate/Core/src/Types/Types/Relay/Descriptors/NodeDescriptor~1.cs b/src/HotChocolate/Core/src/Types/Types/Relay/Descriptors/NodeDescriptor~1.cs index c4984e48627..acaee8a7c15 100644 --- a/src/HotChocolate/Core/src/Types/Types/Relay/Descriptors/NodeDescriptor~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/Relay/Descriptors/NodeDescriptor~1.cs @@ -34,10 +34,10 @@ public NodeDescriptor(IObjectTypeDescriptor descriptor) // we use the CompleteConfiguration instead of the higher level api since // we want to target a specific event. - var ownerDef = _typeDescriptor.Implements().Extend().Definition; + var ownerDef = _typeDescriptor.Implements().Extend().Configuration; - var configuration = new CompleteConfiguration( - (c, d) => OnCompleteDefinition(c, (ObjectTypeDefinition)d), + var configuration = new OnCompleteTypeSystemConfigurationTask( + (c, d) => OnCompleteDefinition(c, (ObjectTypeConfiguration)d), ownerDef, ApplyConfigurationOn.AfterNaming); @@ -46,7 +46,7 @@ public NodeDescriptor(IObjectTypeDescriptor descriptor) private void OnCompleteDefinition( ITypeCompletionContext context, - ObjectTypeDefinition definition) + ObjectTypeConfiguration definition) { if (Definition.ResolverField is null) { diff --git a/src/HotChocolate/Core/src/Types/Types/Relay/Extensions/RelayIdFieldHelpers.cs b/src/HotChocolate/Core/src/Types/Types/Relay/Extensions/RelayIdFieldHelpers.cs index fbdd0a04b4b..0b7035ffd5a 100644 --- a/src/HotChocolate/Core/src/Types/Types/Relay/Extensions/RelayIdFieldHelpers.cs +++ b/src/HotChocolate/Core/src/Types/Types/Relay/Extensions/RelayIdFieldHelpers.cs @@ -70,7 +70,7 @@ public static void ApplyIdToField( // add serializer if globalID support is enabled. if (extend.Context.ContextData.ContainsKey(GlobalIdSupportEnabled)) { - ApplyIdToField(extend.Definition, typeName); + ApplyIdToField(extend.Configuration, typeName); } } } @@ -92,7 +92,7 @@ internal static void ApplyIdToField( key: WellKnownMiddleware.GlobalId); definition.FormatterDefinitions.Add(placeholder); - var configuration = new CompleteConfiguration( + var configuration = new OnCompleteTypeSystemConfigurationTask( (ctx, def) => AddSerializerToObjectField( ctx, (ObjectFieldConfiguration)def, diff --git a/src/HotChocolate/Core/src/Types/Types/Relay/NodeFieldTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/Types/Relay/NodeFieldTypeInterceptor.cs index 6865bdc5407..09ed2256a17 100644 --- a/src/HotChocolate/Core/src/Types/Types/Relay/NodeFieldTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Relay/NodeFieldTypeInterceptor.cs @@ -18,13 +18,13 @@ namespace HotChocolate.Types.Relay; internal sealed class NodeFieldTypeInterceptor : TypeInterceptor { private ITypeCompletionContext? _queryContext; - private ObjectTypeDefinition? _queryTypeDefinition; + private ObjectTypeConfiguration? _queryTypeDefinition; internal override uint Position => uint.MaxValue - 100; public override void OnAfterResolveRootType( ITypeCompletionContext completionContext, - ObjectTypeDefinition definition, + ObjectTypeConfiguration definition, OperationType operationType) { if (operationType is OperationType.Query) diff --git a/src/HotChocolate/Core/src/Types/Types/Relay/NodeIdSerializerTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/Types/Relay/NodeIdSerializerTypeInterceptor.cs index 03a250a1f2d..6ff7d0e849f 100644 --- a/src/HotChocolate/Core/src/Types/Types/Relay/NodeIdSerializerTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Relay/NodeIdSerializerTypeInterceptor.cs @@ -13,7 +13,7 @@ internal sealed class NodeIdSerializerTypeInterceptor : TypeInterceptor { public override void OnBeforeCompleteType(ITypeCompletionContext completionContext, TypeSystemConfiguration definition) { - if (definition is SchemaTypeDefinition schemaTypeDef) + if (definition is SchemaTypeConfiguration schemaTypeDef) { // we ensure that the serializer type map exists. if (!completionContext.DescriptorContext.ContextData.TryGetValue(SerializerTypes, out var value)) diff --git a/src/HotChocolate/Core/src/Types/Types/Relay/NodeResolverTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/Types/Relay/NodeResolverTypeInterceptor.cs index d694e03d2a5..40da7ab6508 100644 --- a/src/HotChocolate/Core/src/Types/Types/Relay/NodeResolverTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Relay/NodeResolverTypeInterceptor.cs @@ -26,7 +26,7 @@ internal sealed class NodeResolverTypeInterceptor : TypeInterceptor private ObjectType? QueryType { get; set; } - private ObjectTypeDefinition? TypeDef { get; set; } + private ObjectTypeConfiguration? TypeDef { get; set; } [MemberNotNullWhen(true, nameof(QueryType), nameof(TypeDef), nameof(CompletionContext))] private bool IsInitialized @@ -36,7 +36,7 @@ TypeDef is not null && public override void OnAfterResolveRootType( ITypeCompletionContext completionContext, - ObjectTypeDefinition definition, + ObjectTypeConfiguration definition, OperationType operationType) { // we are only interested in the query type to infer node resolvers. @@ -194,7 +194,7 @@ public override void OnAfterMakeExecutable() private static bool ImplementsNode( ITypeCompletionContext context, - ObjectTypeDefinition typeDef) + ObjectTypeConfiguration typeDef) { if (typeDef.Interfaces.Count > 0) { diff --git a/src/HotChocolate/Core/src/Types/Types/Relay/QueryFieldTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/Types/Relay/QueryFieldTypeInterceptor.cs index a4045e10b50..de22450500e 100644 --- a/src/HotChocolate/Core/src/Types/Types/Relay/QueryFieldTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Relay/QueryFieldTypeInterceptor.cs @@ -17,11 +17,11 @@ internal sealed class QueryFieldTypeInterceptor : TypeInterceptor private ITypeCompletionContext _context = default!; private ObjectType? _queryType; private ObjectFieldConfiguration _queryField = default!; - private ObjectTypeDefinition? _mutationDefinition; + private ObjectTypeConfiguration? _mutationDefinition; public override void OnAfterResolveRootType( ITypeCompletionContext completionContext, - ObjectTypeDefinition definition, + ObjectTypeConfiguration definition, OperationType operationType) { _context ??= completionContext; @@ -33,7 +33,7 @@ public override void OnAfterResolveRootType( break; case OperationType.Mutation: - _mutationDefinition = (ObjectTypeDefinition)definition; + _mutationDefinition = (ObjectTypeConfiguration)definition; break; } } @@ -70,7 +70,7 @@ public override void OnBeforeCompleteType( TypeSystemConfiguration definition) { if (completionContext.Type is ObjectType objectType - && definition is ObjectTypeDefinition objectTypeDef + && definition is ObjectTypeConfiguration objectTypeDef && _payloads.Contains(objectType.Name)) { if (objectTypeDef.Fields.Any(t => t.Name.EqualsOrdinal(_queryField.Name))) diff --git a/src/HotChocolate/Core/src/Types/Types/Scalars/AnyType.cs b/src/HotChocolate/Core/src/Types/Types/Scalars/AnyType.cs index 0c232da9793..bf561486958 100644 --- a/src/HotChocolate/Core/src/Types/Types/Scalars/AnyType.cs +++ b/src/HotChocolate/Core/src/Types/Types/Scalars/AnyType.cs @@ -39,7 +39,7 @@ public AnyType() : this(ScalarNames.Any) protected override void OnCompleteType( ITypeCompletionContext context, - ScalarTypeDefinition definition) + ScalarTypeConfiguration definition) { base.OnCompleteType(context, definition); _objectToDictConverter = new ObjectToDictionaryConverter(Converter); diff --git a/src/HotChocolate/Core/src/Types/Types/Scalars/ScalarType.Initialization.cs b/src/HotChocolate/Core/src/Types/Types/Scalars/ScalarType.Initialization.cs index 526ad343a8e..fad2c10fa6d 100644 --- a/src/HotChocolate/Core/src/Types/Types/Scalars/ScalarType.Initialization.cs +++ b/src/HotChocolate/Core/src/Types/Types/Scalars/ScalarType.Initialization.cs @@ -35,18 +35,18 @@ protected ScalarType(string name, BindingBehavior bind = BindingBehavior.Explici Directives = default!; } - protected override ScalarTypeDefinition CreateDefinition(ITypeDiscoveryContext context) + protected override ScalarTypeConfiguration CreateDefinition(ITypeDiscoveryContext context) { var descriptor = ScalarTypeDescriptor.New(context.DescriptorContext, Name, Description, GetType()); Configure(descriptor); - return descriptor.CreateDefinition(); + return descriptor.CreateConfiguration(); } protected virtual void Configure(IScalarTypeDescriptor descriptor) { } protected override void OnRegisterDependencies( ITypeDiscoveryContext context, - ScalarTypeDefinition definition) + ScalarTypeConfiguration definition) { base.OnRegisterDependencies(context, definition); @@ -68,7 +68,7 @@ protected override void OnRegisterDependencies( protected override void OnCompleteType( ITypeCompletionContext context, - ScalarTypeDefinition definition) + ScalarTypeConfiguration definition) { _converter = context.DescriptorContext.TypeConverter; var directiveDefinitions = definition.GetDirectives(); diff --git a/src/HotChocolate/Core/src/Types/Types/Scalars/ScalarType.cs b/src/HotChocolate/Core/src/Types/Types/Scalars/ScalarType.cs index f83e9a23c64..355dc7289d1 100644 --- a/src/HotChocolate/Core/src/Types/Types/Scalars/ScalarType.cs +++ b/src/HotChocolate/Core/src/Types/Types/Scalars/ScalarType.cs @@ -13,7 +13,7 @@ namespace HotChocolate.Types; /// the leaves on these trees are GraphQL scalars. /// public abstract partial class ScalarType - : TypeSystemObjectBase + : TypeSystemObjectBase , ILeafType , IHasDirectives { diff --git a/src/HotChocolate/Core/src/Types/Types/StaticObjectTypeExtension.cs b/src/HotChocolate/Core/src/Types/Types/StaticObjectTypeExtension.cs index 99d3520b4a3..a1b7bec0748 100644 --- a/src/HotChocolate/Core/src/Types/Types/StaticObjectTypeExtension.cs +++ b/src/HotChocolate/Core/src/Types/Types/StaticObjectTypeExtension.cs @@ -16,7 +16,7 @@ public StaticObjectTypeExtension(Type staticExtType) protected override void Configure(IObjectTypeDescriptor descriptor) { var context = descriptor.Extend().Context; - var definition = descriptor.Extend().Definition; + var definition = descriptor.Extend().Configuration; // we are using the non-generic type extension class which would set nothing. definition.Name = context.Naming.GetTypeName(_staticExtType, TypeKind.Object); diff --git a/src/HotChocolate/Core/src/Types/Types/TypeSystemObjectBase~1.cs b/src/HotChocolate/Core/src/Types/Types/TypeSystemObjectBase~1.cs index 4479b523e2d..6c5982ca458 100644 --- a/src/HotChocolate/Core/src/Types/Types/TypeSystemObjectBase~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/TypeSystemObjectBase~1.cs @@ -219,7 +219,7 @@ private static void ExecuteConfigurations( { if (config.On == on) { - ((CompleteConfiguration)config).Configure(context); + ((OnCompleteTypeSystemConfigurationTask)config).Configure(context); } } } diff --git a/src/HotChocolate/Core/src/Types/Types/UnionType.cs b/src/HotChocolate/Core/src/Types/Types/UnionType.cs index c773f74beee..2cb5b6abfef 100644 --- a/src/HotChocolate/Core/src/Types/Types/UnionType.cs +++ b/src/HotChocolate/Core/src/Types/Types/UnionType.cs @@ -43,7 +43,7 @@ namespace HotChocolate.Types; /// /// public class UnionType - : NamedTypeBase + : NamedTypeBase , IUnionType { private const string _typeReference = "typeReference"; @@ -85,7 +85,7 @@ public UnionType(Action configure) /// /// Returns the newly created union type. /// - public static UnionType CreateUnsafe(UnionTypeDefinition definition) + public static UnionType CreateUnsafe(UnionTypeConfiguration definition) => new() { Definition = definition, }; /// @@ -176,7 +176,7 @@ public bool ContainsType(string typeName) IObjectType? IUnionType.ResolveConcreteType(IResolverContext context, object resolverResult) => ResolveConcreteType(context, resolverResult); - protected override UnionTypeDefinition CreateDefinition(ITypeDiscoveryContext context) + protected override UnionTypeConfiguration CreateDefinition(ITypeDiscoveryContext context) { try { @@ -186,7 +186,7 @@ protected override UnionTypeDefinition CreateDefinition(ITypeDiscoveryContext co context.DescriptorContext, GetType()); _configure!(descriptor); - return descriptor.CreateDefinition(); + return descriptor.CreateConfiguration(); } return Definition; @@ -201,7 +201,7 @@ protected virtual void Configure(IUnionTypeDescriptor descriptor) { } protected override void OnRegisterDependencies( ITypeDiscoveryContext context, - UnionTypeDefinition definition) + UnionTypeConfiguration definition) { base.OnRegisterDependencies(context, definition); @@ -217,7 +217,7 @@ protected override void OnRegisterDependencies( protected override void OnCompleteType( ITypeCompletionContext context, - UnionTypeDefinition definition) + UnionTypeConfiguration definition) { base.OnCompleteType(context, definition); @@ -227,7 +227,7 @@ protected override void OnCompleteType( private void CompleteTypeSet( ITypeCompletionContext context, - UnionTypeDefinition definition) + UnionTypeConfiguration definition) { var typeSet = new HashSet(); @@ -250,7 +250,7 @@ private void CompleteTypeSet( protected virtual void OnCompleteTypeSet( ITypeCompletionContext context, - UnionTypeDefinition definition, + UnionTypeConfiguration definition, ISet typeSet) { foreach (var typeReference in definition.Types) diff --git a/src/HotChocolate/Core/src/Types/Types/UnionTypeExtension.cs b/src/HotChocolate/Core/src/Types/Types/UnionTypeExtension.cs index 95e41d58b0e..f908b6dd966 100644 --- a/src/HotChocolate/Core/src/Types/Types/UnionTypeExtension.cs +++ b/src/HotChocolate/Core/src/Types/Types/UnionTypeExtension.cs @@ -14,7 +14,7 @@ namespace HotChocolate.Types; /// local data, or by a GraphQL service which is itself an extension of another /// GraphQL service. /// -public class UnionTypeExtension : NamedTypeExtensionBase +public class UnionTypeExtension : NamedTypeExtensionBase { private Action? _configure; @@ -51,13 +51,13 @@ public UnionTypeExtension(Action configure) /// /// Returns the newly created union type extension. /// - public static UnionTypeExtension CreateUnsafe(UnionTypeDefinition definition) + public static UnionTypeExtension CreateUnsafe(UnionTypeConfiguration definition) => new() { Definition = definition, }; /// public override TypeKind Kind => TypeKind.Union; - protected override UnionTypeDefinition CreateDefinition(ITypeDiscoveryContext context) + protected override UnionTypeConfiguration CreateDefinition(ITypeDiscoveryContext context) { try { @@ -65,7 +65,7 @@ protected override UnionTypeDefinition CreateDefinition(ITypeDiscoveryContext co { var descriptor = UnionTypeDescriptor.New(context.DescriptorContext); _configure!(descriptor); - return descriptor.CreateDefinition(); + return descriptor.CreateConfiguration(); } return Definition; @@ -80,7 +80,7 @@ protected virtual void Configure(IUnionTypeDescriptor descriptor) { } protected override void OnRegisterDependencies( ITypeDiscoveryContext context, - UnionTypeDefinition definition) + UnionTypeConfiguration definition) { base.OnRegisterDependencies(context, definition); diff --git a/src/HotChocolate/Core/src/Types/Types/UnionType~1.cs b/src/HotChocolate/Core/src/Types/Types/UnionType~1.cs index 65f8930953e..1867528c6a9 100644 --- a/src/HotChocolate/Core/src/Types/Types/UnionType~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/UnionType~1.cs @@ -22,7 +22,7 @@ public UnionType() _configure = Configure; } - protected override UnionTypeDefinition CreateDefinition(ITypeDiscoveryContext context) + protected override UnionTypeConfiguration CreateDefinition(ITypeDiscoveryContext context) { var descriptor = UnionTypeDescriptor.New(context.DescriptorContext, typeof(T)); @@ -30,6 +30,6 @@ protected override UnionTypeDefinition CreateDefinition(ITypeDiscoveryContext co _configure!(descriptor); _configure = null; - return descriptor.CreateDefinition(); + return descriptor.CreateConfiguration(); } } diff --git a/src/HotChocolate/Core/test/Execution.Tests/Configuration/TypeModuleTests.cs b/src/HotChocolate/Core/test/Execution.Tests/Configuration/TypeModuleTests.cs index 0526732792d..5c9c32fc9e0 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/Configuration/TypeModuleTests.cs +++ b/src/HotChocolate/Core/test/Execution.Tests/Configuration/TypeModuleTests.cs @@ -134,14 +134,14 @@ public ValueTask> CreateTypesAsync( { var list = new List(); - var typeDefinition = new ObjectTypeDefinition("Query"); + var typeDefinition = new ObjectTypeConfiguration("Query"); typeDefinition.Fields.Add(new( "hello", type: TypeReference.Parse("String!"), pureResolver: _ => "world")); list.Add(ObjectType.CreateUnsafe(typeDefinition)); - var typeExtensionDefinition = new ObjectTypeDefinition("Person"); + var typeExtensionDefinition = new ObjectTypeConfiguration("Person"); typeExtensionDefinition.Fields.Add(new( "dynamic", type: TypeReference.Parse("String!"), diff --git a/src/HotChocolate/Core/test/Execution.Tests/Errors/ErrorBehaviorTests.cs b/src/HotChocolate/Core/test/Execution.Tests/Errors/ErrorBehaviorTests.cs index 407c69a297d..2a788f7818e 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/Errors/ErrorBehaviorTests.cs +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/ErrorBehaviorTests.cs @@ -114,7 +114,7 @@ public async Task Resolver_InvalidParentCast() .Type>() .Extend() // in the pure resolver we will return the wrong type - .Definition.Resolver = _ => new ValueTask(new Baz())) + .Configuration.Resolver = _ => new ValueTask(new Baz())) .BuildRequestExecutorAsync(); // act @@ -137,7 +137,7 @@ public async Task PureResolver_InvalidParentCast() .Type>() .Extend() // in the pure resolver we will return the wrong type - .Definition.PureResolver = _ => new Baz()) + .Configuration.PureResolver = _ => new Baz()) .BuildRequestExecutorAsync(); // act @@ -160,7 +160,7 @@ public async Task SetMaxAllowedValidationErrors_To_1() .Type>() .Extend() // in the pure resolver we will return the wrong type - .Definition.PureResolver = _ => new Baz()) + .Configuration.PureResolver = _ => new Baz()) .SetMaxAllowedValidationErrors(1) .BuildRequestExecutorAsync(); diff --git a/src/HotChocolate/Core/test/Types.Mutations.Tests/AnnotationBasedMutations.cs b/src/HotChocolate/Core/test/Types.Mutations.Tests/AnnotationBasedMutations.cs index ebf5afc2704..acd82b34afd 100644 --- a/src/HotChocolate/Core/test/Types.Mutations.Tests/AnnotationBasedMutations.cs +++ b/src/HotChocolate/Core/test/Types.Mutations.Tests/AnnotationBasedMutations.cs @@ -1412,7 +1412,7 @@ public override void OnBeforeCompleteType( ITypeCompletionContext completionContext, TypeSystemConfiguration definition) { - if (definition is not ObjectTypeDefinition objTypeDef) + if (definition is not ObjectTypeConfiguration objTypeDef) { return; } @@ -1422,7 +1422,7 @@ public override void OnBeforeRegisterDependencies( ITypeDiscoveryContext discoveryContext, TypeSystemConfiguration definition) { - if (definition is ObjectTypeDefinition objTypeDef) + if (definition is ObjectTypeConfiguration objTypeDef) { foreach (var fieldDef in objTypeDef.Fields) { diff --git a/src/HotChocolate/Core/test/Types.Tests/Configuration/TypeInitializationOrderTests.cs b/src/HotChocolate/Core/test/Types.Tests/Configuration/TypeInitializationOrderTests.cs index 64cedb73513..f38748f624a 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Configuration/TypeInitializationOrderTests.cs +++ b/src/HotChocolate/Core/test/Types.Tests/Configuration/TypeInitializationOrderTests.cs @@ -46,7 +46,7 @@ protected override void Configure(IObjectTypeDescriptor descriptor) c.TypeInspector.GetTypeRef(typeof(Word), TypeContext.Output); d.Configurations.Add( - new CompleteConfiguration( + new OnCompleteTypeSystemConfigurationTask( (context, _) => { var type = context.GetType(reference); diff --git a/src/HotChocolate/Core/test/Types.Tests/Configuration/TypeScopeInterceptorTests.cs b/src/HotChocolate/Core/test/Types.Tests/Configuration/TypeScopeInterceptorTests.cs index 4b118071f2d..f4be9994bbd 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Configuration/TypeScopeInterceptorTests.cs +++ b/src/HotChocolate/Core/test/Types.Tests/Configuration/TypeScopeInterceptorTests.cs @@ -81,7 +81,7 @@ public override void OnBeforeRegisterDependencies( ITypeDiscoveryContext discoveryContext, TypeSystemConfiguration definition) { - if (discoveryContext is { Scope: { }, } && definition is ObjectTypeDefinition def) + if (discoveryContext is { Scope: { }, } && definition is ObjectTypeConfiguration def) { _contexts.Add(discoveryContext); diff --git a/src/HotChocolate/Core/test/Types.Tests/Resolvers/ResolverCompilerTests.cs b/src/HotChocolate/Core/test/Types.Tests/Resolvers/ResolverCompilerTests.cs index 97502941395..ff36d44c06a 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Resolvers/ResolverCompilerTests.cs +++ b/src/HotChocolate/Core/test/Types.Tests/Resolvers/ResolverCompilerTests.cs @@ -1552,7 +1552,7 @@ protected override void OnConfigure( return n(c); }); - descriptor.Extend().Definition.ParameterExpressionBuilders.Add( + descriptor.Extend().Configuration.ParameterExpressionBuilders.Add( new CustomParameterExpressionBuilder( t => t.GetLocalState("foo")!)); } diff --git a/src/HotChocolate/Core/test/Types.Tests/SchemaBuilderTests.cs b/src/HotChocolate/Core/test/Types.Tests/SchemaBuilderTests.cs index d28b2041c94..ce4df7779e7 100644 --- a/src/HotChocolate/Core/test/Types.Tests/SchemaBuilderTests.cs +++ b/src/HotChocolate/Core/test/Types.Tests/SchemaBuilderTests.cs @@ -2182,7 +2182,7 @@ protected override void Configure(IObjectTypeDescriptor descriptor) } protected override void OnCompleteName( ITypeCompletionContext context, - ObjectTypeDefinition definition) + ObjectTypeConfiguration definition) { base.OnCompleteName(context, definition); Context = context.DescriptorContext; diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/ArgumentDescriptorTests.cs b/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/ArgumentDescriptorTests.cs index 8c13e08a8dd..b40c97ff910 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/ArgumentDescriptorTests.cs +++ b/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/ArgumentDescriptorTests.cs @@ -29,7 +29,7 @@ public void DotNetTypesDoNotOverwriteSchemaTypes() .Type>>(); // assert - var description = descriptor.CreateDefinition(); + var description = descriptor.CreateConfiguration(); var typeRef = description.Type; Assert.Equal(typeof(ListType), Assert.IsType(typeRef).Type.Source); @@ -45,7 +45,7 @@ public void SetTypeInstance() descriptor.Type(new StringType()); // assert - var description = descriptor.CreateDefinition(); + var description = descriptor.CreateConfiguration(); var typeRef = description.Type; Assert.IsType( Assert.IsType(typeRef).Type); @@ -61,7 +61,7 @@ public void SetGenericType() descriptor.Type(); // assert - var description = descriptor.CreateDefinition(); + var description = descriptor.CreateConfiguration(); var typeRef = description.Type; Assert.Equal( typeof(StringType), @@ -78,7 +78,7 @@ public void SetNonGenericType() descriptor.Type(typeof(StringType)); // assert - var description = descriptor.CreateDefinition(); + var description = descriptor.CreateConfiguration(); var typeRef = description.Type; Assert.Equal( typeof(StringType), @@ -97,7 +97,7 @@ public void SchemaTypesOverwriteDotNetTypes() .Type>(); // assert - var description = descriptor.CreateDefinition(); + var description = descriptor.CreateConfiguration(); var typeRef = description.Type; Assert.Equal( typeof(ListType), @@ -111,7 +111,7 @@ public void GetName() var descriptor = new ArgumentDescriptor(Context, "args"); // assert - Assert.Equal("args", descriptor.CreateDefinition().Name); + Assert.Equal("args", descriptor.CreateConfiguration().Name); } [Fact] @@ -122,7 +122,7 @@ public void GetNameAndType() Context, "args", typeof(string)); // assert - var description = descriptor.CreateDefinition(); + var description = descriptor.CreateConfiguration(); Assert.Equal("args", description.Name); Assert.Equal(typeof(string), Assert.IsType(description.Type).Type.Source); @@ -140,7 +140,7 @@ public void SetDescription() // assert Assert.Equal(expectedDescription, - descriptor.CreateDefinition().Description); + descriptor.CreateConfiguration().Description); } [Fact] @@ -153,7 +153,7 @@ public void SetDefaultValueAndInferType() descriptor.DefaultValue("string"); // assert - var description = descriptor.CreateDefinition(); + var description = descriptor.CreateConfiguration(); Assert.Equal(typeof(string), Assert.IsType(description.Type).Type.Source); Assert.Equal("string", @@ -170,7 +170,7 @@ public void SetDefaultValueViaSyntax() descriptor.DefaultValueSyntax("[]"); // assert - var description = descriptor.CreateDefinition(); + var description = descriptor.CreateConfiguration(); Assert.IsType(description.DefaultValue); } @@ -184,7 +184,7 @@ public void SetDefaultValueNull() descriptor.DefaultValue(null); // assert - var description = descriptor.CreateDefinition(); + var description = descriptor.CreateConfiguration(); Assert.Equal(NullValueNode.Default, description.DefaultValue); Assert.Null(description.RuntimeDefaultValue); } @@ -201,7 +201,7 @@ public void OverwriteDefaultValueLiteralWithNativeDefaultValue() .DefaultValue("string"); // assert - var description = descriptor.CreateDefinition(); + var description = descriptor.CreateConfiguration(); Assert.Null(description.DefaultValue); Assert.Equal("string", description.RuntimeDefaultValue); } @@ -219,7 +219,7 @@ public void SettingTheNativeDefaultValueToNullCreatesNullLiteral() .DefaultValue(null); // assert - var description = descriptor.CreateDefinition(); + var description = descriptor.CreateConfiguration(); Assert.IsType(description.DefaultValue); Assert.Null(description.RuntimeDefaultValue); } @@ -236,7 +236,7 @@ public void OverwriteNativeDefaultValueWithDefaultValueLiteral() .DefaultValue(new StringValueNode("123")); // assert - var description = descriptor.CreateDefinition(); + var description = descriptor.CreateConfiguration(); Assert.IsType(description.DefaultValue); Assert.Equal("123", ((StringValueNode)description.DefaultValue).Value); Assert.Null(description.RuntimeDefaultValue); diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/DirectiveArgumentDescriptorTests.cs b/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/DirectiveArgumentDescriptorTests.cs index 8b0226a4553..5af36bc65d8 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/DirectiveArgumentDescriptorTests.cs +++ b/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/DirectiveArgumentDescriptorTests.cs @@ -31,7 +31,7 @@ public void SetDefaultValueViaSyntax() descriptor.DefaultValueSyntax("[]"); // assert - var description = descriptor.CreateDefinition(); + var description = descriptor.CreateConfiguration(); Assert.IsType(description.DefaultValue); } } diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/DirectiveDescriptorTests.cs b/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/DirectiveDescriptorTests.cs index 8863dc5ab81..2eb9bf6cd53 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/DirectiveDescriptorTests.cs +++ b/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/DirectiveDescriptorTests.cs @@ -15,7 +15,7 @@ public void DeclareName() descriptor.Name("Foo"); // assert - Assert.Equal("Foo", descriptor.CreateDefinition().Name); + Assert.Equal("Foo", descriptor.CreateConfiguration().Name); } [Fact] @@ -26,7 +26,7 @@ public void InferName() var descriptor = DirectiveTypeDescriptor.New(Context); // assert - var description = descriptor.CreateDefinition(); + var description = descriptor.CreateConfiguration(); Assert.Equal("custom", description.Name); } @@ -42,7 +42,7 @@ public void OverrideName() // assert var description = - descriptor.CreateDefinition(); + descriptor.CreateConfiguration(); Assert.Equal("Foo", description.Name); } @@ -82,7 +82,7 @@ public void DeclareDescription() descriptor.Description("Desc"); // assert - Assert.Equal("Desc", descriptor.CreateDefinition().Description); + Assert.Equal("Desc", descriptor.CreateConfiguration().Description); } [Fact] @@ -95,7 +95,7 @@ public void DeclareArgument() descriptor.Argument("arg").Type(); ; // assert - var description = descriptor.CreateDefinition(); + var description = descriptor.CreateConfiguration(); Assert.Equal("arg", description.Arguments.Single().Name); } @@ -108,7 +108,7 @@ public void DeclareArgumentWithProperty() // assert var description = - descriptor.CreateDefinition(); + descriptor.CreateConfiguration(); Assert.Collection(description.Arguments, t => Assert.Equal("fieldA", t.Name), t => Assert.Equal("fieldB", t.Name)); @@ -127,7 +127,7 @@ public void DeclareExplicitArgumentBinding() // assert var description = - descriptor.CreateDefinition(); + descriptor.CreateConfiguration(); Assert.Collection(description.Arguments, t => Assert.Equal("fieldA", t.Name)); } @@ -142,7 +142,7 @@ public void DeclareArgumentAndSpecifyType() descriptor.Argument(t => t.FieldA).Type>(); // assert - var description = descriptor.CreateDefinition(); + var description = descriptor.CreateConfiguration(); Assert.Collection(description.Arguments, t => Assert.Equal( typeof(NonNullType), @@ -162,7 +162,7 @@ public void DeclareArgumentAndSpecifyClrType() descriptor.Argument(t => t.FieldA).Type(typeof(NonNullType)); // assert - var description = descriptor.CreateDefinition(); + var description = descriptor.CreateConfiguration(); Assert.Collection(description.Arguments, t => Assert.Equal( typeof(NonNullType), @@ -184,7 +184,7 @@ public void IgnoreArgumentBinding() // assert var description = - descriptor.CreateDefinition(); + descriptor.CreateConfiguration(); Assert.Collection(description.Arguments, t => Assert.Equal("fieldB", t.Name)); } @@ -202,7 +202,7 @@ public void UnignoreArgumentBinding() // assert var description = - descriptor.CreateDefinition(); + descriptor.CreateConfiguration(); Assert.Collection(description.Arguments, t => Assert.Equal("fieldA", t.Name), t => Assert.Equal("fieldB", t.Name)); @@ -235,7 +235,7 @@ public void DeclareLocation() // assert var description = - descriptor.CreateDefinition(); + descriptor.CreateConfiguration(); Assert.Collection(description.Locations.AsEnumerable(), t => Assert.Equal(DirectiveLocation.Enum, t), t => Assert.Equal(DirectiveLocation.EnumValue, t)); diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/EnumTypeDescriptorTests.cs b/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/EnumTypeDescriptorTests.cs index 1058fd480dc..8f2b64a3b32 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/EnumTypeDescriptorTests.cs +++ b/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/EnumTypeDescriptorTests.cs @@ -12,7 +12,7 @@ public void InferNameFromType() var descriptor = EnumTypeDescriptor.New(Context, typeof(FooEnum)); // assert - Assert.Equal("FooEnum", descriptor.CreateDefinition().Name); + Assert.Equal("FooEnum", descriptor.CreateConfiguration().Name); } [Fact] @@ -32,7 +32,7 @@ public void InferValuesFromType() var descriptor = EnumTypeDescriptor.New(Context, typeof(FooEnum)); // assert - var description = descriptor.CreateDefinition(); + var description = descriptor.CreateConfiguration(); Assert.Collection(description.Values, t => { @@ -57,7 +57,7 @@ public void SpecifyOneValueInferTheOthers() desc.Value(FooEnum.Bar1).Name("FOOBAR"); // assert - var description = descriptor.CreateDefinition(); + var description = descriptor.CreateConfiguration(); Assert.Collection(description.Values, t => { @@ -83,7 +83,7 @@ public void ExplicitValueBinding() desc.BindValues(BindingBehavior.Explicit); // assert - var description = descriptor.CreateDefinition(); + var description = descriptor.CreateConfiguration(); Assert.Collection(description.Values, t => { @@ -103,7 +103,7 @@ public void AddDirective() desc.Directive("Bar"); // assert - var description = descriptor.CreateDefinition(); + var description = descriptor.CreateConfiguration(); Assert.Collection( description.Directives, t => Assert.Equal("Bar", Assert.IsType(t.Value).Name.Value)); @@ -120,7 +120,7 @@ public void AddDirectiveWithDirectiveNode() desc.Directive(new DirectiveNode("Bar")); // assert - var description = descriptor.CreateDefinition(); + var description = descriptor.CreateConfiguration(); Assert.Collection(description.Directives, t => Assert.Equal("Bar", Assert.IsType(t.Value).Name.Value)); } @@ -137,7 +137,7 @@ public void AddDirectiveWithArgument() new ArgumentNode("a", new StringValueNode("b"))); // assert - var description = descriptor.CreateDefinition(); + var description = descriptor.CreateConfiguration(); Assert.Collection(description.Directives, t => { diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/InputFieldDescriptorTests.cs b/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/InputFieldDescriptorTests.cs index bad57e7ba9c..51ac36b5faf 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/InputFieldDescriptorTests.cs +++ b/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/InputFieldDescriptorTests.cs @@ -20,7 +20,7 @@ public void DotNetTypesDoNotOverwriteSchemaTypes() .Type>>(); // assert - var description = descriptor.CreateDefinition(); + var description = descriptor.CreateConfiguration(); var typeRef = description.Type; Assert.Equal( typeof(ListType), @@ -41,7 +41,7 @@ public void SchemaTypesOverwriteDotNetTypes() .Type>(); // assert - var description = descriptor.CreateDefinition(); + var description = descriptor.CreateConfiguration(); var typeRef = description.Type; Assert.Equal( typeof(ListType), @@ -60,7 +60,7 @@ public void SetSchemaType() descriptor.Type(new StringType()); // assert - var description = descriptor.CreateDefinition(); + var description = descriptor.CreateConfiguration(); var typeRef = description.Type; Assert.IsType( Assert.IsType(typeRef).Type); @@ -78,7 +78,7 @@ public void SetGenericType() descriptor.Type(); // assert - var description = descriptor.CreateDefinition(); + var description = descriptor.CreateConfiguration(); var typeRef = description.Type; Assert.Equal( typeof(StringType), @@ -97,7 +97,7 @@ public void SetNonGenericType() descriptor.Type(typeof(StringType)); // assert - var description = descriptor.CreateDefinition(); + var description = descriptor.CreateConfiguration(); var typeRef = description.Type; Assert.Equal( typeof(StringType), @@ -116,7 +116,7 @@ public void OverwriteName() descriptor.Name("args"); // assert - var description = descriptor.CreateDefinition(); + var description = descriptor.CreateConfiguration(); Assert.Equal("args", description.Name); } @@ -132,7 +132,7 @@ public void OverwriteName2() descriptor.Name("args"); // assert - var description = descriptor.CreateDefinition(); + var description = descriptor.CreateConfiguration(); Assert.Equal("args", description.Name); } @@ -149,7 +149,7 @@ public void SetDescription() descriptor.Description(expectedDescription); // assert - var description = descriptor.CreateDefinition(); + var description = descriptor.CreateConfiguration(); Assert.Equal(expectedDescription, description.Description); } @@ -165,7 +165,7 @@ public void SetDefaultValueAndInferType() descriptor.DefaultValue("string"); // assert - var description = descriptor.CreateDefinition(); + var description = descriptor.CreateConfiguration(); Assert.Equal( typeof(string), Assert.IsType(description.Type).Type.Source); @@ -184,7 +184,7 @@ public void SetDefaultValueViaSyntax() descriptor.DefaultValueSyntax("[]"); // assert - var description = descriptor.CreateDefinition(); + var description = descriptor.CreateConfiguration(); Assert.IsType(description.DefaultValue); } @@ -202,7 +202,7 @@ public void OverwriteDefaultValueLiteralWithNativeDefaultValue() .DefaultValue("string"); // asser - var description = descriptor.CreateDefinition(); + var description = descriptor.CreateConfiguration(); Assert.Null(description.DefaultValue); Assert.Equal("string", description.RuntimeDefaultValue); } @@ -222,7 +222,7 @@ public void SettingTheNativeDefaultValueToNullCreatesNullLiteral() .DefaultValue(null); // assert - var description = descriptor.CreateDefinition(); + var description = descriptor.CreateConfiguration(); Assert.IsType(description.DefaultValue); Assert.Null(description.RuntimeDefaultValue); } @@ -241,7 +241,7 @@ public void OverwriteNativeDefaultValueWithDefaultValueLiteral() .DefaultValue(new StringValueNode("123")); // assert - var description = descriptor.CreateDefinition(); + var description = descriptor.CreateConfiguration(); Assert.IsType(description.DefaultValue); Assert.Equal("123", ((StringValueNode)description.DefaultValue).Value); @@ -257,7 +257,7 @@ public void InferTypeFromProperty() typeof(ObjectField).GetProperty("Arguments")); // assert - var description = descriptor.CreateDefinition(); + var description = descriptor.CreateConfiguration(); Assert.Equal(typeof(FieldCollection), Assert.IsType(description.Type).Type.Source); Assert.Equal("arguments", description.Name); diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/InputObjectTypeDescriptorTests.cs b/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/InputObjectTypeDescriptorTests.cs index acf512ad9d3..266a7b2110d 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/InputObjectTypeDescriptorTests.cs +++ b/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/InputObjectTypeDescriptorTests.cs @@ -17,7 +17,7 @@ public void Field_Ignore_PropertyIsExcluded() // assert var description = - descriptor.CreateDefinition(); + descriptor.CreateConfiguration(); Assert.Collection(description.Fields, t => Assert.Equal("name", t.Name)); @@ -36,7 +36,7 @@ public void Field_Unignore_PropertyIsExcluded() // assert var description = - descriptor.CreateDefinition(); + descriptor.CreateConfiguration(); Assert.Collection(description.Fields, t => Assert.Equal("id", t.Name), diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/InterfaceTypeDescriptorTests.cs b/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/InterfaceTypeDescriptorTests.cs index ea4d8edbeaa..0aad278a3c2 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/InterfaceTypeDescriptorTests.cs +++ b/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/InterfaceTypeDescriptorTests.cs @@ -8,10 +8,10 @@ public void InterfaceType_Issue_6222_CreateDefinition_DoesNotDuplicateFields() var descriptor = InterfaceTypeDescriptor.New(Context); descriptor.Field("id").Type("ID!"); - var interfaceType = descriptor.CreateDefinition(); + var interfaceType = descriptor.CreateConfiguration(); Assert.Single(interfaceType.Fields); - descriptor.CreateDefinition(); + descriptor.CreateConfiguration(); Assert.Single(interfaceType.Fields); } } diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/ObjectFieldDescriptorTests.cs b/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/ObjectFieldDescriptorTests.cs index 943b4a3c4ae..e1f9c6fba8c 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/ObjectFieldDescriptorTests.cs +++ b/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/ObjectFieldDescriptorTests.cs @@ -18,7 +18,7 @@ public void SetGenericType() descriptor.Type(); // assert - var description = descriptor.CreateDefinition(); + var description = descriptor.CreateConfiguration(); var typeRef = description.Type; Assert.Equal( typeof(StringType), @@ -36,7 +36,7 @@ public void SetNonGenericType() descriptor.Type(typeof(StringType)); // assert - var description = descriptor.CreateDefinition(); + var description = descriptor.CreateConfiguration(); var typeRef = description.Type; Assert.Equal( typeof(StringType), @@ -56,7 +56,7 @@ public void DotNetTypesDoNotOverwriteSchemaTypes() .Type>>(); // assert - var description = descriptor.CreateDefinition(); + var description = descriptor.CreateConfiguration(); var typeRef = description.Type; Assert.Equal(typeof(ListType), Assert.IsType(typeRef).Type.Source); @@ -75,7 +75,7 @@ public void SchemaTypesOverwriteDotNetTypes() .Type>(); // assert - var description = descriptor.CreateDefinition(); + var description = descriptor.CreateConfiguration(); var typeRef = description.Type; Assert.Equal(typeof(ListType), Assert.IsType(typeRef).Type.Source); @@ -97,7 +97,7 @@ public void ResolverTypesDoNotOverwriteSchemaTypes() .Resolve(c => c.Parent().Arguments); // assert - var description = descriptor.CreateDefinition(); + var description = descriptor.CreateConfiguration(); var typeRef = description.Type; Assert.Equal( typeof(NonNullType>>), @@ -117,7 +117,7 @@ public void OverwriteName() descriptor.Name("args"); // assert - Assert.Equal("args", descriptor.CreateDefinition().Name); + Assert.Equal("args", descriptor.CreateConfiguration().Name); } [Fact] @@ -135,7 +135,7 @@ public void SetDescription() // assert Assert.Equal(expectedDescription, - descriptor.CreateDefinition().Description); + descriptor.CreateConfiguration().Description); } [Fact] @@ -152,7 +152,7 @@ public async Task SetResolverAndInferTypeFromResolver() descriptor.Resolve(() => "ThisIsAString"); // assert - var description = descriptor.CreateDefinition(); + var description = descriptor.CreateConfiguration(); var typeRef = description.Type; Assert.Equal( typeof(string), @@ -181,7 +181,7 @@ public void SetResolverAndInferTypeIsAlwaysRecognisedAsDotNetType() .GetType(ctx.ArgumentValue("type"))); // assert - var description = descriptor.CreateDefinition(); + var description = descriptor.CreateConfiguration(); var typeRef = description.Type; Assert.Equal( typeof(__Type), @@ -216,7 +216,7 @@ public void ResolverTypeIsSet() typeof(string)); // assert - var description = descriptor.CreateDefinition(); + var description = descriptor.CreateConfiguration(); Assert.Equal(typeof(string), description.ResolverType); } } diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/ObjectTypeDescriptorTests.cs b/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/ObjectTypeDescriptorTests.cs index fc4c27fe371..d4771f24320 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/ObjectTypeDescriptorTests.cs +++ b/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/ObjectTypeDescriptorTests.cs @@ -16,7 +16,7 @@ public void InferNameFromType() IObjectTypeDescriptor desc = descriptor; // assert - Assert.Equal("Foo", descriptor.CreateDefinition().Name); + Assert.Equal("Foo", descriptor.CreateConfiguration().Name); } [Fact] @@ -29,7 +29,7 @@ public void GetNameFromAttribute() IObjectTypeDescriptor desc = descriptor; // assert - Assert.Equal("FooAttr", descriptor.CreateDefinition().Name); + Assert.Equal("FooAttr", descriptor.CreateConfiguration().Name); } [Fact] @@ -42,7 +42,7 @@ public void OverwriteDefaultName() descriptor.Name("FooBar"); // assert - Assert.Equal("FooBar", descriptor.CreateDefinition().Name); + Assert.Equal("FooBar", descriptor.CreateConfiguration().Name); } [Fact] @@ -56,7 +56,7 @@ public void OverwriteAttributeName() desc.Name("FooBar"); // assert - Assert.Equal("FooBar", descriptor.CreateDefinition().Name); + Assert.Equal("FooBar", descriptor.CreateConfiguration().Name); } [Fact] @@ -70,7 +70,7 @@ public void InferFieldsFromType() // assert Assert.Collection( - descriptor.CreateDefinition().Fields + descriptor.CreateConfiguration().Fields .Select(t => t.Name) .OrderBy(t => t), t => Assert.Equal("a", t), @@ -89,7 +89,7 @@ public void IgnoreOverriddenPropertyField() // assert Assert.Collection( - descriptor.CreateDefinition().Fields + descriptor.CreateConfiguration().Fields .Select(t => t.Name) .OrderBy(t => t), t => Assert.Equal("a", t), @@ -108,7 +108,7 @@ public void UnignoreOverriddenPropertyField() // assert Assert.Collection( - descriptor.CreateDefinition().Fields + descriptor.CreateConfiguration().Fields .Select(t => t.Name) .OrderBy(t => t), t => Assert.Equal("a", t), @@ -128,7 +128,7 @@ public void IgnoreOverriddenMethodField() // assert Assert.Collection( - descriptor.CreateDefinition().Fields + descriptor.CreateConfiguration().Fields .Select(t => t.Name) .OrderBy(t => t), t => Assert.Equal("a", t), @@ -149,7 +149,7 @@ public void UnignoreOverriddenMethodField() // assert Assert.Collection( - descriptor.CreateDefinition().Fields + descriptor.CreateConfiguration().Fields .Select(t => t.Name) .OrderBy(t => t), t => Assert.Equal("a", t), @@ -171,7 +171,7 @@ public void DeclareFieldsExplicitly() // assert Assert.Collection( - descriptor.CreateDefinition().Fields.Select(t => t.Name), + descriptor.CreateConfiguration().Fields.Select(t => t.Name), t => Assert.Equal("a", t)); } diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/Relay/IdAttributeTests.cs b/src/HotChocolate/Core/test/Types.Tests/Types/Relay/IdAttributeTests.cs index 78927a6bda6..ff539901d3c 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Types/Relay/IdAttributeTests.cs +++ b/src/HotChocolate/Core/test/Types.Tests/Types/Relay/IdAttributeTests.cs @@ -720,7 +720,7 @@ public override void OnValidateType( TypeSystemConfiguration definition) { if (validationContext.Type.Name.EqualsOrdinal("Query") && - definition is ObjectTypeDefinition typeDef) + definition is ObjectTypeConfiguration typeDef) { Count = typeDef.Fields .Single(t => t.Name.EqualsOrdinal("abc")) diff --git a/src/HotChocolate/CostAnalysis/src/CostAnalysis/CostTypeInterceptor.cs b/src/HotChocolate/CostAnalysis/src/CostAnalysis/CostTypeInterceptor.cs index 308d84685f4..e67f5862acf 100644 --- a/src/HotChocolate/CostAnalysis/src/CostAnalysis/CostTypeInterceptor.cs +++ b/src/HotChocolate/CostAnalysis/src/CostAnalysis/CostTypeInterceptor.cs @@ -45,7 +45,7 @@ internal override void InitializeContext( public override void OnAfterCompleteName(ITypeCompletionContext completionContext, TypeSystemConfiguration definition) { - if (definition is ObjectTypeDefinition objectTypeDef) + if (definition is ObjectTypeConfiguration objectTypeDef) { foreach (var fieldDef in objectTypeDef.Fields) { @@ -153,7 +153,7 @@ public override void OnAfterCompleteName(ITypeCompletionContext completionContex public override void OnBeforeCompleteType(ITypeCompletionContext completionContext, TypeSystemConfiguration definition) { - if (definition is ObjectTypeDefinition objectTypeDef) + if (definition is ObjectTypeConfiguration objectTypeDef) { foreach (var fieldDef in objectTypeDef.Fields) { diff --git a/src/HotChocolate/Data/src/Data/Filters/Convention/FilterTypeInterceptor.cs b/src/HotChocolate/Data/src/Data/Filters/Convention/FilterTypeInterceptor.cs index 43cb17fac77..c4cb817c4a9 100644 --- a/src/HotChocolate/Data/src/Data/Filters/Convention/FilterTypeInterceptor.cs +++ b/src/HotChocolate/Data/src/Data/Filters/Convention/FilterTypeInterceptor.cs @@ -30,7 +30,7 @@ public override void OnBeforeRegisterDependencies( convention.ApplyConfigurations(typeReference, descriptor); - var extensionDefinition = descriptor.CreateDefinition(); + var extensionDefinition = descriptor.CreateConfiguration(); ApplyCorrectScope(extensionDefinition, discoveryContext); @@ -59,7 +59,7 @@ public override void OnBeforeCompleteName( convention.ApplyConfigurations(typeReference, descriptor); DataTypeExtensionHelper - .MergeFilterInputTypeDefinitions(completionContext, descriptor.CreateDefinition(), def); + .MergeFilterInputTypeDefinitions(completionContext, descriptor.CreateConfiguration(), def); if (def.Scope is not null) { diff --git a/src/HotChocolate/Data/src/Data/Filters/Expressions/QueryableFilterProvider.cs b/src/HotChocolate/Data/src/Data/Filters/Expressions/QueryableFilterProvider.cs index 38c00d9adbe..a6f9e1ec3e3 100644 --- a/src/HotChocolate/Data/src/Data/Filters/Expressions/QueryableFilterProvider.cs +++ b/src/HotChocolate/Data/src/Data/Filters/Expressions/QueryableFilterProvider.cs @@ -100,7 +100,7 @@ public override void ConfigureField( string argumentName, IObjectFieldDescriptor descriptor) { - var contextData = descriptor.Extend().Definition.ContextData; + var contextData = descriptor.Extend().Configuration.ContextData; var argumentKey = (VisitFilterArgument)VisitFilterArgumentExecutor; contextData[ContextVisitFilterArgumentKey] = argumentKey; contextData[ContextArgumentNameKey] = argumentName; diff --git a/src/HotChocolate/Data/src/Data/Filters/Extensions/FilterObjectFieldDescriptorExtensions.cs b/src/HotChocolate/Data/src/Data/Filters/Extensions/FilterObjectFieldDescriptorExtensions.cs index 8018d05b3b3..fa6773de057 100644 --- a/src/HotChocolate/Data/src/Data/Filters/Extensions/FilterObjectFieldDescriptorExtensions.cs +++ b/src/HotChocolate/Data/src/Data/Filters/Extensions/FilterObjectFieldDescriptorExtensions.cs @@ -130,7 +130,7 @@ private static IObjectFieldDescriptor UseFiltering( var argumentPlaceholder = "_" + Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture); - descriptor.Extend().Definition.MiddlewareDefinitions.Add(placeholder); + descriptor.Extend().Configuration.MiddlewareDefinitions.Add(placeholder); descriptor .Extend() @@ -176,7 +176,7 @@ private static IObjectFieldDescriptor UseFiltering( definition.Arguments.Add(argumentDefinition); definition.Configurations.Add( - new CompleteConfiguration( + new OnCompleteTypeSystemConfigurationTask( (ctx, d) => CompileMiddleware( ctx, @@ -190,7 +190,7 @@ private static IObjectFieldDescriptor UseFiltering( TypeDependencyFulfilled.Completed)); argumentDefinition.Configurations.Add( - new CompleteConfiguration( + new OnCompleteTypeSystemConfigurationTask( (context, argDef) => argDef.Name = context.GetFilterConvention(scope).GetArgumentName(), diff --git a/src/HotChocolate/Data/src/Data/Filters/Fields/AndField.cs b/src/HotChocolate/Data/src/Data/Filters/Fields/AndField.cs index b41bcce3a1c..721436127f4 100644 --- a/src/HotChocolate/Data/src/Data/Filters/Fields/AndField.cs +++ b/src/HotChocolate/Data/src/Data/Filters/Fields/AndField.cs @@ -36,5 +36,5 @@ private static FilterOperationFieldDefinition CreateDefinition( string? scope) => FilterOperationFieldDescriptor .New(context, DefaultFilterOperations.And, scope) - .CreateDefinition(); + .CreateConfiguration(); } diff --git a/src/HotChocolate/Data/src/Data/Filters/Fields/OrField.cs b/src/HotChocolate/Data/src/Data/Filters/Fields/OrField.cs index 56cac3c6961..12d182b4041 100644 --- a/src/HotChocolate/Data/src/Data/Filters/Fields/OrField.cs +++ b/src/HotChocolate/Data/src/Data/Filters/Fields/OrField.cs @@ -36,5 +36,5 @@ private static FilterOperationFieldDefinition CreateDefinition( string? scope) => FilterOperationFieldDescriptor .New(context, DefaultFilterOperations.Or, scope) - .CreateDefinition(); + .CreateConfiguration(); } diff --git a/src/HotChocolate/Data/src/Data/Filters/FilterFieldDescriptor.cs b/src/HotChocolate/Data/src/Data/Filters/FilterFieldDescriptor.cs index 90ba93b4be0..ee8734d33bf 100644 --- a/src/HotChocolate/Data/src/Data/Filters/FilterFieldDescriptor.cs +++ b/src/HotChocolate/Data/src/Data/Filters/FilterFieldDescriptor.cs @@ -69,7 +69,7 @@ protected internal FilterFieldDescriptor( protected set => base.Definition = value; } - internal InputFieldConfiguration CreateFieldDefinition() => CreateDefinition(); + internal InputFieldConfiguration CreateFieldDefinition() => CreateConfiguration(); protected override void OnCreateDefinition( FilterFieldDefinition definition) diff --git a/src/HotChocolate/Data/src/Data/Filters/FilterInputType.cs b/src/HotChocolate/Data/src/Data/Filters/FilterInputType.cs index 2818131a6e1..9a3bc080631 100644 --- a/src/HotChocolate/Data/src/Data/Filters/FilterInputType.cs +++ b/src/HotChocolate/Data/src/Data/Filters/FilterInputType.cs @@ -35,7 +35,7 @@ protected override InputObjectTypeConfiguration CreateDefinition( var descriptor = FilterInputTypeDescriptor .FromSchemaType(context.DescriptorContext, GetType(), context.Scope); _configure!(descriptor); - Definition = descriptor.CreateDefinition(); + Definition = descriptor.CreateConfiguration(); } return Definition; diff --git a/src/HotChocolate/Data/src/Data/Filters/FilterInputTypeDescriptor.cs b/src/HotChocolate/Data/src/Data/Filters/FilterInputTypeDescriptor.cs index 7e49fd4c75f..c9c85ad6a1e 100644 --- a/src/HotChocolate/Data/src/Data/Filters/FilterInputTypeDescriptor.cs +++ b/src/HotChocolate/Data/src/Data/Filters/FilterInputTypeDescriptor.cs @@ -74,8 +74,8 @@ protected override void OnCreateDefinition(FilterInputTypeDefinition definition) var handledProperties = new HashSet(); FieldDescriptorUtilities.AddExplicitFields( - Fields.Select(t => t.CreateDefinition()) - .Concat(Operations.Select(t => t.CreateDefinition())), + Fields.Select(t => t.CreateConfiguration()) + .Concat(Operations.Select(t => t.CreateConfiguration())), f => f.Member, fields, handledProperties); diff --git a/src/HotChocolate/Data/src/Data/Filters/FilterInputTypeDescriptor`1.cs b/src/HotChocolate/Data/src/Data/Filters/FilterInputTypeDescriptor`1.cs index 1818d0c6624..1bbb3a0c42f 100644 --- a/src/HotChocolate/Data/src/Data/Filters/FilterInputTypeDescriptor`1.cs +++ b/src/HotChocolate/Data/src/Data/Filters/FilterInputTypeDescriptor`1.cs @@ -48,7 +48,7 @@ protected override void OnCompleteFields( Definition.EntityType!, p => FilterFieldDescriptor .New(Context, Definition.Scope, p) - .CreateDefinition(), + .CreateConfiguration(), fields, handledProperties, include: (_, member) diff --git a/src/HotChocolate/Data/src/Data/Filters/FilterInputType`1.cs b/src/HotChocolate/Data/src/Data/Filters/FilterInputType`1.cs index 9fbd0714810..015dd7f21c0 100644 --- a/src/HotChocolate/Data/src/Data/Filters/FilterInputType`1.cs +++ b/src/HotChocolate/Data/src/Data/Filters/FilterInputType`1.cs @@ -31,7 +31,7 @@ protected override InputObjectTypeConfiguration CreateDefinition( _configure!(descriptor); _configure = null; - return descriptor.CreateDefinition(); + return descriptor.CreateConfiguration(); } protected virtual void Configure(IFilterInputTypeDescriptor descriptor) diff --git a/src/HotChocolate/Data/src/Data/Filters/FilterOperationFieldDescriptor.cs b/src/HotChocolate/Data/src/Data/Filters/FilterOperationFieldDescriptor.cs index b320ae3b792..2795e56bc92 100644 --- a/src/HotChocolate/Data/src/Data/Filters/FilterOperationFieldDescriptor.cs +++ b/src/HotChocolate/Data/src/Data/Filters/FilterOperationFieldDescriptor.cs @@ -128,7 +128,7 @@ public IFilterOperationFieldDescriptor Operation(int operation) return this; } - public InputFieldConfiguration CreateFieldDefinition() => CreateDefinition(); + public InputFieldConfiguration CreateFieldDefinition() => CreateConfiguration(); public static FilterOperationFieldDescriptor New( IDescriptorContext context, diff --git a/src/HotChocolate/Data/src/Data/Filters/Types/StringOperationFilterInputType.cs b/src/HotChocolate/Data/src/Data/Filters/Types/StringOperationFilterInputType.cs index 5c1485f0955..ff08c91f801 100644 --- a/src/HotChocolate/Data/src/Data/Filters/Types/StringOperationFilterInputType.cs +++ b/src/HotChocolate/Data/src/Data/Filters/Types/StringOperationFilterInputType.cs @@ -24,7 +24,7 @@ file static class Extensions { public static IFilterOperationFieldDescriptor Expensive(this IFilterOperationFieldDescriptor descriptor) { - var definition = descriptor.Extend().Definition; + var definition = descriptor.Extend().Configuration; if ((definition.Flags & FieldFlags.FilterOperationField) == FieldFlags.FilterOperationField) { diff --git a/src/HotChocolate/Data/src/Data/Projections/Extensions/ProjectionObjectFieldDescriptorExtensions.cs b/src/HotChocolate/Data/src/Data/Projections/Extensions/ProjectionObjectFieldDescriptorExtensions.cs index 394127a622c..72a3697f868 100644 --- a/src/HotChocolate/Data/src/Data/Projections/Extensions/ProjectionObjectFieldDescriptorExtensions.cs +++ b/src/HotChocolate/Data/src/Data/Projections/Extensions/ProjectionObjectFieldDescriptorExtensions.cs @@ -135,8 +135,8 @@ public static IObjectFieldDescriptor UseProjection( var extension = descriptor.Extend(); - extension.Definition.MiddlewareDefinitions.Add(placeholder); - extension.Definition.Flags |= FieldFlags.UsesProjections; + extension.Configuration.MiddlewareDefinitions.Add(placeholder); + extension.Configuration.Flags |= FieldFlags.UsesProjections; extension .OnBeforeCreate( @@ -158,7 +158,7 @@ public static IObjectFieldDescriptor UseProjection( } definition.Configurations.Add( - new CompleteConfiguration( + new OnCompleteTypeSystemConfigurationTask( (c, d) => CompileMiddleware(selectionType, d, placeholder, c, scope), definition, ApplyConfigurationOn.BeforeCompletion)); diff --git a/src/HotChocolate/Data/src/Data/Projections/Extensions/SingleOrDefaultObjectFieldDescriptorExtensions.cs b/src/HotChocolate/Data/src/Data/Projections/Extensions/SingleOrDefaultObjectFieldDescriptorExtensions.cs index 6fe3cdb83aa..8e17622d445 100644 --- a/src/HotChocolate/Data/src/Data/Projections/Extensions/SingleOrDefaultObjectFieldDescriptorExtensions.cs +++ b/src/HotChocolate/Data/src/Data/Projections/Extensions/SingleOrDefaultObjectFieldDescriptorExtensions.cs @@ -30,7 +30,7 @@ private static IObjectFieldDescriptor ApplyMiddleware( FieldMiddlewareConfiguration placeholder = new(_ => _ => default, key: WellKnownMiddleware.SingleOrDefault); - descriptor.Extend().Definition.MiddlewareDefinitions.Add(placeholder); + descriptor.Extend().Configuration.MiddlewareDefinitions.Add(placeholder); descriptor .Extend() @@ -57,7 +57,7 @@ private static IObjectFieldDescriptor ApplyMiddleware( context.TypeInspector.GetTypeRef(selectionType, TypeContext.Output); definition.Configurations.Add( - new CompleteConfiguration( + new OnCompleteTypeSystemConfigurationTask( (_, d) => { CompileMiddleware( diff --git a/src/HotChocolate/Data/src/Data/Projections/ProjectionTypeInterceptor.cs b/src/HotChocolate/Data/src/Data/Projections/ProjectionTypeInterceptor.cs index 30f2677d82f..01b43ed5559 100644 --- a/src/HotChocolate/Data/src/Data/Projections/ProjectionTypeInterceptor.cs +++ b/src/HotChocolate/Data/src/Data/Projections/ProjectionTypeInterceptor.cs @@ -13,7 +13,7 @@ internal sealed class ProjectionTypeInterceptor : TypeInterceptor public override void OnAfterResolveRootType( ITypeCompletionContext completionContext, - ObjectTypeDefinition definition, + ObjectTypeConfiguration definition, OperationType operationType) { if (operationType is OperationType.Query) @@ -75,7 +75,7 @@ public override void OnAfterCompleteName( ITypeCompletionContext completionContext, TypeSystemConfiguration definition) { - if (definition is ObjectTypeDefinition objectTypeDefinition) + if (definition is ObjectTypeConfiguration objectTypeDefinition) { List? alwaysProjected = null; foreach (var field in objectTypeDefinition.Fields) diff --git a/src/HotChocolate/Data/src/Data/Sorting/Convention/SortConvention.cs b/src/HotChocolate/Data/src/Data/Sorting/Convention/SortConvention.cs index 522c1be3bb2..4b363dd7ae4 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/Convention/SortConvention.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/Convention/SortConvention.cs @@ -224,7 +224,7 @@ public void ApplyConfigurations( if (descriptor is SortInputTypeDescriptor inputTypeDescriptor) { - inputTypeDescriptor.CreateDefinition(); + inputTypeDescriptor.CreateConfiguration(); } } } diff --git a/src/HotChocolate/Data/src/Data/Sorting/Convention/SortTypeInterceptor.cs b/src/HotChocolate/Data/src/Data/Sorting/Convention/SortTypeInterceptor.cs index eca4cfb7abf..8bb1f767839 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/Convention/SortTypeInterceptor.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/Convention/SortTypeInterceptor.cs @@ -74,7 +74,7 @@ private void OnBeforeRegisteringDependencies( convention.ApplyConfigurations(typeReference, descriptor); - var extensionDefinition = descriptor.CreateDefinition(); + var extensionDefinition = descriptor.CreateConfiguration(); discoveryContext.RegisterDependencies(extensionDefinition); } @@ -96,7 +96,7 @@ private void OnBeforeRegisteringDependencies( convention.ApplyConfigurations(typeReference, descriptor); - var extensionDefinition = descriptor.CreateDefinition(); + var extensionDefinition = descriptor.CreateConfiguration(); discoveryContext.RegisterDependencies(extensionDefinition); } @@ -120,7 +120,7 @@ private void OnBeforeCompleteName( DataTypeExtensionHelper.MergeSortInputTypeDefinitions( completionContext, - descriptor.CreateDefinition(), + descriptor.CreateConfiguration(), definition); if (!string.IsNullOrEmpty(definition.Name) && @@ -149,7 +149,7 @@ private void OnBeforeCompleteName( DataTypeExtensionHelper.MergeSortEnumTypeDefinitions( completionContext, - descriptor.CreateDefinition(), + descriptor.CreateConfiguration(), definition); if (!string.IsNullOrEmpty(definition.Name) && diff --git a/src/HotChocolate/Data/src/Data/Sorting/Expressions/QueryableSortProvider.cs b/src/HotChocolate/Data/src/Data/Sorting/Expressions/QueryableSortProvider.cs index 406f866d374..392c4281dcb 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/Expressions/QueryableSortProvider.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/Expressions/QueryableSortProvider.cs @@ -124,7 +124,7 @@ QueryableSortContext VisitSortArgumentExecutor( return visitorContext; } - var contextData = descriptor.Extend().Definition.ContextData; + var contextData = descriptor.Extend().Configuration.ContextData; var argumentKey = (VisitSortArgument)VisitSortArgumentExecutor; contextData[ContextVisitSortArgumentKey] = argumentKey; contextData[ContextArgumentNameKey] = argumentName; diff --git a/src/HotChocolate/Data/src/Data/Sorting/Extensions/SortingObjectFieldDescriptorExtensions.cs b/src/HotChocolate/Data/src/Data/Sorting/Extensions/SortingObjectFieldDescriptorExtensions.cs index 3ec5a8ae2c1..cd8e0b61243 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/Extensions/SortingObjectFieldDescriptorExtensions.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/Extensions/SortingObjectFieldDescriptorExtensions.cs @@ -133,7 +133,7 @@ private static IObjectFieldDescriptor UseSortingInternal( FieldMiddlewareConfiguration sortQuery = new(_ => _ => default, key: WellKnownMiddleware.Sorting); var argumentPlaceholder = "_" + Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture); - var fieldDefinition = descriptor.Extend().Definition; + var fieldDefinition = descriptor.Extend().Configuration; fieldDefinition.MiddlewareDefinitions.Add(sortQuery); @@ -179,7 +179,7 @@ private static IObjectFieldDescriptor UseSortingInternal( }; argumentDefinition.Configurations.Add( - new CompleteConfiguration((context, def) => + new OnCompleteTypeSystemConfigurationTask((context, def) => { var namedType = context.GetType(argumentTypeReference); def.Type = TypeReference.Parse($"[{namedType.Name}!]"); @@ -192,7 +192,7 @@ private static IObjectFieldDescriptor UseSortingInternal( definition.Arguments.Add(argumentDefinition); definition.Configurations.Add( - new CompleteConfiguration( + new OnCompleteTypeSystemConfigurationTask( (context, def) => CompileMiddleware( context, @@ -206,7 +206,7 @@ private static IObjectFieldDescriptor UseSortingInternal( TypeDependencyFulfilled.Completed)); argumentDefinition.Configurations.Add( - new CompleteConfiguration( + new OnCompleteTypeSystemConfigurationTask( (context, argDef) => argDef.Name = context.GetSortConvention(scope).GetArgumentName(), argumentDefinition, ApplyConfigurationOn.BeforeNaming)); diff --git a/src/HotChocolate/Data/src/Data/Sorting/SortEnumType.cs b/src/HotChocolate/Data/src/Data/Sorting/SortEnumType.cs index 945e6ed9165..d41acb1a57b 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/SortEnumType.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/SortEnumType.cs @@ -33,7 +33,7 @@ protected override EnumTypeConfiguration CreateDefinition( _configure!(descriptor); _configure = null; - return descriptor.CreateDefinition(); + return descriptor.CreateConfiguration(); } protected virtual void Configure(ISortEnumTypeDescriptor descriptor) diff --git a/src/HotChocolate/Data/src/Data/Sorting/SortEnumTypeDescriptor.cs b/src/HotChocolate/Data/src/Data/Sorting/SortEnumTypeDescriptor.cs index 90badc762c0..cea7a9b4ab2 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/SortEnumTypeDescriptor.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/SortEnumTypeDescriptor.cs @@ -50,7 +50,7 @@ protected override void OnCreateDefinition( Definition.AttributesAreApplied = true; } - var values = Values.Select(t => t.CreateDefinition()) + var values = Values.Select(t => t.CreateConfiguration()) .OfType() .ToDictionary(t => t.Value); diff --git a/src/HotChocolate/Data/src/Data/Sorting/SortFieldDescriptor.cs b/src/HotChocolate/Data/src/Data/Sorting/SortFieldDescriptor.cs index 255dabcd4bd..94f4151b817 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/SortFieldDescriptor.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/SortFieldDescriptor.cs @@ -73,7 +73,7 @@ protected internal SortFieldDescriptor( protected set => base.Definition = value; } - internal InputFieldConfiguration CreateFieldDefinition() => CreateDefinition(); + internal InputFieldConfiguration CreateFieldDefinition() => CreateConfiguration(); protected override void OnCreateDefinition( SortFieldDefinition definition) diff --git a/src/HotChocolate/Data/src/Data/Sorting/SortInputType.cs b/src/HotChocolate/Data/src/Data/Sorting/SortInputType.cs index 1744944efb9..afd9b4550fb 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/SortInputType.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/SortInputType.cs @@ -36,7 +36,7 @@ protected override InputObjectTypeConfiguration CreateDefinition(ITypeDiscoveryC _configure!(descriptor); _configure = null; - Definition = descriptor.CreateDefinition(); + Definition = descriptor.CreateConfiguration(); } return Definition; diff --git a/src/HotChocolate/Data/src/Data/Sorting/SortInputTypeDescriptor.cs b/src/HotChocolate/Data/src/Data/Sorting/SortInputTypeDescriptor.cs index 036a92ae34b..c357afa26e7 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/SortInputTypeDescriptor.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/SortInputTypeDescriptor.cs @@ -72,7 +72,7 @@ protected override void OnCreateDefinition( var handledProperties = new HashSet(); FieldDescriptorUtilities.AddExplicitFields( - Fields.Select(t => t.CreateDefinition()), + Fields.Select(t => t.CreateConfiguration()), f => f.Member, fields, handledProperties); diff --git a/src/HotChocolate/Data/src/Data/Sorting/SortInputTypeDescriptor`1.cs b/src/HotChocolate/Data/src/Data/Sorting/SortInputTypeDescriptor`1.cs index 79d814db098..2dab21a8b28 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/SortInputTypeDescriptor`1.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/SortInputTypeDescriptor`1.cs @@ -49,7 +49,7 @@ protected override void OnCompleteFields( Definition.EntityType, p => SortFieldDescriptor .New(Context, Definition.Scope, p) - .CreateDefinition(), + .CreateConfiguration(), fields, handledProperties, include: (_, member) => member is PropertyInfo && diff --git a/src/HotChocolate/Data/src/Data/Sorting/SortInputType`1.cs b/src/HotChocolate/Data/src/Data/Sorting/SortInputType`1.cs index fa406666aa5..dad8aac58b2 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/SortInputType`1.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/SortInputType`1.cs @@ -31,7 +31,7 @@ protected override InputObjectTypeConfiguration CreateDefinition( _configure!(descriptor); _configure = null; - return descriptor.CreateDefinition(); + return descriptor.CreateConfiguration(); } protected virtual void Configure(ISortInputTypeDescriptor descriptor) diff --git a/src/HotChocolate/Data/test/Data.Sorting.Tests/Convention/SortConventionTests.cs b/src/HotChocolate/Data/test/Data.Sorting.Tests/Convention/SortConventionTests.cs index d9ca3ae8882..48642ace798 100644 --- a/src/HotChocolate/Data/test/Data.Sorting.Tests/Convention/SortConventionTests.cs +++ b/src/HotChocolate/Data/test/Data.Sorting.Tests/Convention/SortConventionTests.cs @@ -385,7 +385,7 @@ public void GetTypeName_TypeNameEndingWithSortInputType_RemovesTypeSuffix() var sortInputType = new SortInputType( d => d.Field("x").Type() .ExtendWith( - x => x.Definition.Handler = new MatchAnyQueryableFieldHandler())); + x => x.Configuration.Handler = new MatchAnyQueryableFieldHandler())); // act var schema = CreateSchemaWith(sortInputType, convention); diff --git a/src/HotChocolate/Raven/src/Data/DocumentStoreParameterExpressionBuilder.cs b/src/HotChocolate/Raven/src/Data/DocumentStoreParameterExpressionBuilder.cs index 9be73ec4f39..efea25ee4ea 100644 --- a/src/HotChocolate/Raven/src/Data/DocumentStoreParameterExpressionBuilder.cs +++ b/src/HotChocolate/Raven/src/Data/DocumentStoreParameterExpressionBuilder.cs @@ -20,7 +20,7 @@ public override bool CanHandle(ParameterInfo parameter) public void ApplyConfiguration(ParameterInfo parameter, ObjectFieldDescriptor descriptor) { - if (descriptor.Extend().Definition is { ResultType: { } resultType, } definition && + if (descriptor.Extend().Configuration is { ResultType: { } resultType, } definition && TryExtractEntityType(resultType, out var entityType)) { var middleware = new FieldMiddlewareConfiguration( diff --git a/src/HotChocolate/Spatial/src/Types/Transformation/GeometryTransformerInterceptor.cs b/src/HotChocolate/Spatial/src/Types/Transformation/GeometryTransformerInterceptor.cs index 93f11d44274..9a8b55e4ab2 100644 --- a/src/HotChocolate/Spatial/src/Types/Transformation/GeometryTransformerInterceptor.cs +++ b/src/HotChocolate/Spatial/src/Types/Transformation/GeometryTransformerInterceptor.cs @@ -31,7 +31,7 @@ public override void OnBeforeCompleteType( switch (definition) { - case ObjectTypeDefinition def: + case ObjectTypeConfiguration def: HandleObjectType(completionContext, def, convention); break; case InputObjectTypeConfiguration def: @@ -82,7 +82,7 @@ private static void HandleDirectiveType( private static void HandleObjectType( ITypeCompletionContext completionContext, - ObjectTypeDefinition definition, + ObjectTypeConfiguration definition, ISpatialConvention convention) { foreach (var field in definition.Fields) @@ -111,7 +111,7 @@ private static void HandleObjectType( .Type() .Description(Transformation_Argument_Crs_Description); - field.Arguments.Add(argument.CreateDefinition()); + field.Arguments.Add(argument.CreateConfiguration()); field.MiddlewareDefinitions.Insert(0, new(FieldClassMiddlewareFactory.Create( (typeof(IGeometryTransformerFactory), convention.TransformerFactory), diff --git a/src/HotChocolate/Spatial/test/Types.Tests/TransformationIntegrationTests.cs b/src/HotChocolate/Spatial/test/Types.Tests/TransformationIntegrationTests.cs index 3c6b62faf59..6d2e77e32af 100644 --- a/src/HotChocolate/Spatial/test/Types.Tests/TransformationIntegrationTests.cs +++ b/src/HotChocolate/Spatial/test/Types.Tests/TransformationIntegrationTests.cs @@ -648,7 +648,7 @@ public override void OnBeforeCompleteType( ITypeCompletionContext completionContext, TypeSystemConfiguration definition) { - if (definition is ObjectTypeDefinition o) + if (definition is ObjectTypeConfiguration o) { foreach (var field in o.Fields) { From 50be8e05ccff69bf1d9f88a159d04e749d97094b Mon Sep 17 00:00:00 2001 From: Michael Staib Date: Tue, 15 Apr 2025 14:49:46 +0200 Subject: [PATCH 3/9] Reworked TypeInterceptors --- .../FederationTypeInterceptor.cs | 102 ++++++++-------- .../Caching/CacheControlTypeInterceptor.cs | 4 +- .../CacheControlValidationTypeInterceptor.cs | 22 ++-- .../AuthorizationTypeInterceptor.cs | 12 +- ...estExecutorBuilderExtensions.Middleware.cs | 4 +- .../src/Execution/RequestExecutorResolver.cs | 4 +- .../RequirementsTypeInterceptor.cs | 8 +- .../DataLoaderRootFieldTypeInterceptor.cs | 6 +- .../MutationConventionTypeInterceptor.cs | 10 +- .../QueryConventionTypeInterceptor.cs | 10 +- .../Configuration/AggregateTypeInterceptor.cs | 72 ++++++------ .../Types/Configuration/TypeInterceptor.cs | 111 +++++++++--------- .../Core/src/Types/Schema.Initialization.cs | 12 +- .../Core/src/Types/SchemaBuilder.Setup.cs | 14 +-- .../Core/src/Types/SchemaTypes.cs | 20 ++-- ...inition.cs => SchemaTypesConfiguration.cs} | 2 +- .../Types/SemanticNonNullTypeInterceptor.cs | 10 +- ...StoreGlobalPagingOptionsTypeInterceptor.cs | 4 +- .../Directives/DirectiveTypeInterceptor.cs | 12 +- .../Factories/SchemaFirstTypeInterceptor.cs | 4 +- .../Interceptors/FlagEnumTypeInterceptor.cs | 4 +- .../InterfaceCompletionTypeInterceptor.cs | 10 +- .../MiddlewareValidationTypeInterceptor.cs | 4 +- .../Interceptors/ResolverTypeInterceptor.cs | 8 +- .../TypeValidationTypeInterceptor.cs | 4 +- .../IntrospectionTypeInterceptor.cs | 8 +- .../Types/Relay/NodeFieldTypeInterceptor.cs | 4 +- .../Relay/NodeIdSerializerTypeInterceptor.cs | 4 +- .../Relay/NodeResolverTypeInterceptor.cs | 4 +- .../Types/Relay/QueryFieldTypeInterceptor.cs | 8 +- .../AnnotationBasedMutations.cs | 8 +- .../TypeScopeInterceptorTests.cs | 8 +- .../test/Types.Tests/SchemaBuilderTests.cs | 8 +- .../Types/Relay/IdAttributeTests.cs | 8 +- .../src/CostAnalysis/CostTypeInterceptor.cs | 10 +- .../Convention/FilterTypeInterceptor.cs | 14 +-- .../Projections/ProjectionTypeInterceptor.cs | 10 +- .../Sorting/Convention/SortTypeInterceptor.cs | 12 +- .../GeometryTransformerInterceptor.cs | 4 +- .../TransformationIntegrationTests.cs | 4 +- .../Utilities/EntityTypeInterceptor.cs | 8 +- .../Utilities/LeafTypeInterceptor.cs | 6 +- 42 files changed, 301 insertions(+), 300 deletions(-) rename src/HotChocolate/Core/src/Types/{SchemaTypesDefinition.cs => SchemaTypesConfiguration.cs} (95%) diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationTypeInterceptor.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationTypeInterceptor.cs index 7e0543e49fc..1a9fcc7e8ae 100644 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationTypeInterceptor.cs +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/FederationTypeInterceptor.cs @@ -43,7 +43,7 @@ internal sealed class FederationTypeInterceptor : TypeInterceptor private TypeRegistry _typeRegistry = default!; private ObjectType _queryType = default!; private ExtendedTypeDirectiveReference _keyDirectiveReference = default!; - private SchemaTypeConfiguration _schemaTypeDefinition = default!; + private SchemaTypeConfiguration _schemaTypeCfg = default!; private RegisteredType _schemaType = default!; private bool _registeredTypes; @@ -63,22 +63,22 @@ internal override void InitializeContext( public override void OnAfterInitialize( ITypeDiscoveryContext discoveryContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { if (discoveryContext.Type is ObjectType objectType && - definition is ObjectTypeConfiguration objectTypeDefinition) + configuration is ObjectTypeConfiguration objectTypeCfg) { ApplyMethodLevelReferenceResolvers( objectType, - objectTypeDefinition); + objectTypeCfg); AddToUnionIfHasTypeLevelKeyDirective( objectType, - objectTypeDefinition); + objectTypeCfg); AggregatePropertyLevelKeyDirectives( objectType, - objectTypeDefinition, + objectTypeCfg, discoveryContext); } } @@ -114,40 +114,40 @@ public override IEnumerable RegisterMoreTypes( public override void OnBeforeCompleteName( ITypeCompletionContext completionContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { - if (definition is SchemaTypeConfiguration schemaDef) + if (configuration is SchemaTypeConfiguration schemaCfg) { _schemaType = (RegisteredType)completionContext; - _schemaTypeDefinition = schemaDef; + _schemaTypeCfg = schemaCfg; } } public override void OnAfterCompleteName( ITypeCompletionContext completionContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { if (_context.GetFederationVersion() == FederationVersion.Federation10 - || definition is not ITypeConfiguration and not DirectiveTypeConfiguration) + || configuration is not ITypeConfiguration and not DirectiveTypeConfiguration) { return; } // if we find a PagingInfo we will make all fields sharable. - if (definition is ObjectTypeConfiguration typeDef - && typeDef.Name.Equals(PageInfoType.Names.PageInfo)) + if (configuration is ObjectTypeConfiguration typeCfg + && typeCfg.Name.Equals(PageInfoType.Names.PageInfo)) { - foreach (var fieldDef in typeDef.Fields) + foreach (var fieldCfg in typeCfg.Fields) { - if (fieldDef.Directives.All(t => t.Value is not ShareableDirective)) + if (fieldCfg.Directives.All(t => t.Value is not ShareableDirective)) { var typeRef = TypeReference.CreateDirective(_typeInspector.GetType(typeof(ShareableDirective))); - fieldDef.Directives.Add(new DirectiveConfiguration(ShareableDirective.Default, typeRef)); + fieldCfg.Directives.Add(new DirectiveConfiguration(ShareableDirective.Default, typeRef)); } } } - var hasRuntimeType = (IHasRuntimeType)definition; + var hasRuntimeType = (IHasRuntimeType)configuration; var type = hasRuntimeType.RuntimeType; if (type != typeof(object) && @@ -259,7 +259,7 @@ private void RegisterImports() TypeDependencyFulfilled.Completed); _schemaType.Dependencies.Add(dependency); - _schemaTypeDefinition + _schemaTypeCfg .GetLegacyDefinition() .AddDirective( new LinkDirective(version.ToUrl(), federationTypes), @@ -272,7 +272,7 @@ private void RegisterImports() continue; } - _schemaTypeDefinition + _schemaTypeCfg .GetLegacyDefinition() .AddDirective( new LinkDirective(import.Key, import.Value), @@ -307,7 +307,7 @@ private void RegisterExportedDirectives() foreach (var directive in composeDirectives) { - _schemaTypeDefinition + _schemaTypeCfg .GetLegacyDefinition() .AddDirective(directive, _typeInspector); } @@ -316,7 +316,7 @@ private void RegisterExportedDirectives() public override void OnAfterResolveRootType( ITypeCompletionContext completionContext, - ObjectTypeConfiguration definition, + ObjectTypeConfiguration configuration, OperationType operationType) { if (operationType is OperationType.Query) @@ -327,37 +327,37 @@ public override void OnAfterResolveRootType( public override void OnBeforeCompleteType( ITypeCompletionContext completionContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { AddMemberTypesToTheEntityUnionType( completionContext, - definition); + configuration); AddServiceTypeToQueryType( completionContext, - definition); + configuration); } public override void OnAfterMakeExecutable( ITypeCompletionContext completionContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { if (completionContext.Type is ObjectType type && - definition is ObjectTypeConfiguration typeDef) + configuration is ObjectTypeConfiguration typeCfg) { - CompleteExternalFieldSetters(type, typeDef); - CompleteReferenceResolver(typeDef); + CompleteExternalFieldSetters(type, typeCfg); + CompleteReferenceResolver(typeCfg); } } - private void CompleteExternalFieldSetters(ObjectType type, ObjectTypeConfiguration typeDef) - => ExternalSetterExpressionHelper.TryAddExternalSetter(type, typeDef); + private void CompleteExternalFieldSetters(ObjectType type, ObjectTypeConfiguration typeCfg) + => ExternalSetterExpressionHelper.TryAddExternalSetter(type, typeCfg); - private void CompleteReferenceResolver(ObjectTypeConfiguration typeDef) + private void CompleteReferenceResolver(ObjectTypeConfiguration typeCfg) { IReadOnlyList resolvers; { - var contextData = typeDef.GetContextData(); + var contextData = typeCfg.GetContextData(); if (!contextData.TryGetValue(EntityResolver, out var resolversObject)) { @@ -374,7 +374,7 @@ private void CompleteReferenceResolver(ObjectTypeConfiguration typeDef) if (resolvers.Count == 1) { - typeDef.ContextData[EntityResolver] = resolvers[0].Resolver; + typeCfg.ContextData[EntityResolver] = resolvers[0].Resolver; } else { @@ -404,7 +404,7 @@ private void CompleteReferenceResolver(ObjectTypeConfiguration typeDef) current = Expression.Block(new[] { variable, }, current, variable); - typeDef.ContextData[EntityResolver] = + typeCfg.ContextData[EntityResolver] = Expression.Lambda(current, context).Compile(); } } @@ -418,24 +418,24 @@ private void AddServiceTypeToQueryType( return; } - var objectTypeDefinition = (ObjectTypeConfiguration)definition!; - objectTypeDefinition.Fields.Add(ServerFields.CreateServiceField(_context)); + var objectTypeCfg = (ObjectTypeConfiguration)definition!; + objectTypeCfg.Fields.Add(ServerFields.CreateServiceField(_context)); if (_entityTypes.Count > 0) { - objectTypeDefinition.Fields.Add(ServerFields.CreateEntitiesField(_context)); + objectTypeCfg.Fields.Add(ServerFields.CreateEntitiesField(_context)); } } private void ApplyMethodLevelReferenceResolvers( ObjectType objectType, - ObjectTypeConfiguration objectTypeDefinition) + ObjectTypeConfiguration objectTypeCfg) { if (objectType.RuntimeType == typeof(object)) { return; } - var descriptor = ObjectTypeDescriptor.From(_context, objectTypeDefinition); + var descriptor = ObjectTypeDescriptor.From(_context, objectTypeCfg); // Static methods won't end up in the schema as fields. // The default initialization system only considers instance methods, @@ -465,16 +465,16 @@ private void ApplyMethodLevelReferenceResolvers( private void AddToUnionIfHasTypeLevelKeyDirective( ObjectType objectType, - ObjectTypeConfiguration objectTypeDefinition) + ObjectTypeConfiguration objectTypeCfg) { - if (objectTypeDefinition.Directives.FirstOrDefault(d => d.Value is KeyDirective) is { } keyDirective && + if (objectTypeCfg.Directives.FirstOrDefault(d => d.Value is KeyDirective) is { } keyDirective && ((KeyDirective)keyDirective.Value).Resolvable) { _entityTypes.Add(objectType); return; } - if (objectTypeDefinition.Fields.Any(f => f.ContextData.TryGetValue(KeyMarker, out var resolvable) && + if (objectTypeCfg.Fields.Any(f => f.ContextData.TryGetValue(KeyMarker, out var resolvable) && resolvable is true)) { _entityTypes.Add(objectType); @@ -483,13 +483,13 @@ private void AddToUnionIfHasTypeLevelKeyDirective( private void AggregatePropertyLevelKeyDirectives( ObjectType objectType, - ObjectTypeConfiguration objectTypeDefinition, + ObjectTypeConfiguration objectTypeCfg, ITypeDiscoveryContext discoveryContext) { // if we find key markers on our fields, we need to construct the key directive // from the annotated fields. { - var foundMarkers = objectTypeDefinition.Fields.Any(f => f.ContextData.ContainsKey(KeyMarker)); + var foundMarkers = objectTypeCfg.Fields.Any(f => f.ContextData.ContainsKey(KeyMarker)); if (!foundMarkers) { @@ -497,7 +497,7 @@ private void AggregatePropertyLevelKeyDirectives( } } - IReadOnlyList fields = objectTypeDefinition.Fields; + IReadOnlyList fields = objectTypeCfg.Fields; var fieldSet = new StringBuilder(); bool? resolvable = null; @@ -525,11 +525,11 @@ private void AggregatePropertyLevelKeyDirectives( } // add the key directive with the dynamically generated field set. - AddKeyDirective(objectTypeDefinition, fieldSet.ToString(), resolvable ?? true); + AddKeyDirective(objectTypeCfg, fieldSet.ToString(), resolvable ?? true); // register dependency to the key directive so that it is completed before // we complete this type. - foreach (var directiveDefinition in objectTypeDefinition.Directives) + foreach (var directiveDefinition in objectTypeCfg.Directives) { discoveryContext.Dependencies.Add( new TypeDependency( @@ -552,21 +552,21 @@ private void AddMemberTypesToTheEntityUnionType( TypeSystemConfiguration? definition) { if (completionContext.Type is _EntityType && - definition is UnionTypeConfiguration unionTypeDefinition) + definition is UnionTypeConfiguration unionTypeCfg) { foreach (var objectType in _entityTypes) { - unionTypeDefinition.Types.Add(TypeReference.Create(objectType)); + unionTypeCfg.Types.Add(TypeReference.Create(objectType)); } } } private void AddKeyDirective( - ObjectTypeConfiguration objectTypeDefinition, + ObjectTypeConfiguration objectTypeCfg, string fieldSet, bool resolvable) { - objectTypeDefinition.Directives.Add( + objectTypeCfg.Directives.Add( new DirectiveConfiguration( new KeyDirective(fieldSet, resolvable), _keyDirectiveReference)); diff --git a/src/HotChocolate/Caching/src/Caching/CacheControlTypeInterceptor.cs b/src/HotChocolate/Caching/src/Caching/CacheControlTypeInterceptor.cs index 490dccffc03..abaf695f3e2 100644 --- a/src/HotChocolate/Caching/src/Caching/CacheControlTypeInterceptor.cs +++ b/src/HotChocolate/Caching/src/Caching/CacheControlTypeInterceptor.cs @@ -18,14 +18,14 @@ internal sealed class CacheControlTypeInterceptor( public override void OnBeforeCompleteName( ITypeCompletionContext completionContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { if (!_cacheControlOptions.Enable || !_cacheControlOptions.ApplyDefaults) { return; } - if (completionContext.Type is ObjectType && definition is ObjectTypeConfiguration typeDef) + if (completionContext.Type is ObjectType && configuration is ObjectTypeConfiguration typeDef) { _types.Add(((RegisteredType)completionContext, typeDef)); } diff --git a/src/HotChocolate/Caching/src/Caching/CacheControlValidationTypeInterceptor.cs b/src/HotChocolate/Caching/src/Caching/CacheControlValidationTypeInterceptor.cs index 516cf908937..ca4dfeab1c6 100644 --- a/src/HotChocolate/Caching/src/Caching/CacheControlValidationTypeInterceptor.cs +++ b/src/HotChocolate/Caching/src/Caching/CacheControlValidationTypeInterceptor.cs @@ -12,7 +12,7 @@ internal sealed class CacheControlValidationTypeInterceptor : TypeInterceptor public override void OnAfterResolveRootType( ITypeCompletionContext completionContext, - ObjectTypeConfiguration definition, + ObjectTypeConfiguration configuration, OperationType operationType) { if (operationType is OperationType.Query) @@ -22,48 +22,48 @@ public override void OnAfterResolveRootType( } public override void OnValidateType( - ITypeSystemObjectContext validationContext, - TypeSystemConfiguration definition) + ITypeSystemObjectContext context, + TypeSystemConfiguration configuration) { - if (validationContext.IsIntrospectionType) + if (context.IsIntrospectionType) { return; } - switch (validationContext.Type) + switch (context.Type) { case ObjectType objectType: { - var isQueryType = ReferenceEquals(validationContext, _queryContext); + var isQueryType = ReferenceEquals(context, _queryContext); - ValidateCacheControlOnType(validationContext, objectType); + ValidateCacheControlOnType(context, objectType); var span = objectType.Fields.AsSpan(); for (var i = 0; i < span.Length; i++) { var field = span[i]; - ValidateCacheControlOnField(validationContext, field, objectType, isQueryType); + ValidateCacheControlOnField(context, field, objectType, isQueryType); } break; } case InterfaceType interfaceType: { - ValidateCacheControlOnType(validationContext, interfaceType); + ValidateCacheControlOnType(context, interfaceType); var span = interfaceType.Fields.AsSpan(); for (var i = 0; i < span.Length; i++) { var field = span[i]; - ValidateCacheControlOnField(validationContext, field, interfaceType, false); + ValidateCacheControlOnField(context, field, interfaceType, false); } break; } case UnionType unionType: - ValidateCacheControlOnType(validationContext, unionType); + ValidateCacheControlOnType(context, unionType); break; } } diff --git a/src/HotChocolate/Core/src/Authorization/AuthorizationTypeInterceptor.cs b/src/HotChocolate/Core/src/Authorization/AuthorizationTypeInterceptor.cs index 55b50ce11e2..a7003d756bb 100644 --- a/src/HotChocolate/Core/src/Authorization/AuthorizationTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Authorization/AuthorizationTypeInterceptor.cs @@ -58,18 +58,18 @@ internal override void OnBeforeCreateSchemaInternal( public override void OnBeforeCompleteName( ITypeCompletionContext completionContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { switch (completionContext.Type) { // at this point we collect object types so we can check if they need to be authorized. - case ObjectType when definition is ObjectTypeConfiguration objectTypeDef: + case ObjectType when configuration is ObjectTypeConfiguration objectTypeDef: _objectTypes.Add(new ObjectTypeInfo(completionContext, objectTypeDef)); break; // also we collect union types so we can see if a union exposes // an authorized object type. - case UnionType when definition is UnionTypeConfiguration unionTypeDef: + case UnionType when configuration is UnionTypeConfiguration unionTypeDef: _unionTypes.Add(new UnionTypeInfo(completionContext, unionTypeDef)); break; @@ -85,7 +85,7 @@ public override void OnBeforeCompleteName( public override void OnAfterResolveRootType( ITypeCompletionContext completionContext, - ObjectTypeConfiguration definition, + ObjectTypeConfiguration configuration, OperationType operationType) { if (operationType is OperationType.Query) @@ -123,12 +123,12 @@ public override void OnBeforeCompleteMetadata() public override void OnBeforeCompleteMetadata( ITypeCompletionContext completionContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { // last in the initialization we need to intercept the query type and ensure that // authorization configuration is applied to the special introspection and node fields. if (ReferenceEquals(_queryContext, completionContext) && - definition is ObjectTypeConfiguration typeDef) + configuration is ObjectTypeConfiguration typeDef) { var state = _state ?? throw ThrowHelper.StateNotInitialized(); HandleSpecialQueryFields(new ObjectTypeInfo(completionContext, typeDef), state); diff --git a/src/HotChocolate/Core/src/Execution/DependencyInjection/SchemaRequestExecutorBuilderExtensions.Middleware.cs b/src/HotChocolate/Core/src/Execution/DependencyInjection/SchemaRequestExecutorBuilderExtensions.Middleware.cs index 42d3b934429..b8fd3c9e5c6 100644 --- a/src/HotChocolate/Core/src/Execution/DependencyInjection/SchemaRequestExecutorBuilderExtensions.Middleware.cs +++ b/src/HotChocolate/Core/src/Execution/DependencyInjection/SchemaRequestExecutorBuilderExtensions.Middleware.cs @@ -136,7 +136,7 @@ value is FieldMiddlewareLookup lookup && public override void OnAfterCompleteName( ITypeCompletionContext completionContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { if (!CanHandle(completionContext)) { @@ -149,7 +149,7 @@ public override void OnAfterCompleteName( return; } - if (definition is not ObjectTypeConfiguration def) + if (configuration is not ObjectTypeConfiguration def) { return; } diff --git a/src/HotChocolate/Core/src/Execution/RequestExecutorResolver.cs b/src/HotChocolate/Core/src/Execution/RequestExecutorResolver.cs index 51d8ee2f455..4c1597cbf09 100644 --- a/src/HotChocolate/Core/src/Execution/RequestExecutorResolver.cs +++ b/src/HotChocolate/Core/src/Execution/RequestExecutorResolver.cs @@ -562,11 +562,11 @@ private sealed class SetSchemaNameInterceptor(string schemaName) : TypeIntercept { public override void OnBeforeCompleteName( ITypeCompletionContext completionContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { if (completionContext.IsSchema) { - definition.Name = schemaName; + configuration.Name = schemaName; } } } diff --git a/src/HotChocolate/Core/src/Execution/Requirements/RequirementsTypeInterceptor.cs b/src/HotChocolate/Core/src/Execution/Requirements/RequirementsTypeInterceptor.cs index 7a2d98cb0ce..1142ec937cd 100644 --- a/src/HotChocolate/Core/src/Execution/Requirements/RequirementsTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Execution/Requirements/RequirementsTypeInterceptor.cs @@ -11,9 +11,9 @@ internal sealed class RequirementsTypeInterceptor : TypeInterceptor public override void OnBeforeCompleteName( ITypeCompletionContext completionContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { - if (definition is SchemaTypeConfiguration schema) + if (configuration is SchemaTypeConfiguration schema) { schema.Features.Set(_metadata); } @@ -21,9 +21,9 @@ public override void OnBeforeCompleteName( public override void OnBeforeCompleteType( ITypeCompletionContext completionContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { - if (definition is not ObjectTypeConfiguration typeDef) + if (configuration is not ObjectTypeConfiguration typeDef) { return; } diff --git a/src/HotChocolate/Core/src/Fetching/DataLoaderRootFieldTypeInterceptor.cs b/src/HotChocolate/Core/src/Fetching/DataLoaderRootFieldTypeInterceptor.cs index 8fea0b7140d..6f1b40d17c9 100644 --- a/src/HotChocolate/Core/src/Fetching/DataLoaderRootFieldTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Fetching/DataLoaderRootFieldTypeInterceptor.cs @@ -31,7 +31,7 @@ public override bool IsEnabled(IDescriptorContext context) public override void OnAfterResolveRootType( ITypeCompletionContext completionContext, - ObjectTypeConfiguration definition, + ObjectTypeConfiguration configuration, OperationType operationType) { if (operationType == OperationType.Query) @@ -42,10 +42,10 @@ public override void OnAfterResolveRootType( public override void OnBeforeCompleteType( ITypeCompletionContext completionContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { if (completionContext.Type == _queryType - && definition is ObjectTypeConfiguration typeDef) + && configuration is ObjectTypeConfiguration typeDef) { if (_services is null) { diff --git a/src/HotChocolate/Core/src/Types.Mutations/MutationConventionTypeInterceptor.cs b/src/HotChocolate/Core/src/Types.Mutations/MutationConventionTypeInterceptor.cs index 25d77207636..42923138038 100644 --- a/src/HotChocolate/Core/src/Types.Mutations/MutationConventionTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types.Mutations/MutationConventionTypeInterceptor.cs @@ -62,10 +62,10 @@ internal override void SetSiblings(TypeInterceptor[] all) public override void OnBeforeRegisterDependencies( ITypeDiscoveryContext discoveryContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { // we will use the error interface and implement it with each error type. - if (definition is ObjectTypeConfiguration objectTypeDef) + if (configuration is ObjectTypeConfiguration objectTypeDef) { TryAddErrorInterface(objectTypeDef, _errorTypeHelper.ErrorTypeInterfaceRef); } @@ -76,18 +76,18 @@ public override void OnAfterCompleteTypeNames() internal override void OnBeforeCompleteMutation( ITypeCompletionContext completionContext, - ObjectTypeConfiguration definition) + ObjectTypeConfiguration configuration) { // we first invoke our siblings to gather configurations. foreach (var sibling in _siblings) { - sibling.OnBeforeCompleteMutation(completionContext, definition); + sibling.OnBeforeCompleteMutation(completionContext, configuration); } // we need to capture a completion context to resolve types. // any context will do. _completionContext ??= completionContext; - _mutationTypeDef = definition; + _mutationTypeDef = configuration; // if we have found a mutation type we will start applying the mutation conventions // on the mutations. diff --git a/src/HotChocolate/Core/src/Types.Queries/QueryConventionTypeInterceptor.cs b/src/HotChocolate/Core/src/Types.Queries/QueryConventionTypeInterceptor.cs index 66c9cbce7b1..c7ca005a280 100644 --- a/src/HotChocolate/Core/src/Types.Queries/QueryConventionTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types.Queries/QueryConventionTypeInterceptor.cs @@ -28,25 +28,25 @@ internal override void InitializeContext( public override void OnAfterResolveRootType( ITypeCompletionContext completionContext, - ObjectTypeConfiguration definition, + ObjectTypeConfiguration configuration, OperationType operationType) { if (operationType is OperationType.Mutation) { - _mutationDef = definition; + _mutationDef = configuration; } } public override void OnAfterCompleteName( ITypeCompletionContext completionContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { - if (completionContext.Type is ObjectType && definition is ObjectTypeConfiguration typeDef) + if (completionContext.Type is ObjectType && configuration is ObjectTypeConfiguration typeDef) { _typeDefs.Add(typeDef); } - base.OnAfterCompleteName(completionContext, definition); + base.OnAfterCompleteName(completionContext, configuration); } public override void OnBeforeCompleteTypes() diff --git a/src/HotChocolate/Core/src/Types/Configuration/AggregateTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/Configuration/AggregateTypeInterceptor.cs index db34cc35726..fbc2ee02a77 100644 --- a/src/HotChocolate/Core/src/Types/Configuration/AggregateTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/Configuration/AggregateTypeInterceptor.cs @@ -162,14 +162,14 @@ public override void OnBeforeInitialize( public override void OnAfterInitialize( ITypeDiscoveryContext discoveryContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { ref var first = ref GetReference(); var length = _typeInterceptors.Length; for (var i = 0; i < length; i++) { - Unsafe.Add(ref first, i).OnAfterInitialize(discoveryContext, definition); + Unsafe.Add(ref first, i).OnAfterInitialize(discoveryContext, configuration); } } @@ -214,27 +214,27 @@ public override void OnTypesInitialized() public override void OnAfterRegisterDependencies( ITypeDiscoveryContext discoveryContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { ref var first = ref GetReference(); var length = _typeInterceptors.Length; for (var i = 0; i < length; i++) { - Unsafe.Add(ref first, i).OnAfterRegisterDependencies(discoveryContext, definition); + Unsafe.Add(ref first, i).OnAfterRegisterDependencies(discoveryContext, configuration); } } public override void OnBeforeRegisterDependencies( ITypeDiscoveryContext discoveryContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { ref var first = ref GetReference(); var length = _typeInterceptors.Length; for (var i = 0; i < length; i++) { - Unsafe.Add(ref first, i).OnBeforeRegisterDependencies(discoveryContext, definition); + Unsafe.Add(ref first, i).OnBeforeRegisterDependencies(discoveryContext, configuration); } } @@ -262,33 +262,33 @@ public override void OnAfterCompleteTypeNames() public override void OnBeforeCompleteName( ITypeCompletionContext completionContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { ref var first = ref GetReference(); var length = _typeInterceptors.Length; for (var i = 0; i < length; i++) { - Unsafe.Add(ref first, i).OnBeforeCompleteName(completionContext, definition); + Unsafe.Add(ref first, i).OnBeforeCompleteName(completionContext, configuration); } } public override void OnAfterCompleteName( ITypeCompletionContext completionContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { ref var first = ref GetReference(); var length = _typeInterceptors.Length; for (var i = 0; i < length; i++) { - Unsafe.Add(ref first, i).OnAfterCompleteName(completionContext, definition); + Unsafe.Add(ref first, i).OnAfterCompleteName(completionContext, configuration); } } public override void OnAfterResolveRootType( ITypeCompletionContext completionContext, - ObjectTypeConfiguration definition, + ObjectTypeConfiguration configuration, OperationType operationType) { ref var first = ref GetReference(); @@ -298,7 +298,7 @@ public override void OnAfterResolveRootType( { Unsafe.Add(ref first, i).OnAfterResolveRootType( completionContext, - definition, + configuration, operationType); } } @@ -338,11 +338,11 @@ public override void OnAfterMergeTypeExtensions() internal override void OnBeforeCompleteMutation( ITypeCompletionContext completionContext, - ObjectTypeConfiguration definition) + ObjectTypeConfiguration configuration) { if (_mutationAggregator is not null) { - _mutationAggregator.OnBeforeCompleteMutation(completionContext, definition); + _mutationAggregator.OnBeforeCompleteMutation(completionContext, configuration); return; } @@ -351,7 +351,7 @@ internal override void OnBeforeCompleteMutation( for (var i = 0; i < length; i++) { - Unsafe.Add(ref first, i).OnBeforeCompleteMutation(completionContext, definition); + Unsafe.Add(ref first, i).OnBeforeCompleteMutation(completionContext, configuration); } } @@ -379,27 +379,27 @@ public override void OnAfterCompleteTypes() public override void OnBeforeCompleteType( ITypeCompletionContext completionContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { ref var first = ref GetReference(); var length = _typeInterceptors.Length; for (var i = 0; i < length; i++) { - Unsafe.Add(ref first, i).OnBeforeCompleteType(completionContext, definition); + Unsafe.Add(ref first, i).OnBeforeCompleteType(completionContext, configuration); } } public override void OnAfterCompleteType( ITypeCompletionContext completionContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { ref var first = ref GetReference(); var length = _typeInterceptors.Length; for (var i = 0; i < length; i++) { - Unsafe.Add(ref first, i).OnAfterCompleteType(completionContext, definition); + Unsafe.Add(ref first, i).OnAfterCompleteType(completionContext, configuration); } } @@ -427,27 +427,27 @@ public override void OnAfterCompleteMetadata() public override void OnBeforeCompleteMetadata( ITypeCompletionContext context, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { ref var first = ref GetReference(); var length = _typeInterceptors.Length; for (var i = 0; i < length; i++) { - Unsafe.Add(ref first, i).OnBeforeCompleteMetadata(context, definition); + Unsafe.Add(ref first, i).OnBeforeCompleteMetadata(context, configuration); } } public override void OnAfterCompleteMetadata( ITypeCompletionContext context, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { ref var first = ref GetReference(); var length = _typeInterceptors.Length; for (var i = 0; i < length; i++) { - Unsafe.Add(ref first, i).OnAfterCompleteMetadata(context, definition); + Unsafe.Add(ref first, i).OnAfterCompleteMetadata(context, configuration); } } @@ -475,59 +475,59 @@ public override void OnAfterMakeExecutable() public override void OnBeforeMakeExecutable( ITypeCompletionContext context, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { ref var first = ref GetReference(); var length = _typeInterceptors.Length; for (var i = 0; i < length; i++) { - Unsafe.Add(ref first, i).OnBeforeMakeExecutable(context, definition); + Unsafe.Add(ref first, i).OnBeforeMakeExecutable(context, configuration); } } public override void OnAfterMakeExecutable( ITypeCompletionContext context, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { ref var first = ref GetReference(); var length = _typeInterceptors.Length; for (var i = 0; i < length; i++) { - Unsafe.Add(ref first, i).OnAfterMakeExecutable(context, definition); + Unsafe.Add(ref first, i).OnAfterMakeExecutable(context, configuration); } } public override void OnValidateType( - ITypeSystemObjectContext validationContext, - TypeSystemConfiguration definition) + ITypeSystemObjectContext context, + TypeSystemConfiguration configuration) { ref var first = ref GetReference(); var length = _typeInterceptors.Length; for (var i = 0; i < length; i++) { - Unsafe.Add(ref first, i).OnValidateType(validationContext, definition); + Unsafe.Add(ref first, i).OnValidateType(context, configuration); } } public override bool TryCreateScope( - ITypeDiscoveryContext discoveryContext, - [NotNullWhen(true)] out IReadOnlyList? typeDeps) + ITypeDiscoveryContext context, + [NotNullWhen(true)] out IReadOnlyList? dependencies) { ref var first = ref GetReference(); var length = _typeInterceptors.Length; for (var i = 0; i < length; i++) { - if (Unsafe.Add(ref first, i).TryCreateScope(discoveryContext, out typeDeps)) + if (Unsafe.Add(ref first, i).TryCreateScope(context, out dependencies)) { return true; } } - typeDeps = null; + dependencies = null; return false; } @@ -544,14 +544,14 @@ public override void OnTypesCompleted() internal override void OnBeforeRegisterSchemaTypes( IDescriptorContext context, - SchemaTypesDefinition schemaTypesDefinition) + SchemaTypesConfiguration configuration) { ref var first = ref GetReference(); var length = _typeInterceptors.Length; for (var i = 0; i < length; i++) { - Unsafe.Add(ref first, i).OnBeforeRegisterSchemaTypes(context, schemaTypesDefinition); + Unsafe.Add(ref first, i).OnBeforeRegisterSchemaTypes(context, configuration); } } diff --git a/src/HotChocolate/Core/src/Types/Configuration/TypeInterceptor.cs b/src/HotChocolate/Core/src/Types/Configuration/TypeInterceptor.cs index 0a6d1d48175..77f12860531 100644 --- a/src/HotChocolate/Core/src/Types/Configuration/TypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/Configuration/TypeInterceptor.cs @@ -79,7 +79,7 @@ internal virtual bool SkipDirectiveDefinition(DirectiveDefinitionNode node) /// /// This event is triggered after the type instance was created but before - /// any type definition was initialized. + /// any type system configuration is initialized. /// /// /// The type discovery context. @@ -90,19 +90,19 @@ public virtual void OnBeforeInitialize( } /// - /// This event is triggered after the type type definition was initialized and + /// This event is triggered after the type system configuration was initialized and /// after the dependencies of this type have been registered /// with the type discovery context. /// /// /// The type discovery context. /// - /// - /// The type definition of the type system member. + /// + /// The type system configuration of the type system member. /// public virtual void OnAfterInitialize( ITypeDiscoveryContext discoveryContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { } @@ -133,34 +133,35 @@ public virtual void OnTypeRegistered( public virtual void OnTypesInitialized() { } /// - /// This event is called after the type definition is initialized + /// This event is called after the type system configuration is initialized /// but before the type dependencies are reported to the discovery context. /// /// /// The type discovery context. /// - /// - /// The type definition of the type system member. + /// + /// The type system configuration of the type system member. /// public virtual void OnBeforeRegisterDependencies( ITypeDiscoveryContext discoveryContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { } /// /// This event is called after the type dependencies are reported to the - /// type discovery context but before the type definition is fully initialized. + /// type discovery context but before the type system configuration + /// is fully initialized. /// /// /// The type discovery context. /// - /// - /// The type definition of the type system member. + /// + /// The type system configuration of the type system member. /// public virtual void OnAfterRegisterDependencies( ITypeDiscoveryContext discoveryContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { } @@ -180,12 +181,12 @@ public virtual void OnAfterCompleteTypeNames() { } /// /// The type completion context. /// - /// - /// The type definition of the type system member. + /// + /// The type system configuration of the type system member. /// public virtual void OnBeforeCompleteName( ITypeCompletionContext completionContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { } @@ -195,12 +196,12 @@ public virtual void OnBeforeCompleteName( /// /// The type completion context. /// - /// - /// The type definition of the type system member. + /// + /// The type system configuration of the type system member. /// public virtual void OnAfterCompleteName( ITypeCompletionContext completionContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { } @@ -210,8 +211,8 @@ public virtual void OnAfterCompleteName( /// /// The type completion context. /// - /// - /// The type definition of the type system member. + /// + /// The type system configuration of the type system member. /// /// /// Specifies what kind of operation type is resolved. @@ -221,7 +222,7 @@ public virtual void OnAfterCompleteName( #endif public virtual void OnAfterResolveRootType( ITypeCompletionContext completionContext, - ObjectTypeConfiguration definition, + ObjectTypeConfiguration configuration, OperationType operationType) { } @@ -243,9 +244,9 @@ public virtual void OnAfterMergeTypeExtensions() { } internal virtual void OnBeforeCompleteMutation( ITypeCompletionContext completionContext, - ObjectTypeConfiguration definition) + ObjectTypeConfiguration configuration) { - foreach (var field in definition.Fields) + foreach (var field in configuration.Fields) { OnBeforeCompleteMutationField(completionContext, field); } @@ -278,12 +279,12 @@ public virtual void OnAfterCompleteTypes() { } /// /// The type completion context. /// - /// - /// The type definition of the type system member. + /// + /// The type system configuration of the type system member. /// public virtual void OnBeforeCompleteType( ITypeCompletionContext completionContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { } @@ -293,12 +294,12 @@ public virtual void OnBeforeCompleteType( /// /// The type completion context. /// - /// - /// The type definition of the type system member. + /// + /// The type system configuration of the type system member. /// public virtual void OnAfterCompleteType( ITypeCompletionContext completionContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { } @@ -318,12 +319,12 @@ public virtual void OnAfterCompleteMetadata() { } /// /// The type completion context. /// - /// - /// The type definition of the type system member. + /// + /// The type system configuration of the type system member. /// public virtual void OnBeforeCompleteMetadata( ITypeCompletionContext context, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { } @@ -333,12 +334,12 @@ public virtual void OnBeforeCompleteMetadata( /// /// The type completion context. /// - /// - /// The type definition of the type system member. + /// + /// The type system configuration of the type system member. /// public virtual void OnAfterCompleteMetadata( ITypeCompletionContext context, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { } @@ -358,12 +359,12 @@ public virtual void OnAfterMakeExecutable() { } /// /// The type completion context. /// - /// - /// The type definition of the type system member. + /// + /// The type system configuration of the type system member. /// public virtual void OnBeforeMakeExecutable( ITypeCompletionContext context, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { } @@ -373,12 +374,12 @@ public virtual void OnBeforeMakeExecutable( /// /// The type completion context. /// - /// - /// The type definition of the type system member. + /// + /// The type system configuration of the type system member. /// public virtual void OnAfterMakeExecutable( ITypeCompletionContext context, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { } @@ -387,15 +388,15 @@ public virtual void OnAfterMakeExecutable( /// intended to add validation logic. If the type is not valid throw a /// . /// - /// + /// /// The type completion context. /// - /// - /// The type definition of the type system member. + /// + /// The type system configuration of the type system member. /// public virtual void OnValidateType( - ITypeSystemObjectContext validationContext, - TypeSystemConfiguration definition) + ITypeSystemObjectContext context, + TypeSystemConfiguration configuration) { } @@ -407,12 +408,12 @@ public virtual void OnValidateType( /// /// The descriptor context. /// - /// - /// The schema types definition. + /// + /// The schema types configuration. /// internal virtual void OnBeforeRegisterSchemaTypes( IDescriptorContext context, - SchemaTypesDefinition schemaTypesDefinition) + SchemaTypesConfiguration configuration) { } @@ -451,17 +452,17 @@ public virtual void OnCreateSchemaError(IDescriptorContext context, Exception er /// /// This event is called after the type was registered with the type registry. /// - /// + /// /// The type discovery context. /// - /// + /// /// /// public virtual bool TryCreateScope( - ITypeDiscoveryContext discoveryContext, - [NotNullWhen(true)] out IReadOnlyList? typeDependencies) + ITypeDiscoveryContext context, + [NotNullWhen(true)] out IReadOnlyList? dependencies) { - typeDependencies = null; + dependencies = null; return false; } } diff --git a/src/HotChocolate/Core/src/Types/Schema.Initialization.cs b/src/HotChocolate/Core/src/Types/Schema.Initialization.cs index 9afaa9c9c18..220bfc0ac8a 100644 --- a/src/HotChocolate/Core/src/Types/Schema.Initialization.cs +++ b/src/HotChocolate/Core/src/Types/Schema.Initialization.cs @@ -89,11 +89,11 @@ protected override void OnCompleteMetadata( Directives = DirectiveCollection.CreateAndComplete(context, this, definition.GetDirectives()); } - internal void CompleteSchema(SchemaTypesDefinition schemaTypesDefinition) + internal void CompleteSchema(SchemaTypesConfiguration schemaTypesConfiguration) { - if (schemaTypesDefinition is null) + if (schemaTypesConfiguration is null) { - throw new ArgumentNullException(nameof(schemaTypesDefinition)); + throw new ArgumentNullException(nameof(schemaTypesConfiguration)); } if (_sealed) @@ -102,14 +102,14 @@ internal void CompleteSchema(SchemaTypesDefinition schemaTypesDefinition) "This schema is already sealed and cannot be mutated."); } - if (schemaTypesDefinition.Types is null || schemaTypesDefinition.DirectiveTypes is null) + if (schemaTypesConfiguration.Types is null || schemaTypesConfiguration.DirectiveTypes is null) { throw new InvalidOperationException( "The schema type collections are not initialized."); } - DirectiveTypes = schemaTypesDefinition.DirectiveTypes; - _types = new SchemaTypes(schemaTypesDefinition); + DirectiveTypes = schemaTypesConfiguration.DirectiveTypes; + _types = new SchemaTypes(schemaTypesConfiguration); _directiveTypes = DirectiveTypes.ToFrozenDictionary(t => t.Name, StringComparer.Ordinal); _sealed = true; } diff --git a/src/HotChocolate/Core/src/Types/SchemaBuilder.Setup.cs b/src/HotChocolate/Core/src/Types/SchemaBuilder.Setup.cs index 5e9865f6b66..d03ac360466 100644 --- a/src/HotChocolate/Core/src/Types/SchemaBuilder.Setup.cs +++ b/src/HotChocolate/Core/src/Types/SchemaBuilder.Setup.cs @@ -394,12 +394,12 @@ private static Schema CompleteSchema( return schema; } - private static SchemaTypesDefinition CreateSchemaDefinition( + private static SchemaTypesConfiguration CreateSchemaDefinition( SchemaBuilder builder, IDescriptorContext context, TypeRegistry typeRegistry) { - var definition = new SchemaTypesDefinition(); + var definition = new SchemaTypesConfiguration(); RegisterOperationName( builder, @@ -431,7 +431,7 @@ private static SchemaTypesDefinition CreateSchemaDefinition( } private static void ResolveOperations( - SchemaTypesDefinition schemaDef, + SchemaTypesConfiguration schemaDef, Dictionary operations, TypeRegistry typeRegistry) { @@ -538,14 +538,14 @@ static void Throw(INamedType namedType, OperationType operation) private static IReadOnlyCollection RemoveUnreachableTypes( SchemaBuilder builder, TypeRegistry typeRegistry, - SchemaTypesDefinition definition) + SchemaTypesConfiguration configuration) { if (builder._options.RemoveUnreachableTypes) { var trimmer = new TypeTrimmer(typeRegistry.Types.Select(t => t.Type)); - trimmer.AddOperationType(definition.QueryType); - trimmer.AddOperationType(definition.MutationType); - trimmer.AddOperationType(definition.SubscriptionType); + trimmer.AddOperationType(configuration.QueryType); + trimmer.AddOperationType(configuration.MutationType); + trimmer.AddOperationType(configuration.SubscriptionType); return trimmer.Trim(); } diff --git a/src/HotChocolate/Core/src/Types/SchemaTypes.cs b/src/HotChocolate/Core/src/Types/SchemaTypes.cs index 08aa0f21c23..23fdabfb8dc 100644 --- a/src/HotChocolate/Core/src/Types/SchemaTypes.cs +++ b/src/HotChocolate/Core/src/Types/SchemaTypes.cs @@ -12,25 +12,25 @@ internal sealed class SchemaTypes private readonly FrozenDictionary _types; private readonly FrozenDictionary> _possibleTypes; - public SchemaTypes(SchemaTypesDefinition definition) + public SchemaTypes(SchemaTypesConfiguration configuration) { - if (definition is null) + if (configuration is null) { - throw new ArgumentNullException(nameof(definition)); + throw new ArgumentNullException(nameof(configuration)); } - if (definition.Types is null || definition.DirectiveTypes is null) + if (configuration.Types is null || configuration.DirectiveTypes is null) { throw new ArgumentException( SchemaTypes_DefinitionInvalid, - nameof(definition)); + nameof(configuration)); } - _types = definition.Types.ToFrozenDictionary(t => t.Name, StringComparer.Ordinal); - _possibleTypes = CreatePossibleTypeLookup(definition.Types).ToFrozenDictionary(StringComparer.Ordinal); - QueryType = definition.QueryType!; - MutationType = definition.MutationType; - SubscriptionType = definition.SubscriptionType; + _types = configuration.Types.ToFrozenDictionary(t => t.Name, StringComparer.Ordinal); + _possibleTypes = CreatePossibleTypeLookup(configuration.Types).ToFrozenDictionary(StringComparer.Ordinal); + QueryType = configuration.QueryType!; + MutationType = configuration.MutationType; + SubscriptionType = configuration.SubscriptionType; } public ObjectType QueryType { get; } diff --git a/src/HotChocolate/Core/src/Types/SchemaTypesDefinition.cs b/src/HotChocolate/Core/src/Types/SchemaTypesConfiguration.cs similarity index 95% rename from src/HotChocolate/Core/src/Types/SchemaTypesDefinition.cs rename to src/HotChocolate/Core/src/Types/SchemaTypesConfiguration.cs index da67404d2a2..53aa72bbd9d 100644 --- a/src/HotChocolate/Core/src/Types/SchemaTypesDefinition.cs +++ b/src/HotChocolate/Core/src/Types/SchemaTypesConfiguration.cs @@ -8,7 +8,7 @@ namespace HotChocolate; /// The schema type definition is a mutable object that is used during type initialization /// to configure the properties. /// -internal sealed class SchemaTypesDefinition +internal sealed class SchemaTypesConfiguration { /// /// Gets the mandatory query type of the schema. diff --git a/src/HotChocolate/Core/src/Types/SemanticNonNullTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/SemanticNonNullTypeInterceptor.cs index b4ce30ced75..74b51a2d65f 100644 --- a/src/HotChocolate/Core/src/Types/SemanticNonNullTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/SemanticNonNullTypeInterceptor.cs @@ -29,23 +29,23 @@ internal override void InitializeContext( _typeInspector = context.TypeInspector; } - public override void OnAfterResolveRootType(ITypeCompletionContext completionContext, ObjectTypeConfiguration definition, + public override void OnAfterResolveRootType(ITypeCompletionContext completionContext, ObjectTypeConfiguration configuration, OperationType operationType) { if (operationType is OperationType.Mutation) { - _mutationDef = definition; + _mutationDef = configuration; } } - public override void OnBeforeCompleteType(ITypeCompletionContext completionContext, TypeSystemConfiguration definition) + public override void OnBeforeCompleteType(ITypeCompletionContext completionContext, TypeSystemConfiguration configuration) { if (completionContext.IsIntrospectionType) { return; } - if (definition is ObjectTypeConfiguration objectDef) + if (configuration is ObjectTypeConfiguration objectDef) { if (objectDef.Name is "CollectionSegmentInfo" or "PageInfo") { @@ -89,7 +89,7 @@ public override void OnBeforeCompleteType(ITypeCompletionContext completionConte field.FormatterDefinitions.Add(CreateSemanticNonNullResultFormatterDefinition(levels)); } } - else if (definition is InterfaceTypeConfiguration interfaceDef) + else if (configuration is InterfaceTypeConfiguration interfaceDef) { if (interfaceDef.Name == "Node") { diff --git a/src/HotChocolate/Core/src/Types/StoreGlobalPagingOptionsTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/StoreGlobalPagingOptionsTypeInterceptor.cs index 6c5880ce281..678da71d5d5 100644 --- a/src/HotChocolate/Core/src/Types/StoreGlobalPagingOptionsTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/StoreGlobalPagingOptionsTypeInterceptor.cs @@ -10,9 +10,9 @@ internal sealed class StoreGlobalPagingOptionsTypeInterceptor : TypeInterceptor { public override void OnBeforeCompleteType( ITypeCompletionContext completionContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { - if(definition is SchemaTypeConfiguration schemaDef) + if(configuration is SchemaTypeConfiguration schemaDef) { var options = completionContext.DescriptorContext.GetPagingOptions(null); schemaDef.Features.Set(options); diff --git a/src/HotChocolate/Core/src/Types/Types/Directives/DirectiveTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/Types/Directives/DirectiveTypeInterceptor.cs index 4a8352e6159..deb1cc31c14 100644 --- a/src/HotChocolate/Core/src/Types/Types/Directives/DirectiveTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Directives/DirectiveTypeInterceptor.cs @@ -13,9 +13,9 @@ internal sealed class DirectiveTypeInterceptor : TypeInterceptor public override void OnAfterCompleteMetadata( ITypeCompletionContext context, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { - base.OnAfterCompleteMetadata(context, definition); + base.OnAfterCompleteMetadata(context, configuration); if (!((RegisteredType)context).HasErrors) { @@ -25,11 +25,11 @@ public override void OnAfterCompleteMetadata( internal override void OnBeforeRegisterSchemaTypes( IDescriptorContext context, - SchemaTypesDefinition schemaTypesDefinition) + SchemaTypesConfiguration configuration) { List? discarded = null; - foreach (var directiveType in schemaTypesDefinition.DirectiveTypes!) + foreach (var directiveType in configuration.DirectiveTypes!) { if (directiveType is { IsTypeSystemDirective: true, IsExecutableDirective: false } && !directiveType.Name.EqualsOrdinal(WellKnownDirectives.Deprecated) && @@ -42,8 +42,8 @@ internal override void OnBeforeRegisterSchemaTypes( if (discarded is not null) { - schemaTypesDefinition.DirectiveTypes = - schemaTypesDefinition.DirectiveTypes!.Except(discarded).ToArray(); + configuration.DirectiveTypes = + configuration.DirectiveTypes!.Except(discarded).ToArray(); } } diff --git a/src/HotChocolate/Core/src/Types/Types/Factories/SchemaFirstTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/Types/Factories/SchemaFirstTypeInterceptor.cs index 2d672c3791a..f6478872f21 100644 --- a/src/HotChocolate/Core/src/Types/Types/Factories/SchemaFirstTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Factories/SchemaFirstTypeInterceptor.cs @@ -17,10 +17,10 @@ internal sealed class SchemaFirstTypeInterceptor : TypeInterceptor public override void OnAfterCompleteName( ITypeCompletionContext completionContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { if (_directives.TryGetValue(completionContext.Type.Name, out var directives) - && definition is ScalarTypeConfiguration scalarTypeDef) + && configuration is ScalarTypeConfiguration scalarTypeDef) { foreach (var directive in directives) { diff --git a/src/HotChocolate/Core/src/Types/Types/Interceptors/FlagEnumTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/Types/Interceptors/FlagEnumTypeInterceptor.cs index 8c97f400397..9b0869779d5 100644 --- a/src/HotChocolate/Core/src/Types/Types/Interceptors/FlagEnumTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Interceptors/FlagEnumTypeInterceptor.cs @@ -33,9 +33,9 @@ internal override void InitializeContext( public override void OnBeforeRegisterDependencies( ITypeDiscoveryContext discoveryContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { - switch (definition) + switch (configuration) { case ObjectTypeConfiguration o: ProcessOutputFields(o.Fields); diff --git a/src/HotChocolate/Core/src/Types/Types/Interceptors/InterfaceCompletionTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/Types/Interceptors/InterfaceCompletionTypeInterceptor.cs index 7617ab634d5..4e03ea129a3 100644 --- a/src/HotChocolate/Core/src/Types/Types/Interceptors/InterfaceCompletionTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Interceptors/InterfaceCompletionTypeInterceptor.cs @@ -17,11 +17,11 @@ internal sealed class InterfaceCompletionTypeInterceptor : TypeInterceptor public override void OnAfterInitialize( ITypeDiscoveryContext discoveryContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { // we need to preserve the initialization context of all // interface types and object types. - if (definition is IComplexOutputTypeConfiguration typeDefinition) + if (configuration is IComplexOutputTypeConfiguration typeDefinition) { _typeInfos.Add(discoveryContext.Type, new(discoveryContext, typeDefinition)); } @@ -97,9 +97,9 @@ private Type GetRuntimeType(TypeInfo typeInfo) public override void OnBeforeCompleteType( ITypeCompletionContext completionContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { - if (definition is InterfaceTypeConfiguration { Interfaces: { Count: > 0, }, } typeDef) + if (configuration is InterfaceTypeConfiguration { Interfaces: { Count: > 0, }, } typeDef) { _completed.Clear(); _completedFields.Clear(); @@ -124,7 +124,7 @@ public override void OnBeforeCompleteType( CompleteInterfacesAndFields(typeDef); } - if (definition is ObjectTypeConfiguration { Interfaces: { Count: > 0, }, } objectTypeDef) + if (configuration is ObjectTypeConfiguration { Interfaces: { Count: > 0, }, } objectTypeDef) { _completed.Clear(); _completedFields.Clear(); diff --git a/src/HotChocolate/Core/src/Types/Types/Interceptors/MiddlewareValidationTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/Types/Interceptors/MiddlewareValidationTypeInterceptor.cs index 25b75cfbddd..f950e1fe3f2 100644 --- a/src/HotChocolate/Core/src/Types/Types/Interceptors/MiddlewareValidationTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Interceptors/MiddlewareValidationTypeInterceptor.cs @@ -19,10 +19,10 @@ internal sealed class MiddlewareValidationTypeInterceptor : TypeInterceptor public override void OnAfterCompleteType( ITypeCompletionContext completionContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { if (completionContext.DescriptorContext.Options.ValidatePipelineOrder && - definition is ObjectTypeConfiguration objectTypeDef) + configuration is ObjectTypeConfiguration objectTypeDef) { foreach (var field in objectTypeDef.Fields) { diff --git a/src/HotChocolate/Core/src/Types/Types/Interceptors/ResolverTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/Types/Interceptors/ResolverTypeInterceptor.cs index 8ffa79c88be..b448ca20a44 100644 --- a/src/HotChocolate/Core/src/Types/Types/Interceptors/ResolverTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Interceptors/ResolverTypeInterceptor.cs @@ -53,10 +53,10 @@ internal override void InitializeContext( public override void OnAfterInitialize( ITypeDiscoveryContext discoveryContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { if (discoveryContext is { IsIntrospectionType: false, Type: IHasName namedType, } && - definition is ITypeConfiguration { NeedsNameCompletion: false, } typeDef) + configuration is ITypeConfiguration { NeedsNameCompletion: false, } typeDef) { if (typeDef.RuntimeType == typeof(object) && _runtimeTypes.TryGetValue(typeDef.Name, out var type)) @@ -97,10 +97,10 @@ public override IEnumerable RegisterMoreTypes( public override void OnAfterCompleteName( ITypeCompletionContext completionContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { if (completionContext is { IsIntrospectionType: false, Type: IHasName namedType, } && - definition is ITypeConfiguration typeDef) + configuration is ITypeConfiguration typeDef) { if (typeDef.RuntimeType == typeof(object) && _runtimeTypes.TryGetValue(typeDef.Name, out var type)) diff --git a/src/HotChocolate/Core/src/Types/Types/Interceptors/TypeValidationTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/Types/Interceptors/TypeValidationTypeInterceptor.cs index e00d9d5d778..8ae93ef6175 100644 --- a/src/HotChocolate/Core/src/Types/Types/Interceptors/TypeValidationTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Interceptors/TypeValidationTypeInterceptor.cs @@ -10,14 +10,14 @@ internal sealed class TypeValidationTypeInterceptor : TypeInterceptor { public override void OnBeforeRegisterDependencies( ITypeDiscoveryContext discoveryContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { if (discoveryContext.IsIntrospectionType) { return; } - switch (definition) + switch (configuration) { case ObjectTypeConfiguration od: ValidateObjectType(discoveryContext, od); diff --git a/src/HotChocolate/Core/src/Types/Types/Introspection/IntrospectionTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/Types/Introspection/IntrospectionTypeInterceptor.cs index c412bdc6ec5..91c552cda8c 100644 --- a/src/HotChocolate/Core/src/Types/Types/Introspection/IntrospectionTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Introspection/IntrospectionTypeInterceptor.cs @@ -28,9 +28,9 @@ internal override void InitializeContext( public override void OnAfterCompleteName( ITypeCompletionContext completionContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { - if(completionContext.Type is ObjectType && definition is ObjectTypeConfiguration typeDef) + if(completionContext.Type is ObjectType && configuration is ObjectTypeConfiguration typeDef) { _objectTypeDefinitions.Add(typeDef); } @@ -38,12 +38,12 @@ public override void OnAfterCompleteName( public override void OnAfterResolveRootType( ITypeCompletionContext completionContext, - ObjectTypeConfiguration definition, + ObjectTypeConfiguration configuration, OperationType operationType) { if (operationType is OperationType.Query) { - _queryTypeDefinition = definition; + _queryTypeDefinition = configuration; } } diff --git a/src/HotChocolate/Core/src/Types/Types/Relay/NodeFieldTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/Types/Relay/NodeFieldTypeInterceptor.cs index 09ed2256a17..25abeb8a254 100644 --- a/src/HotChocolate/Core/src/Types/Types/Relay/NodeFieldTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Relay/NodeFieldTypeInterceptor.cs @@ -24,13 +24,13 @@ internal sealed class NodeFieldTypeInterceptor : TypeInterceptor public override void OnAfterResolveRootType( ITypeCompletionContext completionContext, - ObjectTypeConfiguration definition, + ObjectTypeConfiguration configuration, OperationType operationType) { if (operationType is OperationType.Query) { _queryContext = completionContext; - _queryTypeDefinition = definition; + _queryTypeDefinition = configuration; } } diff --git a/src/HotChocolate/Core/src/Types/Types/Relay/NodeIdSerializerTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/Types/Relay/NodeIdSerializerTypeInterceptor.cs index 6ff7d0e849f..05e65df11a9 100644 --- a/src/HotChocolate/Core/src/Types/Types/Relay/NodeIdSerializerTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Relay/NodeIdSerializerTypeInterceptor.cs @@ -11,9 +11,9 @@ namespace HotChocolate.Types.Relay; internal sealed class NodeIdSerializerTypeInterceptor : TypeInterceptor { - public override void OnBeforeCompleteType(ITypeCompletionContext completionContext, TypeSystemConfiguration definition) + public override void OnBeforeCompleteType(ITypeCompletionContext completionContext, TypeSystemConfiguration configuration) { - if (definition is SchemaTypeConfiguration schemaTypeDef) + if (configuration is SchemaTypeConfiguration schemaTypeDef) { // we ensure that the serializer type map exists. if (!completionContext.DescriptorContext.ContextData.TryGetValue(SerializerTypes, out var value)) diff --git a/src/HotChocolate/Core/src/Types/Types/Relay/NodeResolverTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/Types/Relay/NodeResolverTypeInterceptor.cs index 40da7ab6508..b4f07483e7e 100644 --- a/src/HotChocolate/Core/src/Types/Types/Relay/NodeResolverTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Relay/NodeResolverTypeInterceptor.cs @@ -36,7 +36,7 @@ TypeDef is not null && public override void OnAfterResolveRootType( ITypeCompletionContext completionContext, - ObjectTypeConfiguration definition, + ObjectTypeConfiguration configuration, OperationType operationType) { // we are only interested in the query type to infer node resolvers. @@ -44,7 +44,7 @@ public override void OnAfterResolveRootType( completionContext.Type is ObjectType queryType) { CompletionContext = completionContext; - TypeDef = definition; + TypeDef = configuration; QueryType = queryType; } } diff --git a/src/HotChocolate/Core/src/Types/Types/Relay/QueryFieldTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/Types/Relay/QueryFieldTypeInterceptor.cs index de22450500e..6284e16854c 100644 --- a/src/HotChocolate/Core/src/Types/Types/Relay/QueryFieldTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Relay/QueryFieldTypeInterceptor.cs @@ -21,7 +21,7 @@ internal sealed class QueryFieldTypeInterceptor : TypeInterceptor public override void OnAfterResolveRootType( ITypeCompletionContext completionContext, - ObjectTypeConfiguration definition, + ObjectTypeConfiguration configuration, OperationType operationType) { _context ??= completionContext; @@ -33,7 +33,7 @@ public override void OnAfterResolveRootType( break; case OperationType.Mutation: - _mutationDefinition = (ObjectTypeConfiguration)definition; + _mutationDefinition = (ObjectTypeConfiguration)configuration; break; } } @@ -67,10 +67,10 @@ public override void OnBeforeCompleteTypes() public override void OnBeforeCompleteType( ITypeCompletionContext completionContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { if (completionContext.Type is ObjectType objectType - && definition is ObjectTypeConfiguration objectTypeDef + && configuration is ObjectTypeConfiguration objectTypeDef && _payloads.Contains(objectType.Name)) { if (objectTypeDef.Fields.Any(t => t.Name.EqualsOrdinal(_queryField.Name))) diff --git a/src/HotChocolate/Core/test/Types.Mutations.Tests/AnnotationBasedMutations.cs b/src/HotChocolate/Core/test/Types.Mutations.Tests/AnnotationBasedMutations.cs index acd82b34afd..ca063690458 100644 --- a/src/HotChocolate/Core/test/Types.Mutations.Tests/AnnotationBasedMutations.cs +++ b/src/HotChocolate/Core/test/Types.Mutations.Tests/AnnotationBasedMutations.cs @@ -1410,9 +1410,9 @@ internal class SimpleMutation_ErrorViaTypeInterceptor : TypeInterceptor { public override void OnBeforeCompleteType( ITypeCompletionContext completionContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { - if (definition is not ObjectTypeConfiguration objTypeDef) + if (configuration is not ObjectTypeConfiguration objTypeDef) { return; } @@ -1420,9 +1420,9 @@ public override void OnBeforeCompleteType( public override void OnBeforeRegisterDependencies( ITypeDiscoveryContext discoveryContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { - if (definition is ObjectTypeConfiguration objTypeDef) + if (configuration is ObjectTypeConfiguration objTypeDef) { foreach (var fieldDef in objTypeDef.Fields) { diff --git a/src/HotChocolate/Core/test/Types.Tests/Configuration/TypeScopeInterceptorTests.cs b/src/HotChocolate/Core/test/Types.Tests/Configuration/TypeScopeInterceptorTests.cs index f4be9994bbd..9f7a0b7bcbb 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Configuration/TypeScopeInterceptorTests.cs +++ b/src/HotChocolate/Core/test/Types.Tests/Configuration/TypeScopeInterceptorTests.cs @@ -79,9 +79,9 @@ public TypeScopeInterceptor(ICollection types) public override void OnBeforeRegisterDependencies( ITypeDiscoveryContext discoveryContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { - if (discoveryContext is { Scope: { }, } && definition is ObjectTypeConfiguration def) + if (discoveryContext is { Scope: { }, } && configuration is ObjectTypeConfiguration def) { _contexts.Add(discoveryContext); @@ -97,11 +97,11 @@ public override void OnBeforeRegisterDependencies( public override void OnBeforeCompleteName( ITypeCompletionContext completionContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { if (completionContext is { Scope: { }, }) { - definition.Name = completionContext.Scope + "_" + definition.Name; + configuration.Name = completionContext.Scope + "_" + configuration.Name; } } diff --git a/src/HotChocolate/Core/test/Types.Tests/SchemaBuilderTests.cs b/src/HotChocolate/Core/test/Types.Tests/SchemaBuilderTests.cs index ce4df7779e7..08ee19cf65c 100644 --- a/src/HotChocolate/Core/test/Types.Tests/SchemaBuilderTests.cs +++ b/src/HotChocolate/Core/test/Types.Tests/SchemaBuilderTests.cs @@ -2273,16 +2273,16 @@ public class MyInterceptor : TypeInterceptor { public override void OnBeforeCompleteType( ITypeCompletionContext completionContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { - definition.TouchContextData(); + configuration.TouchContextData(); } public override void OnAfterCompleteType( ITypeCompletionContext completionContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { - definition.ContextData.Add("touched", true); + configuration.ContextData.Add("touched", true); } } diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/Relay/IdAttributeTests.cs b/src/HotChocolate/Core/test/Types.Tests/Types/Relay/IdAttributeTests.cs index ff539901d3c..a70fd7074b9 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Types/Relay/IdAttributeTests.cs +++ b/src/HotChocolate/Core/test/Types.Tests/Types/Relay/IdAttributeTests.cs @@ -716,11 +716,11 @@ public class TestTypeInterceptor : TypeInterceptor public int Count { get; set; } public override void OnValidateType( - ITypeSystemObjectContext validationContext, - TypeSystemConfiguration definition) + ITypeSystemObjectContext context, + TypeSystemConfiguration configuration) { - if (validationContext.Type.Name.EqualsOrdinal("Query") && - definition is ObjectTypeConfiguration typeDef) + if (context.Type.Name.EqualsOrdinal("Query") && + configuration is ObjectTypeConfiguration typeDef) { Count = typeDef.Fields .Single(t => t.Name.EqualsOrdinal("abc")) diff --git a/src/HotChocolate/CostAnalysis/src/CostAnalysis/CostTypeInterceptor.cs b/src/HotChocolate/CostAnalysis/src/CostAnalysis/CostTypeInterceptor.cs index e67f5862acf..919776eb0ef 100644 --- a/src/HotChocolate/CostAnalysis/src/CostAnalysis/CostTypeInterceptor.cs +++ b/src/HotChocolate/CostAnalysis/src/CostAnalysis/CostTypeInterceptor.cs @@ -43,9 +43,9 @@ internal override void InitializeContext( TypeReferenceResolver typeReferenceResolver) => _options = context.Services.GetRequiredService(); - public override void OnAfterCompleteName(ITypeCompletionContext completionContext, TypeSystemConfiguration definition) + public override void OnAfterCompleteName(ITypeCompletionContext completionContext, TypeSystemConfiguration configuration) { - if (definition is ObjectTypeConfiguration objectTypeDef) + if (configuration is ObjectTypeConfiguration objectTypeDef) { foreach (var fieldDef in objectTypeDef.Fields) { @@ -118,7 +118,7 @@ public override void OnAfterCompleteName(ITypeCompletionContext completionContex } } - if (definition is InputObjectTypeConfiguration inputObjectTypeDef) + if (configuration is InputObjectTypeConfiguration inputObjectTypeDef) { foreach (var fieldDef in inputObjectTypeDef.Fields) { @@ -151,9 +151,9 @@ public override void OnAfterCompleteName(ITypeCompletionContext completionContex } } - public override void OnBeforeCompleteType(ITypeCompletionContext completionContext, TypeSystemConfiguration definition) + public override void OnBeforeCompleteType(ITypeCompletionContext completionContext, TypeSystemConfiguration configuration) { - if (definition is ObjectTypeConfiguration objectTypeDef) + if (configuration is ObjectTypeConfiguration objectTypeDef) { foreach (var fieldDef in objectTypeDef.Fields) { diff --git a/src/HotChocolate/Data/src/Data/Filters/Convention/FilterTypeInterceptor.cs b/src/HotChocolate/Data/src/Data/Filters/Convention/FilterTypeInterceptor.cs index c4cb817c4a9..c19a695c7e5 100644 --- a/src/HotChocolate/Data/src/Data/Filters/Convention/FilterTypeInterceptor.cs +++ b/src/HotChocolate/Data/src/Data/Filters/Convention/FilterTypeInterceptor.cs @@ -15,9 +15,9 @@ public sealed class FilterTypeInterceptor : TypeInterceptor public override void OnBeforeRegisterDependencies( ITypeDiscoveryContext discoveryContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { - if (definition is not FilterInputTypeDefinition { EntityType: { }, } def) + if (configuration is not FilterInputTypeDefinition { EntityType: { }, } def) { return; } @@ -41,9 +41,9 @@ public override void OnBeforeRegisterDependencies( public override void OnBeforeCompleteName( ITypeCompletionContext completionContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { - if (definition is not FilterInputTypeDefinition def) + if (configuration is not FilterInputTypeDefinition def) { return; } @@ -63,15 +63,15 @@ public override void OnBeforeCompleteName( if (def.Scope is not null) { - definition.Name = $"{completionContext.Scope}_{definition.Name}"; + configuration.Name = $"{completionContext.Scope}_{configuration.Name}"; } } public override void OnAfterCompleteName( ITypeCompletionContext completionContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { - if (definition is not FilterInputTypeDefinition { EntityType: { }, } def) + if (configuration is not FilterInputTypeDefinition { EntityType: { }, } def) { return; } diff --git a/src/HotChocolate/Data/src/Data/Projections/ProjectionTypeInterceptor.cs b/src/HotChocolate/Data/src/Data/Projections/ProjectionTypeInterceptor.cs index 01b43ed5559..08b0a2e5f73 100644 --- a/src/HotChocolate/Data/src/Data/Projections/ProjectionTypeInterceptor.cs +++ b/src/HotChocolate/Data/src/Data/Projections/ProjectionTypeInterceptor.cs @@ -13,7 +13,7 @@ internal sealed class ProjectionTypeInterceptor : TypeInterceptor public override void OnAfterResolveRootType( ITypeCompletionContext completionContext, - ObjectTypeConfiguration definition, + ObjectTypeConfiguration configuration, OperationType operationType) { if (operationType is OperationType.Query) @@ -24,7 +24,7 @@ public override void OnAfterResolveRootType( public override void OnAfterMakeExecutable( ITypeCompletionContext completionContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { if (ReferenceEquals(completionContext, _queryContext) && completionContext.Type is ObjectType { Fields: var fields, }) @@ -73,9 +73,9 @@ public override void OnAfterMakeExecutable( public override void OnAfterCompleteName( ITypeCompletionContext completionContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { - if (definition is ObjectTypeConfiguration objectTypeDefinition) + if (configuration is ObjectTypeConfiguration objectTypeDefinition) { List? alwaysProjected = null; foreach (var field in objectTypeDefinition.Fields) @@ -90,7 +90,7 @@ public override void OnAfterCompleteName( if (alwaysProjected?.Count > 0) { - definition.ContextData[AlwaysProjectedFieldsKey] = alwaysProjected.ToArray(); + configuration.ContextData[AlwaysProjectedFieldsKey] = alwaysProjected.ToArray(); } } } diff --git a/src/HotChocolate/Data/src/Data/Sorting/Convention/SortTypeInterceptor.cs b/src/HotChocolate/Data/src/Data/Sorting/Convention/SortTypeInterceptor.cs index 8bb1f767839..1ec7e28d5a0 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/Convention/SortTypeInterceptor.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/Convention/SortTypeInterceptor.cs @@ -14,9 +14,9 @@ public sealed class SortTypeInterceptor : TypeInterceptor public override void OnBeforeRegisterDependencies( ITypeDiscoveryContext discoveryContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { - switch (definition) + switch (configuration) { case SortInputTypeDefinition inputDefinition: OnBeforeRegisteringDependencies(discoveryContext, inputDefinition); @@ -29,9 +29,9 @@ public override void OnBeforeRegisterDependencies( public override void OnBeforeCompleteName( ITypeCompletionContext completionContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { - switch (definition) + switch (configuration) { case SortInputTypeDefinition inputDefinition: OnBeforeCompleteName(completionContext, inputDefinition); @@ -44,9 +44,9 @@ public override void OnBeforeCompleteName( public override void OnBeforeCompleteType( ITypeCompletionContext completionContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { - switch (definition) + switch (configuration) { case SortInputTypeDefinition inputDefinition: OnBeforeCompleteType(completionContext, inputDefinition); diff --git a/src/HotChocolate/Spatial/src/Types/Transformation/GeometryTransformerInterceptor.cs b/src/HotChocolate/Spatial/src/Types/Transformation/GeometryTransformerInterceptor.cs index 9a8b55e4ab2..2f7b15dcfbb 100644 --- a/src/HotChocolate/Spatial/src/Types/Transformation/GeometryTransformerInterceptor.cs +++ b/src/HotChocolate/Spatial/src/Types/Transformation/GeometryTransformerInterceptor.cs @@ -18,7 +18,7 @@ internal class GeometryTransformerInterceptor : TypeInterceptor /// public override void OnBeforeCompleteType( ITypeCompletionContext completionContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { var convention = completionContext.GetSpatialConvention(); if (convention.TransformerFactory.HasCoordinateSystems() && @@ -29,7 +29,7 @@ public override void OnBeforeCompleteType( throw ThrowHelper.Transformation_DefaultCRSNotFound(convention.DefaultSrid); } - switch (definition) + switch (configuration) { case ObjectTypeConfiguration def: HandleObjectType(completionContext, def, convention); diff --git a/src/HotChocolate/Spatial/test/Types.Tests/TransformationIntegrationTests.cs b/src/HotChocolate/Spatial/test/Types.Tests/TransformationIntegrationTests.cs index 6d2e77e32af..905355ddcdf 100644 --- a/src/HotChocolate/Spatial/test/Types.Tests/TransformationIntegrationTests.cs +++ b/src/HotChocolate/Spatial/test/Types.Tests/TransformationIntegrationTests.cs @@ -646,9 +646,9 @@ public class RoundTypeIntercetor : TypeInterceptor { public override void OnBeforeCompleteType( ITypeCompletionContext completionContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { - if (definition is ObjectTypeConfiguration o) + if (configuration is ObjectTypeConfiguration o) { foreach (var field in o.Fields) { diff --git a/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Utilities/EntityTypeInterceptor.cs b/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Utilities/EntityTypeInterceptor.cs index aefc0314506..f8a9bc6384b 100644 --- a/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Utilities/EntityTypeInterceptor.cs +++ b/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Utilities/EntityTypeInterceptor.cs @@ -22,18 +22,18 @@ public EntityTypeInterceptor( public override void OnBeforeCompleteType( ITypeCompletionContext completionContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { if (completionContext.Type is IComplexOutputType outputType && - definition is not null) + configuration is not null) { if (_typeEntityPatterns.TryGetValue(outputType.Name, out var pattern)) { - definition.ContextData[WellKnownContextData.Entity] = pattern; + configuration.ContextData[WellKnownContextData.Entity] = pattern; } else { - _outputTypes.Add(new TypeInfo(outputType, definition.ContextData)); + _outputTypes.Add(new TypeInfo(outputType, configuration.ContextData)); } } } diff --git a/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Utilities/LeafTypeInterceptor.cs b/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Utilities/LeafTypeInterceptor.cs index c399ecfba94..41cf3848521 100644 --- a/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Utilities/LeafTypeInterceptor.cs +++ b/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Utilities/LeafTypeInterceptor.cs @@ -18,11 +18,11 @@ public LeafTypeInterceptor(Dictionary scalarInfos) public override void OnBeforeCompleteName( ITypeCompletionContext completionContext, - TypeSystemConfiguration definition) + TypeSystemConfiguration configuration) { - if (completionContext.Type is ILeafType leafType && definition is not null) + if (completionContext.Type is ILeafType leafType && configuration is not null) { - _leafTypes.Add(new LeafType(leafType, definition.ContextData)); + _leafTypes.Add(new LeafType(leafType, configuration.ContextData)); } } From cb72c00fbb292765c1b58b79e7c357d3848f9781 Mon Sep 17 00:00:00 2001 From: Michael Staib Date: Tue, 15 Apr 2025 14:54:09 +0200 Subject: [PATCH 4/9] Renamed Configuration.Configurations to Configuration.Tasks --- .../Extensions/ObjectFieldDataLoaderExtensions.cs | 2 +- .../src/Types.CursorPagination/ConnectionType.cs | 8 ++++---- .../Core/src/Types.CursorPagination/EdgeType.cs | 6 +++--- .../Extensions/UseConnectionAttribute.cs | 4 ++-- .../Core/src/Types.Json/FromJsonSchemaDirective.cs | 2 +- .../Core/src/Types.Mutations/MutationDirective.cs | 2 +- .../CollectionSegmentType~1.cs | 4 ++-- .../IsSelectedParameterExpressionBuilder.cs | 2 +- .../Definitions/DirectiveTypeConfiguration.cs | 6 +++--- .../Definitions/EnumTypeConfiguration.cs | 10 +++++----- .../Definitions/ITypeSystemConfiguration.cs | 4 ++-- .../Definitions/InputObjectTypeConfiguration.cs | 10 +++++----- .../Definitions/InterfaceTypeConfiguration.cs | 14 +++++++------- .../Definitions/ObjectTypeConfiguration.cs | 14 +++++++------- .../Definitions/TypeSystemConfiguration.cs | 12 ++++++------ .../Types/Types/Descriptors/DescriptorBase~1.cs | 10 +++++----- .../Core/src/Types/Types/EnumTypeExtension.cs | 4 ++-- .../src/Types/Types/InputObjectTypeExtension.cs | 4 ++-- .../Core/src/Types/Types/InterfaceTypeExtension.cs | 4 ++-- .../src/Types/Types/Pagination/PagingHelper.cs | 2 +- .../Types/Relay/Descriptors/NodeDescriptor~1.cs | 2 +- .../Types/Relay/Extensions/RelayIdFieldHelpers.cs | 2 +- .../Core/src/Types/Types/TypeSystemObjectBase~1.cs | 4 ++-- .../Core/src/Types/Types/UnionTypeExtension.cs | 4 ++-- .../Configuration/TypeInitializationOrderTests.cs | 2 +- .../Filters/Convention/DataTypeExtensionHelper.cs | 12 ++++++------ .../FilterObjectFieldDescriptorExtensions.cs | 4 ++-- .../ProjectionObjectFieldDescriptorExtensions.cs | 2 +- ...ngleOrDefaultObjectFieldDescriptorExtensions.cs | 2 +- .../SortingObjectFieldDescriptorExtensions.cs | 6 +++--- 30 files changed, 82 insertions(+), 82 deletions(-) diff --git a/src/HotChocolate/Core/src/Fetching/Extensions/ObjectFieldDataLoaderExtensions.cs b/src/HotChocolate/Core/src/Fetching/Extensions/ObjectFieldDataLoaderExtensions.cs index a63dbb85126..273fa4f98ab 100644 --- a/src/HotChocolate/Core/src/Fetching/Extensions/ObjectFieldDataLoaderExtensions.cs +++ b/src/HotChocolate/Core/src/Fetching/Extensions/ObjectFieldDataLoaderExtensions.cs @@ -52,7 +52,7 @@ public static IObjectFieldDescriptor UseDataLoader( } definition.Type = TypeReference.Create(schemaType, TypeContext.Output); - definition.Configurations.Add( + definition.Tasks.Add( new OnCompleteTypeSystemConfigurationTask( (_, def) => { diff --git a/src/HotChocolate/Core/src/Types.CursorPagination/ConnectionType.cs b/src/HotChocolate/Core/src/Types.CursorPagination/ConnectionType.cs index 13d28b0ee85..7cfe39a89f4 100644 --- a/src/HotChocolate/Core/src/Types.CursorPagination/ConnectionType.cs +++ b/src/HotChocolate/Core/src/Types.CursorPagination/ConnectionType.cs @@ -42,7 +42,7 @@ internal ConnectionType( Definition = CreateTypeDefinition(includeTotalCount, includeNodesField, edgesType); Definition.Name = NameHelper.CreateConnectionName(connectionName); Definition.Dependencies.Add(new(nodeType)); - Definition.Configurations.Add( + Definition.Tasks.Add( new OnCompleteTypeSystemConfigurationTask( (c, _) => EdgeType = c.GetType(TypeReference.Create(edgeTypeName)), Definition, @@ -50,7 +50,7 @@ internal ConnectionType( if (includeNodesField) { - Definition.Configurations.Add( + Definition.Tasks.Add( new OnCompleteTypeSystemConfigurationTask( (c, d) => { @@ -88,7 +88,7 @@ internal ConnectionType(TypeReference nodeType, bool includeTotalCount, bool inc Definition.Dependencies.Add(new(edgeType)); Definition.NeedsNameCompletion = true; - Definition.Configurations.Add( + Definition.Tasks.Add( new OnCompleteTypeSystemConfigurationTask( (c, d) => { @@ -115,7 +115,7 @@ internal ConnectionType(TypeReference nodeType, bool includeTotalCount, bool inc ApplyConfigurationOn.BeforeNaming, nodeType, TypeDependencyFulfilled.Named)); - Definition.Configurations.Add( + Definition.Tasks.Add( new OnCompleteTypeSystemConfigurationTask( (c, _) => { diff --git a/src/HotChocolate/Core/src/Types.CursorPagination/EdgeType.cs b/src/HotChocolate/Core/src/Types.CursorPagination/EdgeType.cs index 39d2ec69676..5ecc5bc8479 100644 --- a/src/HotChocolate/Core/src/Types.CursorPagination/EdgeType.cs +++ b/src/HotChocolate/Core/src/Types.CursorPagination/EdgeType.cs @@ -27,7 +27,7 @@ internal EdgeType( ConnectionName = connectionName; Definition = CreateTypeDefinition(nodeType); Definition.Name = NameHelper.CreateEdgeName(connectionName); - Definition.Configurations.Add( + Definition.Tasks.Add( new OnCompleteTypeSystemConfigurationTask( (c, _) => NodeType = c.GetType(nodeType), Definition, @@ -44,7 +44,7 @@ internal EdgeType(TypeReference nodeType) // the property is set later in the configuration. ConnectionName = default!; Definition = CreateTypeDefinition(nodeType); - Definition.Configurations.Add( + Definition.Tasks.Add( new OnCompleteTypeSystemConfigurationTask( (c, d) => { @@ -56,7 +56,7 @@ internal EdgeType(TypeReference nodeType) ApplyConfigurationOn.BeforeNaming, nodeType, TypeDependencyFulfilled.Named)); - Definition.Configurations.Add( + Definition.Tasks.Add( new OnCompleteTypeSystemConfigurationTask( (c, _) => NodeType = c.GetType(nodeType), Definition, diff --git a/src/HotChocolate/Core/src/Types.CursorPagination/Extensions/UseConnectionAttribute.cs b/src/HotChocolate/Core/src/Types.CursorPagination/Extensions/UseConnectionAttribute.cs index 6b24d2f7219..452def5412d 100644 --- a/src/HotChocolate/Core/src/Types.CursorPagination/Extensions/UseConnectionAttribute.cs +++ b/src/HotChocolate/Core/src/Types.CursorPagination/Extensions/UseConnectionAttribute.cs @@ -125,7 +125,7 @@ protected internal override void TryConfigure( if (descriptor is IObjectFieldDescriptor fieldDesc) { var definition = fieldDesc.Extend().Configuration; - definition.Configurations.Add( + definition.Tasks.Add( new OnCreateTypeSystemConfigurationTask( (_, d) => { @@ -135,7 +135,7 @@ protected internal override void TryConfigure( options); }, definition)); - definition.Configurations.Add( + definition.Tasks.Add( new OnCompleteTypeSystemConfigurationTask( (c, d) => ApplyPagingOptions(c.DescriptorContext, d, options), definition, diff --git a/src/HotChocolate/Core/src/Types.Json/FromJsonSchemaDirective.cs b/src/HotChocolate/Core/src/Types.Json/FromJsonSchemaDirective.cs index ac8d0f56b20..501c75dd3ec 100644 --- a/src/HotChocolate/Core/src/Types.Json/FromJsonSchemaDirective.cs +++ b/src/HotChocolate/Core/src/Types.Json/FromJsonSchemaDirective.cs @@ -17,7 +17,7 @@ public void ApplyConfiguration( { if (definition is ObjectFieldConfiguration fieldDef) { - fieldDef.Configurations.Add( + fieldDef.Tasks.Add( new OnCompleteTypeSystemConfigurationTask( (ctx, def) => { diff --git a/src/HotChocolate/Core/src/Types.Mutations/MutationDirective.cs b/src/HotChocolate/Core/src/Types.Mutations/MutationDirective.cs index 8e6f1a411c6..fe9b7e1b740 100644 --- a/src/HotChocolate/Core/src/Types.Mutations/MutationDirective.cs +++ b/src/HotChocolate/Core/src/Types.Mutations/MutationDirective.cs @@ -18,7 +18,7 @@ public void ApplyConfiguration( throw ThrowHelper.MutationConventionDirective_In_Wrong_Location(directiveNode); } - fieldDef.Configurations.Add( + fieldDef.Tasks.Add( new OnCompleteTypeSystemConfigurationTask( (c, d) => { diff --git a/src/HotChocolate/Core/src/Types.OffsetPagination/CollectionSegmentType~1.cs b/src/HotChocolate/Core/src/Types.OffsetPagination/CollectionSegmentType~1.cs index 2c4212b38e1..04cbdff133c 100644 --- a/src/HotChocolate/Core/src/Types.OffsetPagination/CollectionSegmentType~1.cs +++ b/src/HotChocolate/Core/src/Types.OffsetPagination/CollectionSegmentType~1.cs @@ -26,7 +26,7 @@ internal CollectionSegmentType( } else { - Definition.Configurations.Add( + Definition.Tasks.Add( new OnCompleteTypeSystemConfigurationTask( (c, d) => { @@ -40,7 +40,7 @@ internal CollectionSegmentType( TypeDependencyFulfilled.Named)); } - Definition.Configurations.Add( + Definition.Tasks.Add( new OnCompleteTypeSystemConfigurationTask( (c, d) => { diff --git a/src/HotChocolate/Core/src/Types/Resolvers/Expressions/Parameters/IsSelectedParameterExpressionBuilder.cs b/src/HotChocolate/Core/src/Types/Resolvers/Expressions/Parameters/IsSelectedParameterExpressionBuilder.cs index de5e93797da..94dc0085c3a 100644 --- a/src/HotChocolate/Core/src/Types/Resolvers/Expressions/Parameters/IsSelectedParameterExpressionBuilder.cs +++ b/src/HotChocolate/Core/src/Types/Resolvers/Expressions/Parameters/IsSelectedParameterExpressionBuilder.cs @@ -42,7 +42,7 @@ public void ApplyConfiguration(ParameterInfo parameter, ObjectFieldDescriptor de if (attribute.Fields is not null) { var definition = descriptor.Extend().Configuration; - definition.Configurations.Add( + definition.Tasks.Add( new OnCompleteTypeSystemConfigurationTask((ctx, def) => { if (!ctx.DescriptorContext.ContextData.TryGetValue(WellKnownContextData.PatternValidationTasks, diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/DirectiveTypeConfiguration.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/DirectiveTypeConfiguration.cs index 4fcfdf772eb..a8f059929cd 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/DirectiveTypeConfiguration.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/DirectiveTypeConfiguration.cs @@ -100,15 +100,15 @@ public IBindableList Arguments /// public Func? Format { get; set; } - public override IEnumerable GetConfigurations() + public override IEnumerable GetTasks() { var configs = new List(); - configs.AddRange(Configurations); + configs.AddRange(Tasks); foreach (var field in GetArguments()) { - configs.AddRange(field.Configurations); + configs.AddRange(field.Tasks); } return configs; diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/EnumTypeConfiguration.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/EnumTypeConfiguration.cs index 5fc7ccc93bd..0b269b47f54 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/EnumTypeConfiguration.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/EnumTypeConfiguration.cs @@ -45,22 +45,22 @@ public EnumTypeConfiguration( public IBindableList Values { get; } = new BindableList(); - public override IEnumerable GetConfigurations() + public override IEnumerable GetTasks() { List? configs = null; - if (HasConfigurations) + if (HasTasks) { configs ??= []; - configs.AddRange(Configurations); + configs.AddRange(Tasks); } foreach (var value in Values) { - if (value.HasConfigurations) + if (value.HasTasks) { configs ??= []; - configs.AddRange(value.Configurations); + configs.AddRange(value.Tasks); } } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ITypeSystemConfiguration.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ITypeSystemConfiguration.cs index 3459cf5ea63..94616ab7764 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ITypeSystemConfiguration.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ITypeSystemConfiguration.cs @@ -47,10 +47,10 @@ public interface ITypeSystemConfiguration /// /// Gets configurations that shall be applied at a later point. /// - IList Configurations { get; } + IList Tasks { get; } /// /// Defines if this type has configurations. /// - bool HasConfigurations { get; } + bool HasTasks { get; } } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InputObjectTypeConfiguration.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InputObjectTypeConfiguration.cs index 824cef6d3cd..afc6a6226b1 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InputObjectTypeConfiguration.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InputObjectTypeConfiguration.cs @@ -43,22 +43,22 @@ public InputObjectTypeConfiguration( /// public Action? GetFieldData { get; set; } - public override IEnumerable GetConfigurations() + public override IEnumerable GetTasks() { List? configs = null; - if (HasConfigurations) + if (HasTasks) { configs ??= []; - configs.AddRange(Configurations); + configs.AddRange(Tasks); } foreach (var field in Fields) { - if (field.HasConfigurations) + if (field.HasTasks) { configs ??= []; - configs.AddRange(field.Configurations); + configs.AddRange(field.Tasks); } } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InterfaceTypeConfiguration.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InterfaceTypeConfiguration.cs index 4b5d2640ef9..9d517aecbfa 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InterfaceTypeConfiguration.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InterfaceTypeConfiguration.cs @@ -41,32 +41,32 @@ public InterfaceTypeConfiguration( public IBindableList Fields { get; } = new BindableList(); - public override IEnumerable GetConfigurations() + public override IEnumerable GetTasks() { List? configs = null; - if (HasConfigurations) + if (HasTasks) { configs ??= []; - configs.AddRange(Configurations); + configs.AddRange(Tasks); } foreach (var field in Fields) { - if (field.HasConfigurations) + if (field.HasTasks) { configs ??= []; - configs.AddRange(field.Configurations); + configs.AddRange(field.Tasks); } if (field.HasArguments) { foreach (var argument in field.Arguments) { - if (argument.HasConfigurations) + if (argument.HasTasks) { configs ??= []; - configs.AddRange(argument.Configurations); + configs.AddRange(argument.Tasks); } } } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ObjectTypeConfiguration.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ObjectTypeConfiguration.cs index 830bdf8bf02..bc52279f5a3 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ObjectTypeConfiguration.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ObjectTypeConfiguration.cs @@ -118,30 +118,30 @@ public FieldBindingFlags FieldBindingFlags } } - public override IEnumerable GetConfigurations() + public override IEnumerable GetTasks() { List? configs = null; - if (HasConfigurations) + if (HasTasks) { configs ??= []; - configs.AddRange(Configurations); + configs.AddRange(Tasks); } foreach (var field in Fields) { - if (field.HasConfigurations) + if (field.HasTasks) { configs ??= []; - configs.AddRange(field.Configurations); + configs.AddRange(field.Tasks); } foreach (var argument in field.GetArguments()) { - if (argument.HasConfigurations) + if (argument.HasTasks) { configs ??= []; - configs.AddRange(argument.Configurations); + configs.AddRange(argument.Tasks); } } } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/TypeSystemConfiguration.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/TypeSystemConfiguration.cs index d64fe510707..48e609d5b85 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/TypeSystemConfiguration.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/TypeSystemConfiguration.cs @@ -57,13 +57,13 @@ public bool HasDependencies /// /// Gets configurations that shall be applied at a later point. /// - public IList Configurations + public IList Tasks => _configurations ??= []; /// /// Defines if this type has configurations. /// - public bool HasConfigurations + public bool HasTasks => _configurations is { Count: > 0, }; /// @@ -80,11 +80,11 @@ public bool HasConfigurations /// /// Gets lazy configuration of this definition and all dependent definitions. /// - public virtual IEnumerable GetConfigurations() + public virtual IEnumerable GetTasks() { if (_configurations is null) { - return Array.Empty(); + return []; } return _configurations; @@ -97,7 +97,7 @@ public IReadOnlyList GetDependencies() { if (_dependencies is null) { - return Array.Empty(); + return []; } return _dependencies; @@ -173,7 +173,7 @@ protected void MergeInto(TypeSystemConfiguration target) if (_contextData?.Count > 0) { - target._contextData ??= new ExtensionData(); + target._contextData ??= []; foreach (var item in _contextData) { target._contextData[item.Key] = item.Value; diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/DescriptorBase~1.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/DescriptorBase~1.cs index 4e7c5108e7e..990a108678a 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/DescriptorBase~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/DescriptorBase~1.cs @@ -53,10 +53,10 @@ public T CreateConfiguration() { OnCreateDefinition(Definition); - if (Definition.HasConfigurations) + if (Definition.HasTasks) { var i = 0; - var configurations = Definition.Configurations; + var configurations = Definition.Tasks; do { @@ -105,7 +105,7 @@ private void OnBeforeCreate(Action configure) throw new ArgumentNullException(nameof(configure)); } - Definition.Configurations.Add(new OnCreateTypeSystemConfigurationTask( + Definition.Tasks.Add(new OnCreateTypeSystemConfigurationTask( (c, d) => configure(c, (T)d), Definition)); } @@ -131,7 +131,7 @@ private INamedDependencyDescriptor OnBeforeNaming( Definition, ApplyConfigurationOn.BeforeNaming); - Definition.Configurations.Add(configuration); + Definition.Tasks.Add(configuration); return new NamedDependencyDescriptor(Context.TypeInspector, configuration); } @@ -152,7 +152,7 @@ private ICompletedDependencyDescriptor OnBeforeCompletion( Definition, ApplyConfigurationOn.BeforeCompletion); - Definition.Configurations.Add(configuration); + Definition.Tasks.Add(configuration); return new CompletedDependencyDescriptor(Context.TypeInspector, configuration); } diff --git a/src/HotChocolate/Core/src/Types/Types/EnumTypeExtension.cs b/src/HotChocolate/Core/src/Types/Types/EnumTypeExtension.cs index 69fe987fdd2..e9ef71c95d9 100644 --- a/src/HotChocolate/Core/src/Types/Types/EnumTypeExtension.cs +++ b/src/HotChocolate/Core/src/Types/Types/EnumTypeExtension.cs @@ -109,8 +109,8 @@ protected override void Merge( enumType.Definition!.Directives); TypeExtensionHelper.MergeConfigurations( - Definition!.Configurations, - enumType.Definition!.Configurations); + Definition!.Tasks, + enumType.Definition!.Tasks); MergeValues(context, Definition!, enumType.Definition!); } diff --git a/src/HotChocolate/Core/src/Types/Types/InputObjectTypeExtension.cs b/src/HotChocolate/Core/src/Types/Types/InputObjectTypeExtension.cs index 6b9d7832d39..f7dd6182377 100644 --- a/src/HotChocolate/Core/src/Types/Types/InputObjectTypeExtension.cs +++ b/src/HotChocolate/Core/src/Types/Types/InputObjectTypeExtension.cs @@ -112,8 +112,8 @@ protected override void Merge( inputObjectType.Definition!.Fields); TypeExtensionHelper.MergeConfigurations( - Definition!.Configurations, - inputObjectType.Definition!.Configurations); + Definition!.Tasks, + inputObjectType.Definition!.Tasks); } else { diff --git a/src/HotChocolate/Core/src/Types/Types/InterfaceTypeExtension.cs b/src/HotChocolate/Core/src/Types/Types/InterfaceTypeExtension.cs index c79013021eb..30558756b74 100644 --- a/src/HotChocolate/Core/src/Types/Types/InterfaceTypeExtension.cs +++ b/src/HotChocolate/Core/src/Types/Types/InterfaceTypeExtension.cs @@ -112,8 +112,8 @@ protected override void Merge( interfaceType.Definition!.Fields); TypeExtensionHelper.MergeConfigurations( - Definition!.Configurations, - interfaceType.Definition!.Configurations); + Definition!.Tasks, + interfaceType.Definition!.Tasks); } else { diff --git a/src/HotChocolate/Core/src/Types/Types/Pagination/PagingHelper.cs b/src/HotChocolate/Core/src/Types/Types/Pagination/PagingHelper.cs index fc65ef6517a..7cae59a5d9d 100644 --- a/src/HotChocolate/Core/src/Types/Types/Pagination/PagingHelper.cs +++ b/src/HotChocolate/Core/src/Types/Types/Pagination/PagingHelper.cs @@ -34,7 +34,7 @@ internal static IObjectFieldDescriptor UsePaging( var definition = descriptor.Extend().Configuration; definition.MiddlewareDefinitions.Add(placeholder); - definition.Configurations.Add( + definition.Tasks.Add( new OnCompleteTypeSystemConfigurationTask( (c, d) => ApplyConfiguration( c, diff --git a/src/HotChocolate/Core/src/Types/Types/Relay/Descriptors/NodeDescriptor~1.cs b/src/HotChocolate/Core/src/Types/Types/Relay/Descriptors/NodeDescriptor~1.cs index acaee8a7c15..39001036445 100644 --- a/src/HotChocolate/Core/src/Types/Types/Relay/Descriptors/NodeDescriptor~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/Relay/Descriptors/NodeDescriptor~1.cs @@ -41,7 +41,7 @@ public NodeDescriptor(IObjectTypeDescriptor descriptor) ownerDef, ApplyConfigurationOn.AfterNaming); - ownerDef.Configurations.Add(configuration); + ownerDef.Tasks.Add(configuration); } private void OnCompleteDefinition( diff --git a/src/HotChocolate/Core/src/Types/Types/Relay/Extensions/RelayIdFieldHelpers.cs b/src/HotChocolate/Core/src/Types/Types/Relay/Extensions/RelayIdFieldHelpers.cs index 0b7035ffd5a..f544c552982 100644 --- a/src/HotChocolate/Core/src/Types/Types/Relay/Extensions/RelayIdFieldHelpers.cs +++ b/src/HotChocolate/Core/src/Types/Types/Relay/Extensions/RelayIdFieldHelpers.cs @@ -101,7 +101,7 @@ internal static void ApplyIdToField( definition, ApplyConfigurationOn.BeforeCompletion); - definition.Configurations.Add(configuration); + definition.Tasks.Add(configuration); } private static void RewriteDefinition( diff --git a/src/HotChocolate/Core/src/Types/Types/TypeSystemObjectBase~1.cs b/src/HotChocolate/Core/src/Types/Types/TypeSystemObjectBase~1.cs index 6c5982ca458..de0d978e499 100644 --- a/src/HotChocolate/Core/src/Types/Types/TypeSystemObjectBase~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/TypeSystemObjectBase~1.cs @@ -198,7 +198,7 @@ private void RegisterConfigurationDependencies( { OnBeforeRegisterDependencies(context, definition); - foreach (var configuration in definition.GetConfigurations()) + foreach (var configuration in definition.GetTasks()) { foreach (var dependency in configuration.Dependencies) { @@ -215,7 +215,7 @@ private static void ExecuteConfigurations( TDefinition definition, ApplyConfigurationOn on) { - foreach (var config in definition.GetConfigurations()) + foreach (var config in definition.GetTasks()) { if (config.On == on) { diff --git a/src/HotChocolate/Core/src/Types/Types/UnionTypeExtension.cs b/src/HotChocolate/Core/src/Types/Types/UnionTypeExtension.cs index f908b6dd966..56969802ce8 100644 --- a/src/HotChocolate/Core/src/Types/Types/UnionTypeExtension.cs +++ b/src/HotChocolate/Core/src/Types/Types/UnionTypeExtension.cs @@ -117,8 +117,8 @@ protected override void Merge( unionType.Definition!.Types); TypeExtensionHelper.MergeConfigurations( - Definition!.Configurations, - unionType.Definition!.Configurations); + Definition!.Tasks, + unionType.Definition!.Tasks); } else { diff --git a/src/HotChocolate/Core/test/Types.Tests/Configuration/TypeInitializationOrderTests.cs b/src/HotChocolate/Core/test/Types.Tests/Configuration/TypeInitializationOrderTests.cs index f38748f624a..ca51ea7ad25 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Configuration/TypeInitializationOrderTests.cs +++ b/src/HotChocolate/Core/test/Types.Tests/Configuration/TypeInitializationOrderTests.cs @@ -45,7 +45,7 @@ protected override void Configure(IObjectTypeDescriptor descriptor) var reference = c.TypeInspector.GetTypeRef(typeof(Word), TypeContext.Output); - d.Configurations.Add( + d.Tasks.Add( new OnCompleteTypeSystemConfigurationTask( (context, _) => { diff --git a/src/HotChocolate/Data/src/Data/Filters/Convention/DataTypeExtensionHelper.cs b/src/HotChocolate/Data/src/Data/Filters/Convention/DataTypeExtensionHelper.cs index 1150743400e..3b5cf81e4ea 100644 --- a/src/HotChocolate/Data/src/Data/Filters/Convention/DataTypeExtensionHelper.cs +++ b/src/HotChocolate/Data/src/Data/Filters/Convention/DataTypeExtensionHelper.cs @@ -28,8 +28,8 @@ public static void MergeFilterInputTypeDefinitions( typeDefinition.Fields); TypeExtensionHelper.MergeConfigurations( - extensionDefinition.Configurations, - typeDefinition.Configurations); + extensionDefinition.Tasks, + typeDefinition.Tasks); } public static void MergeSortEnumTypeDefinitions( @@ -52,8 +52,8 @@ public static void MergeSortEnumTypeDefinitions( typeDefinition.Values); TypeExtensionHelper.MergeConfigurations( - extensionDefinition.Configurations, - typeDefinition.Configurations); + extensionDefinition.Tasks, + typeDefinition.Tasks); } public static void MergeSortInputTypeDefinitions( @@ -76,8 +76,8 @@ public static void MergeSortInputTypeDefinitions( typeDefinition.Fields); TypeExtensionHelper.MergeConfigurations( - extensionDefinition.Configurations, - typeDefinition.Configurations); + extensionDefinition.Tasks, + typeDefinition.Tasks); } private static void MergeFilterFieldDefinitions( diff --git a/src/HotChocolate/Data/src/Data/Filters/Extensions/FilterObjectFieldDescriptorExtensions.cs b/src/HotChocolate/Data/src/Data/Filters/Extensions/FilterObjectFieldDescriptorExtensions.cs index fa6773de057..36729902bac 100644 --- a/src/HotChocolate/Data/src/Data/Filters/Extensions/FilterObjectFieldDescriptorExtensions.cs +++ b/src/HotChocolate/Data/src/Data/Filters/Extensions/FilterObjectFieldDescriptorExtensions.cs @@ -175,7 +175,7 @@ private static IObjectFieldDescriptor UseFiltering( definition.Arguments.Add(argumentDefinition); - definition.Configurations.Add( + definition.Tasks.Add( new OnCompleteTypeSystemConfigurationTask( (ctx, d) => CompileMiddleware( @@ -189,7 +189,7 @@ private static IObjectFieldDescriptor UseFiltering( argumentTypeReference, TypeDependencyFulfilled.Completed)); - argumentDefinition.Configurations.Add( + argumentDefinition.Tasks.Add( new OnCompleteTypeSystemConfigurationTask( (context, argDef) => argDef.Name = diff --git a/src/HotChocolate/Data/src/Data/Projections/Extensions/ProjectionObjectFieldDescriptorExtensions.cs b/src/HotChocolate/Data/src/Data/Projections/Extensions/ProjectionObjectFieldDescriptorExtensions.cs index 72a3697f868..0ce52bb78f3 100644 --- a/src/HotChocolate/Data/src/Data/Projections/Extensions/ProjectionObjectFieldDescriptorExtensions.cs +++ b/src/HotChocolate/Data/src/Data/Projections/Extensions/ProjectionObjectFieldDescriptorExtensions.cs @@ -157,7 +157,7 @@ public static IObjectFieldDescriptor UseProjection( selectionType = typeInfo.NamedType; } - definition.Configurations.Add( + definition.Tasks.Add( new OnCompleteTypeSystemConfigurationTask( (c, d) => CompileMiddleware(selectionType, d, placeholder, c, scope), definition, diff --git a/src/HotChocolate/Data/src/Data/Projections/Extensions/SingleOrDefaultObjectFieldDescriptorExtensions.cs b/src/HotChocolate/Data/src/Data/Projections/Extensions/SingleOrDefaultObjectFieldDescriptorExtensions.cs index 8e17622d445..f7148b1e271 100644 --- a/src/HotChocolate/Data/src/Data/Projections/Extensions/SingleOrDefaultObjectFieldDescriptorExtensions.cs +++ b/src/HotChocolate/Data/src/Data/Projections/Extensions/SingleOrDefaultObjectFieldDescriptorExtensions.cs @@ -56,7 +56,7 @@ private static IObjectFieldDescriptor ApplyMiddleware( definition.Type = context.TypeInspector.GetTypeRef(selectionType, TypeContext.Output); - definition.Configurations.Add( + definition.Tasks.Add( new OnCompleteTypeSystemConfigurationTask( (_, d) => { diff --git a/src/HotChocolate/Data/src/Data/Sorting/Extensions/SortingObjectFieldDescriptorExtensions.cs b/src/HotChocolate/Data/src/Data/Sorting/Extensions/SortingObjectFieldDescriptorExtensions.cs index cd8e0b61243..d5b4a7bb826 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/Extensions/SortingObjectFieldDescriptorExtensions.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/Extensions/SortingObjectFieldDescriptorExtensions.cs @@ -178,7 +178,7 @@ private static IObjectFieldDescriptor UseSortingInternal( Flags = FieldFlags.SortArgument }; - argumentDefinition.Configurations.Add( + argumentDefinition.Tasks.Add( new OnCompleteTypeSystemConfigurationTask((context, def) => { var namedType = context.GetType(argumentTypeReference); @@ -191,7 +191,7 @@ private static IObjectFieldDescriptor UseSortingInternal( definition.Arguments.Add(argumentDefinition); - definition.Configurations.Add( + definition.Tasks.Add( new OnCompleteTypeSystemConfigurationTask( (context, def) => CompileMiddleware( @@ -205,7 +205,7 @@ private static IObjectFieldDescriptor UseSortingInternal( argumentTypeReference, TypeDependencyFulfilled.Completed)); - argumentDefinition.Configurations.Add( + argumentDefinition.Tasks.Add( new OnCompleteTypeSystemConfigurationTask( (context, argDef) => argDef.Name = context.GetSortConvention(scope).GetArgumentName(), argumentDefinition, From 5358e31463d47c1c8c8dcbc8d6d48c331ca2af20 Mon Sep 17 00:00:00 2001 From: Michael Staib Date: Tue, 15 Apr 2025 15:17:13 +0200 Subject: [PATCH 5/9] Fixed compile errors --- .../FederationTypesTestBase.cs | 2 +- .../Processing/MiddlewareContext.Pure.cs | 2 +- .../Processing/ValueCompletion.Leaf.cs | 2 +- .../MutationConventionTypeInterceptor.cs | 4 ++-- .../Core/src/Types/HotChocolate.Types.csproj | 1 + .../Core/src/Types/SchemaPrinter.cs | 2 +- .../Types/SemanticNonNullTypeInterceptor.cs | 4 ++-- .../src/Types/Types/Contracts/INamedType.cs | 1 + .../Types/Types/Extensions/TypeExtensions.cs | 21 ++++++++++--------- .../Core/src/Types/Types/FluentWrapperType.cs | 2 -- .../Core/src/Types/Types/InputFormatter.cs | 8 +++---- .../src/Types/Types/Introspection/__Type.cs | 2 +- .../Core/src/Types/Types/NativeType.cs | 10 +++++---- .../Core/src/Types/Types/TypeNamePrinter.cs | 2 +- .../Core/src/Types/Types/UnionType.cs | 2 +- .../Core/src/Types/Utilities/ThrowHelper.cs | 7 +++++-- .../src/Types/Utilities/TypeFactoryHelper.cs | 2 +- .../Core/src/Validation/Rules/ValueVisitor.cs | 2 +- .../Execution.Tests/MiddlewareContextTests.cs | 2 +- .../src/Primitives/Types/IWrapperType.cs | 2 +- 20 files changed, 43 insertions(+), 37 deletions(-) diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/FederationTypesTestBase.cs b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/FederationTypesTestBase.cs index 2ecbaf289cf..6791fbad63e 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/FederationTypesTestBase.cs +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/FederationTypesTestBase.cs @@ -29,7 +29,7 @@ protected void AssertDirectiveHasFieldsArgument(IEnumerable d t => { Assert.Equal("fields", t.Name); - Assert.IsType(Assert.IsType(t.Type).Type); + Assert.IsType(Assert.IsType(t.Type).NullableType); } ); } diff --git a/src/HotChocolate/Core/src/Execution/Processing/MiddlewareContext.Pure.cs b/src/HotChocolate/Core/src/Execution/Processing/MiddlewareContext.Pure.cs index 39c15e20d08..4f6595986dd 100644 --- a/src/HotChocolate/Core/src/Execution/Processing/MiddlewareContext.Pure.cs +++ b/src/HotChocolate/Core/src/Execution/Processing/MiddlewareContext.Pure.cs @@ -263,7 +263,7 @@ private T CoerceArgumentValue(ArgumentValue argument) if (typeof(T).IsInterface) { - var o = dictToObjConverter.Convert(value, argument.Type.RuntimeType); + var o = dictToObjConverter.Convert(value, argument.Type.ToRuntimeType()); if (o is T c) { return c; diff --git a/src/HotChocolate/Core/src/Execution/Processing/ValueCompletion.Leaf.cs b/src/HotChocolate/Core/src/Execution/Processing/ValueCompletion.Leaf.cs index 3658c37085f..0393ffceed4 100644 --- a/src/HotChocolate/Core/src/Execution/Processing/ValueCompletion.Leaf.cs +++ b/src/HotChocolate/Core/src/Execution/Processing/ValueCompletion.Leaf.cs @@ -21,7 +21,7 @@ internal static partial class ValueCompletion try { var leafType = (ILeafType)type; - var runtimeType = leafType.RuntimeType; + var runtimeType = leafType.ToRuntimeType(); if (!runtimeType.IsInstanceOfType(result) && operationContext.Converter.TryConvert(runtimeType, result, out var c)) diff --git a/src/HotChocolate/Core/src/Types.Mutations/MutationConventionTypeInterceptor.cs b/src/HotChocolate/Core/src/Types.Mutations/MutationConventionTypeInterceptor.cs index 42923138038..54698f9f053 100644 --- a/src/HotChocolate/Core/src/Types.Mutations/MutationConventionTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types.Mutations/MutationConventionTypeInterceptor.cs @@ -683,7 +683,7 @@ private TypeReference EnsureNullable(TypeReference typeRef) return typeRef; } - return Create(CreateTypeNode(nt.Type)); + return Create(CreateTypeNode(nt.NullableType)); } private TypeReference EnsureNonNull(TypeReference typeRef) @@ -701,7 +701,7 @@ private TypeReference EnsureNonNull(TypeReference typeRef) private static ITypeNode CreateTypeNode(IType type) => type switch { - NonNullType nnt => new NonNullTypeNode((INullableTypeNode) CreateTypeNode(nnt.Type)), + NonNullType nnt => new NonNullTypeNode((INullableTypeNode) CreateTypeNode(nnt.NullableType)), ListType lt => new ListTypeNode(CreateTypeNode(lt.ElementType)), INamedType nt => new NamedTypeNode(nt.Name), _ => throw new NotSupportedException("Type is not supported."), diff --git a/src/HotChocolate/Core/src/Types/HotChocolate.Types.csproj b/src/HotChocolate/Core/src/Types/HotChocolate.Types.csproj index de66f75c321..14cb4d64f72 100644 --- a/src/HotChocolate/Core/src/Types/HotChocolate.Types.csproj +++ b/src/HotChocolate/Core/src/Types/HotChocolate.Types.csproj @@ -62,6 +62,7 @@ + diff --git a/src/HotChocolate/Core/src/Types/SchemaPrinter.cs b/src/HotChocolate/Core/src/Types/SchemaPrinter.cs index 5090ad9dae0..b7f8bc8fbca 100644 --- a/src/HotChocolate/Core/src/Types/SchemaPrinter.cs +++ b/src/HotChocolate/Core/src/Types/SchemaPrinter.cs @@ -503,7 +503,7 @@ private static ITypeNode PrintType(IType type) { if (type is NonNullType nt) { - return new NonNullTypeNode(null, (INullableTypeNode)PrintType(nt.Type)); + return new NonNullTypeNode(null, (INullableTypeNode)PrintType(nt.NullableType)); } if (type is ListType lt) diff --git a/src/HotChocolate/Core/src/Types/SemanticNonNullTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/SemanticNonNullTypeInterceptor.cs index 74b51a2d65f..90632c8143e 100644 --- a/src/HotChocolate/Core/src/Types/SemanticNonNullTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/SemanticNonNullTypeInterceptor.cs @@ -202,7 +202,7 @@ private static HashSet GetSemanticNonNullLevelsFromReference(SchemaTypeRefe else if (currentType is NonNullType nonNullType) { levels.Add(index); - currentType = nonNullType.Type; + currentType = nonNullType.NullableType; } else { @@ -275,7 +275,7 @@ private static IType BuildNullableTypeStructure(ITypeSystemMember typeSystemMemb if (typeSystemMember is NonNullType nonNullType) { - return BuildNullableTypeStructure(nonNullType.Type); + return BuildNullableTypeStructure(nonNullType.NullableType); } return (IType)typeSystemMember; diff --git a/src/HotChocolate/Core/src/Types/Types/Contracts/INamedType.cs b/src/HotChocolate/Core/src/Types/Types/Contracts/INamedType.cs index 73e892f0977..71c40685ba4 100644 --- a/src/HotChocolate/Core/src/Types/Types/Contracts/INamedType.cs +++ b/src/HotChocolate/Core/src/Types/Types/Contracts/INamedType.cs @@ -10,6 +10,7 @@ public interface INamedType , IHasName , IHasDescription , IHasReadOnlyContextData + , IHasRuntimeType { /// /// Determines whether an instance of a specified type diff --git a/src/HotChocolate/Core/src/Types/Types/Extensions/TypeExtensions.cs b/src/HotChocolate/Core/src/Types/Types/Extensions/TypeExtensions.cs index d3309e5bcbf..2b1ecff78c0 100644 --- a/src/HotChocolate/Core/src/Types/Types/Extensions/TypeExtensions.cs +++ b/src/HotChocolate/Core/src/Types/Types/Extensions/TypeExtensions.cs @@ -342,7 +342,7 @@ internal static bool IsType(this IType type, TypeKind kind) return true; } - if (type.Kind == TypeKind.NonNull && ((NonNullType)type).Type.Kind == kind) + if (type.Kind == TypeKind.NonNull && ((NonNullType)type).NullableType.Kind == kind) { return true; } @@ -360,7 +360,7 @@ internal static bool IsType(this IType type, TypeKind kind1, TypeKind kind2) if (type.Kind == TypeKind.NonNull) { - var innerKind = ((NonNullType)type).Type.Kind; + var innerKind = ((NonNullType)type).NullableType.Kind; if (innerKind == kind1 || innerKind == kind2) { @@ -381,7 +381,7 @@ internal static bool IsType(this IType type, TypeKind kind1, TypeKind kind2, Typ if (type.Kind == TypeKind.NonNull) { - var innerKind = ((NonNullType)type).Type.Kind; + var innerKind = ((NonNullType)type).NullableType.Kind; if (innerKind == kind1 || innerKind == kind2 || innerKind == kind3) { @@ -401,7 +401,7 @@ public static IType InnerType(this IType type) if (type.Kind == TypeKind.NonNull) { - return ((NonNullType)type).Type; + return ((NonNullType)type).NullableType; } if (type.Kind == TypeKind.List) @@ -421,7 +421,7 @@ public static IType NullableType(this IType type) return type.Kind != TypeKind.NonNull ? type - : ((NonNullType)type).Type; + : ((NonNullType)type).NullableType; } public static string TypeName(this IType type) @@ -448,7 +448,7 @@ public static ListType ListType(this IType type) if (type.Kind == TypeKind.NonNull) { - var innerType = ((NonNullType)type).Type; + var innerType = ((NonNullType)type).NullableType; if (innerType.Kind == TypeKind.List) { @@ -564,7 +564,7 @@ public static bool IsEqualTo(this IType x, IType y) return x switch { - NonNullType xnn when y is NonNullType ynn => xnn.Type.IsEqualTo(ynn.Type), + NonNullType xnn when y is NonNullType ynn => xnn.NullableType.IsEqualTo(ynn.NullableType), ListType xl when y is ListType yl => xl.ElementType.IsEqualTo(yl.ElementType), INamedType xnt when y is INamedType ynt => xnt.Name.EqualsOrdinal(ynt.Name), _ => false, @@ -629,7 +629,8 @@ public static ITypeNode ToTypeNode(this IType type) throw new ArgumentNullException(nameof(type)); } - if (type is NonNullType nonNullType && ToTypeNode(nonNullType.Type) is INullableTypeNode nullableTypeNode) + if (type is NonNullType nonNullType + && ToTypeNode(nonNullType.NullableType) is INullableTypeNode nullableTypeNode) { return new NonNullTypeNode(null, nullableTypeNode); } @@ -653,7 +654,7 @@ public static ITypeNode ToTypeNode( INamedType namedType) { if (original is NonNullType nonNullType - && ToTypeNode(nonNullType.Type, namedType) is INullableTypeNode nullableTypeNode) + && ToTypeNode(nonNullType.NullableType, namedType) is INullableTypeNode nullableTypeNode) { return new NonNullTypeNode(null, nullableTypeNode); } @@ -728,7 +729,7 @@ public static bool IsInstanceOfType(this IInputType type, IValueNode literal) switch (type.Kind) { case TypeKind.NonNull: - type = (IInputType)((NonNullType)type).Type; + type = (IInputType)((NonNullType)type).NullableType; continue; case TypeKind.List: diff --git a/src/HotChocolate/Core/src/Types/Types/FluentWrapperType.cs b/src/HotChocolate/Core/src/Types/Types/FluentWrapperType.cs index 8ffdee482be..d9f7bd45f19 100644 --- a/src/HotChocolate/Core/src/Types/Types/FluentWrapperType.cs +++ b/src/HotChocolate/Core/src/Types/Types/FluentWrapperType.cs @@ -4,8 +4,6 @@ namespace HotChocolate.Types; public abstract class FluentWrapperType : IOutputType, IInputType { - Type IHasRuntimeType.RuntimeType => throw new NotSupportedException(); - TypeKind IType.Kind => throw new NotSupportedException(); public bool Equals(IType? other) => ReferenceEquals(this, other); diff --git a/src/HotChocolate/Core/src/Types/Types/InputFormatter.cs b/src/HotChocolate/Core/src/Types/Types/InputFormatter.cs index 971eb401fba..5d5ce2dc754 100644 --- a/src/HotChocolate/Core/src/Types/Types/InputFormatter.cs +++ b/src/HotChocolate/Core/src/Types/Types/InputFormatter.cs @@ -43,7 +43,7 @@ private IValueNode FormatValueInternal(object? runtimeValue, IType type, Path pa switch (type.Kind) { case TypeKind.NonNull: - return FormatValueInternal(runtimeValue, ((NonNullType)type).Type, path); + return FormatValueInternal(runtimeValue, ((NonNullType)type).NullableType, path); case TypeKind.List: return FormatValueList(runtimeValue, (ListType)type, path); @@ -131,8 +131,8 @@ private IValueNode FormatValueLeaf(object runtimeValue, ILeafType type, Path pat { try { - if (runtimeValue.GetType() != type.RuntimeType && - _converter.TryConvert(type.RuntimeType, runtimeValue, out var converted)) + if (runtimeValue.GetType() != type.ToRuntimeType() && + _converter.TryConvert(type.ToRuntimeType(), runtimeValue, out var converted)) { runtimeValue = converted; } @@ -217,7 +217,7 @@ private IValueNode FormatResultInternal(object? resultValue, IType type, Path pa switch (type.Kind) { case TypeKind.NonNull: - return FormatResultInternal(resultValue, ((NonNullType)type).Type, path); + return FormatResultInternal(resultValue, ((NonNullType)type).NullableType, path); case TypeKind.List: return FormatResultList(resultValue, (ListType)type, path); diff --git a/src/HotChocolate/Core/src/Types/Types/Introspection/__Type.cs b/src/HotChocolate/Core/src/Types/Types/Introspection/__Type.cs index 4015baae9f0..20b730a5416 100644 --- a/src/HotChocolate/Core/src/Types/Types/Introspection/__Type.cs +++ b/src/HotChocolate/Core/src/Types/Types/Introspection/__Type.cs @@ -155,7 +155,7 @@ public static object Kind(IResolverContext context) => context.Parent() switch { ListType lt => lt.ElementType, - NonNullType nnt => nnt.Type, + NonNullType nnt => nnt.NullableType, _ => null, }; diff --git a/src/HotChocolate/Core/src/Types/Types/NativeType.cs b/src/HotChocolate/Core/src/Types/Types/NativeType.cs index c226fce9bb7..d6fa7fdd8a4 100644 --- a/src/HotChocolate/Core/src/Types/Types/NativeType.cs +++ b/src/HotChocolate/Core/src/Types/Types/NativeType.cs @@ -1,6 +1,8 @@ namespace HotChocolate.Types; -internal class NativeType : FluentWrapperType -{ - internal NativeType() { } -} +/// +/// Internal helper class to mark native types within a GraphQL context +/// e.g. >]]> +/// +// ReSharper disable once UnusedTypeParameter +internal class NativeType : FluentWrapperType; diff --git a/src/HotChocolate/Core/src/Types/Types/TypeNamePrinter.cs b/src/HotChocolate/Core/src/Types/Types/TypeNamePrinter.cs index 83a61015a34..df3c2bc5fe2 100644 --- a/src/HotChocolate/Core/src/Types/Types/TypeNamePrinter.cs +++ b/src/HotChocolate/Core/src/Types/Types/TypeNamePrinter.cs @@ -21,7 +21,7 @@ private static string Print(IType type, int count) if (type is NonNullType nnt) { - return $"{Print(nnt.Type, ++count)}!"; + return $"{Print(nnt.NullableType, ++count)}!"; } if (type is ListType lt) diff --git a/src/HotChocolate/Core/src/Types/Types/UnionType.cs b/src/HotChocolate/Core/src/Types/Types/UnionType.cs index 2cb5b6abfef..99c2e295b87 100644 --- a/src/HotChocolate/Core/src/Types/Types/UnionType.cs +++ b/src/HotChocolate/Core/src/Types/Types/UnionType.cs @@ -259,7 +259,7 @@ protected virtual void OnCompleteTypeSet( { if (type is NonNullType nonNullType) { - type = nonNullType.Type; + type = nonNullType.NullableType; } if (type is not ObjectType objectType) diff --git a/src/HotChocolate/Core/src/Types/Utilities/ThrowHelper.cs b/src/HotChocolate/Core/src/Types/Utilities/ThrowHelper.cs index e27bb994589..a56a4672b34 100644 --- a/src/HotChocolate/Core/src/Types/Utilities/ThrowHelper.cs +++ b/src/HotChocolate/Core/src/Types/Utilities/ThrowHelper.cs @@ -351,16 +351,19 @@ public static SerializationException ParseList_InvalidObjectKind( ListType type, Type listType, Path path) - => new SerializationException( + { + var runtimeType = type.ToRuntimeType(); + return new SerializationException( ErrorBuilder.New() .SetMessage( ThrowHelper_ParseList_InvalidObjectKind, listType.FullName ?? listType.Name, type.Print(), - type.RuntimeType.FullName ?? type.RuntimeType.Name) + runtimeType.FullName ?? runtimeType.Name) .Build(), type, path); + } public static SerializationException FormatValueList_InvalidObjectKind( ListType type, diff --git a/src/HotChocolate/Core/src/Types/Utilities/TypeFactoryHelper.cs b/src/HotChocolate/Core/src/Types/Utilities/TypeFactoryHelper.cs index 9faccceee28..e96ede6e406 100644 --- a/src/HotChocolate/Core/src/Types/Utilities/TypeFactoryHelper.cs +++ b/src/HotChocolate/Core/src/Types/Utilities/TypeFactoryHelper.cs @@ -20,7 +20,7 @@ public static bool IsTypeStructureValid(IType type, int listCount) { if (type is NonNullType nnt) { - return IsTypeStructureValid(nnt.Type, listCount); + return IsTypeStructureValid(nnt.NullableType, listCount); } if (type is ListType lt) diff --git a/src/HotChocolate/Core/src/Validation/Rules/ValueVisitor.cs b/src/HotChocolate/Core/src/Validation/Rules/ValueVisitor.cs index 2dd4091a7a8..d41cc179a48 100644 --- a/src/HotChocolate/Core/src/Validation/Rules/ValueVisitor.cs +++ b/src/HotChocolate/Core/src/Validation/Rules/ValueVisitor.cs @@ -480,7 +480,7 @@ private bool IsTypeCompatible(IType left, ITypeNode right) if (right is NonNullTypeNode rightNonNull) { return IsTypeCompatible( - leftNonNull.Type, + leftNonNull.NullableType, rightNonNull.Type); } return false; diff --git a/src/HotChocolate/Core/test/Execution.Tests/MiddlewareContextTests.cs b/src/HotChocolate/Core/test/Execution.Tests/MiddlewareContextTests.cs index db0fdb24f98..74265abb595 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/MiddlewareContextTests.cs +++ b/src/HotChocolate/Core/test/Execution.Tests/MiddlewareContextTests.cs @@ -163,7 +163,7 @@ public async Task ReplaceArguments_Delegate() foreach (var argumentValue in current.Values) { - if (argumentValue.Type.RuntimeType == + if (argumentValue.Type.ToRuntimeType() == typeof(string) && argumentValue .ValueLiteral is StringValueNode sv) diff --git a/src/HotChocolate/Primitives/src/Primitives/Types/IWrapperType.cs b/src/HotChocolate/Primitives/src/Primitives/Types/IWrapperType.cs index 4daa45b741a..a8df6f7176d 100644 --- a/src/HotChocolate/Primitives/src/Primitives/Types/IWrapperType.cs +++ b/src/HotChocolate/Primitives/src/Primitives/Types/IWrapperType.cs @@ -3,7 +3,7 @@ namespace HotChocolate.Types; /// /// Represents a GraphQL type that wraps another type e.g. non-null types or list types. /// -public interface IWrapperType : IType +public interface IWrapperType : IOutputType, IInputType { /// /// Gets the inner type. From f58ebfb165ac3a17518d5690e52f624343f2c411 Mon Sep 17 00:00:00 2001 From: Michael Staib Date: Tue, 15 Apr 2025 15:21:10 +0200 Subject: [PATCH 6/9] Fixed compile errors --- .../Core/test/Types.Tests/Internal/TypeInfoTests.cs | 12 ++++++------ .../Types/Directives/SpecedDirectiveTypeTests.cs | 4 ++-- .../test/Types.Tests/Types/InterfaceTypeTests.cs | 12 ++++++------ .../Core/test/Types.Tests/Types/ListTypeTests.cs | 2 +- .../Core/test/Types.Tests/Types/NativeTypeTests.cs | 3 +-- .../Core/test/Types.Tests/Types/NonNullTypeTests.cs | 4 ++-- .../test/Types.Tests/Types/Relay/NodeTypeTests.cs | 2 +- 7 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/HotChocolate/Core/test/Types.Tests/Internal/TypeInfoTests.cs b/src/HotChocolate/Core/test/Types.Tests/Internal/TypeInfoTests.cs index ae7fd57768c..86191393c29 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Internal/TypeInfoTests.cs +++ b/src/HotChocolate/Core/test/Types.Tests/Internal/TypeInfoTests.cs @@ -413,7 +413,7 @@ public void Create_TypeInfo_From_RewrittenType() Assert.IsType( Assert.IsType( - Assert.IsType(schemaType).ElementType).Type); + Assert.IsType(schemaType).ElementType).NullableType); } [Fact] @@ -451,11 +451,11 @@ public void Case4() // assert Assert.True(success); Assert.IsType(type); - type = ((NonNullType)type).Type as IOutputType; + type = ((NonNullType)type).NullableType as IOutputType; Assert.IsType(type); type = ((ListType)type).ElementType as IOutputType; Assert.IsType(type); - type = ((NonNullType)type).Type as IOutputType; + type = ((NonNullType)type).NullableType as IOutputType; Assert.IsType(type); } @@ -477,7 +477,7 @@ public void Case3_1() Assert.IsType(type); type = ((ListType)type).ElementType as IOutputType; Assert.IsType(type); - type = ((NonNullType)type).Type as IOutputType; + type = ((NonNullType)type).NullableType as IOutputType; Assert.IsType(type); } @@ -497,7 +497,7 @@ public void Case3_2() // assert Assert.True(success); Assert.IsType(type); - type = ((NonNullType)type).Type as IOutputType; + type = ((NonNullType)type).NullableType as IOutputType; Assert.IsType(type); type = ((ListType)type).ElementType as IOutputType; Assert.IsType(type); @@ -519,7 +519,7 @@ public void Case2_1() // assert Assert.True(success); Assert.IsType(type); - type = ((NonNullType)type).Type as IOutputType; + type = ((NonNullType)type).NullableType as IOutputType; Assert.IsType(type); } diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/Directives/SpecedDirectiveTypeTests.cs b/src/HotChocolate/Core/test/Types.Tests/Types/Directives/SpecedDirectiveTypeTests.cs index 41ae129c459..6a08f443b61 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Types/Directives/SpecedDirectiveTypeTests.cs +++ b/src/HotChocolate/Core/test/Types.Tests/Types/Directives/SpecedDirectiveTypeTests.cs @@ -24,7 +24,7 @@ public void EnsureSkipDirectiveIsAvailable() { Assert.Equal("if", t.Name); Assert.IsType(t.Type); - Assert.IsType(((NonNullType)t.Type).Type); + Assert.IsType(((NonNullType)t.Type).NullableType); }); Assert.Collection(directive.Locations.AsEnumerable(), t => Assert.Equal(DirectiveLocation.Field, t), @@ -52,7 +52,7 @@ public void EnsureIncludeDirectiveIsAvailable() { Assert.Equal("if", t.Name); Assert.IsType(t.Type); - Assert.IsType(((NonNullType)t.Type).Type); + Assert.IsType(((NonNullType)t.Type).NullableType); }); Assert.Collection(directive.Locations.AsEnumerable(), t => Assert.Equal(DirectiveLocation.Field, t), diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/InterfaceTypeTests.cs b/src/HotChocolate/Core/test/Types.Tests/Types/InterfaceTypeTests.cs index e3dd26285c5..12e7bd4d88f 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Types/InterfaceTypeTests.cs +++ b/src/HotChocolate/Core/test/Types.Tests/Types/InterfaceTypeTests.cs @@ -94,7 +94,7 @@ public void InferFieldsFromClrInterface() { Assert.Equal("bar", t.Name); Assert.IsType( - Assert.IsType(t.Type).Type); + Assert.IsType(t.Type).NullableType); }, t => { @@ -105,7 +105,7 @@ public void InferFieldsFromClrInterface() { Assert.Equal("qux", t.Name); Assert.IsType( - Assert.IsType(t.Type).Type); + Assert.IsType(t.Type).NullableType); Assert.Collection(t.Arguments, a => Assert.Equal("a", a.Name)); }); @@ -146,7 +146,7 @@ public void IgnoreFieldsFromClrInterface() { Assert.Equal("qux", t.Name); Assert.IsType( - Assert.IsType(t.Type).Type); + Assert.IsType(t.Type).NullableType); Assert.Collection(t.Arguments, a => Assert.Equal("a", a.Name)); }); @@ -172,7 +172,7 @@ public void UnIgnoreFieldsFromClrInterface() { Assert.Equal("bar", t.Name); Assert.IsType( - Assert.IsType(t.Type).Type); + Assert.IsType(t.Type).NullableType); }, t => { @@ -183,7 +183,7 @@ public void UnIgnoreFieldsFromClrInterface() { Assert.Equal("qux", t.Name); Assert.IsType( - Assert.IsType(t.Type).Type); + Assert.IsType(t.Type).NullableType); Assert.Collection(t.Arguments, a => Assert.Equal("a", a.Name)); }); @@ -207,7 +207,7 @@ public void ExplicitInterfaceFieldDeclaration() { Assert.Equal("bar", t.Name); Assert.IsType( - Assert.IsType(t.Type).Type); + Assert.IsType(t.Type).NullableType); }); } diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/ListTypeTests.cs b/src/HotChocolate/Core/test/Types.Tests/Types/ListTypeTests.cs index 9480ba4ad1b..42a5cb0e6c8 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Types/ListTypeTests.cs +++ b/src/HotChocolate/Core/test/Types.Tests/Types/ListTypeTests.cs @@ -39,7 +39,7 @@ public void EnsureNativeTypeIsCorrectlyDetected() var type = new ListType(innerType); // act - var clrType = type.RuntimeType; + var clrType = type.ToRuntimeType(); // assert Assert.Equal(typeof(List), clrType); diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/NativeTypeTests.cs b/src/HotChocolate/Core/test/Types.Tests/Types/NativeTypeTests.cs index f515994eeb1..56b920b3bd5 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Types/NativeTypeTests.cs +++ b/src/HotChocolate/Core/test/Types.Tests/Types/NativeTypeTests.cs @@ -23,8 +23,7 @@ public void ClrType_NotSupportedException() var type = new NativeType(); // act - Type clrType; - void Action() => clrType = ((IInputType)type).RuntimeType; + void Action() => type.ToRuntimeType(); // assert Assert.Throws(Action); diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/NonNullTypeTests.cs b/src/HotChocolate/Core/test/Types.Tests/Types/NonNullTypeTests.cs index 8e5b2e4b26d..cab1eb6fdb9 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Types/NonNullTypeTests.cs +++ b/src/HotChocolate/Core/test/Types.Tests/Types/NonNullTypeTests.cs @@ -12,7 +12,7 @@ public void EnsureInnerTypeIsCorrectlySet() var type = new NonNullType(innerType); // assert - Assert.Equal(innerType, type.Type); + Assert.Equal(innerType, type.NullableType); } [Fact] @@ -22,7 +22,7 @@ public void EnsureNativeTypeIsCorrectlyDetected() var type = new NonNullType(new StringType()); // assert - Assert.Equal(typeof(string), type.RuntimeType); + Assert.Equal(typeof(string), type.ToRuntimeType()); } [Fact] diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/Relay/NodeTypeTests.cs b/src/HotChocolate/Core/test/Types.Tests/Types/Relay/NodeTypeTests.cs index c9c7aa18550..bc0e42ec3f8 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Types/Relay/NodeTypeTests.cs +++ b/src/HotChocolate/Core/test/Types.Tests/Types/Relay/NodeTypeTests.cs @@ -32,7 +32,7 @@ public void InitializeExplicitFieldWithImplicitResolver() { Assert.Equal("id", t.Name); Assert.IsType( - Assert.IsType(t.Type).Type); + Assert.IsType(t.Type).NullableType); }); } From 29afd239e195dde1ced39746293f46f509f22899 Mon Sep 17 00:00:00 2001 From: Michael Staib Date: Tue, 15 Apr 2025 18:32:52 +0200 Subject: [PATCH 7/9] Fixed compile errors --- .../Abstractions/IHasReadOnlyContextData.cs | 2 +- .../FileBuilders/TypeFileBuilderBase.cs | 18 ++--- .../Core/src/Types/SchemaPrinter.cs | 2 +- .../src/Types/Types/Contracts/EnumValue.cs | 70 +++++++++++++++++ .../src/Types/Types/Contracts/IEnumType.cs | 4 +- .../src/Types/Types/Contracts/IEnumValue.cs | 37 --------- .../Core/src/Types/Types/DefaultEnumValue.cs | 61 +++++++++++++++ .../Contracts/IEnumValueDescriptor.cs | 4 +- .../Types/Descriptors/EnumValueDescriptor.cs | 4 +- .../Directives/TagDirectiveExtensions.cs | 4 +- .../Types/Types/EnumType.Initialization.cs | 16 ++-- .../Core/src/Types/Types/EnumType.cs | 8 +- .../Core/src/Types/Types/EnumValue.cs | 63 --------------- .../Types/Types/Helpers/DirectiveHelper.cs | 2 +- .../Types/Types/Introspection/__EnumValue.cs | 14 ++-- .../test/Types.Tests/SchemaCoordinateTests.cs | 4 +- .../test/Types.Tests/Types/EnumTypeTests.cs | 4 +- .../src/Data/Filters/Context/FilterInfo.cs | 4 +- .../Convention/DataTypeExtensionHelper.cs | 8 +- .../FilterFieldDescriptorExtensions.cs | 2 +- .../src/Data/Sorting/Context/SortingInfo.cs | 4 +- .../Sorting/Convention/ISortConvention.cs | 2 +- .../Data/Sorting/Convention/SortConvention.cs | 4 +- .../Sorting/Convention/SortTypeInterceptor.cs | 2 +- .../QueryableAscendingSortOperationHandler.cs | 2 +- ...QueryableDescendingSortOperationHandler.cs | 2 +- .../Handlers/QueryableOperationHandlerBase.cs | 8 +- .../src/Data/Sorting/Fields/ISortEnumValue.cs | 10 --- .../src/Data/Sorting/Fields/SortEnumValue.cs | 78 +++++++++---------- .../Data/src/Data/Sorting/SortEnumType.cs | 16 ++-- .../Data/Sorting/SortEnumTypeDescriptor.cs | 2 +- .../Sorting/SortEnumValueConfiguration.cs | 16 ++++ .../Data/Sorting/SortEnumValueDefinition.cs | 16 ---- .../Data/Sorting/SortEnumValueDescriptor.cs | 6 +- .../Sorting/Visitor/ISortOperationHandler.cs | 4 +- .../Visitor/ISortOperationHandler~1.cs | 2 +- .../Sorting/Visitor/SortOperationHandler.cs | 4 +- .../src/Data/Sorting/Visitor/SortVisitor.cs | 2 +- .../Data/Sorting/Visitor/SortVisitorBase`2.cs | 2 +- src/HotChocolate/Data/src/Data/ThrowHelper.cs | 2 +- .../Mock/MatchAnyQueryableOperationHandler.cs | 2 +- .../MongoDbSortOperationHandlerBase.cs | 6 +- .../DocumentAnalyzer.CollectEnumTypes.cs | 3 +- .../Analyzers/EnumTypeUsageAnalyzer.cs | 2 +- .../Analyzers/InputObjectTypeUsageAnalyzer.cs | 2 +- .../Analyzers/Models/EnumValueModel.cs | 4 +- .../Mappers/TypeDescriptorMapper.cs | 4 +- 47 files changed, 278 insertions(+), 260 deletions(-) create mode 100644 src/HotChocolate/Core/src/Types/Types/Contracts/EnumValue.cs delete mode 100644 src/HotChocolate/Core/src/Types/Types/Contracts/IEnumValue.cs create mode 100644 src/HotChocolate/Core/src/Types/Types/DefaultEnumValue.cs delete mode 100644 src/HotChocolate/Core/src/Types/Types/EnumValue.cs delete mode 100644 src/HotChocolate/Data/src/Data/Sorting/Fields/ISortEnumValue.cs create mode 100644 src/HotChocolate/Data/src/Data/Sorting/SortEnumValueConfiguration.cs delete mode 100644 src/HotChocolate/Data/src/Data/Sorting/SortEnumValueDefinition.cs diff --git a/src/HotChocolate/Core/src/Abstractions/IHasReadOnlyContextData.cs b/src/HotChocolate/Core/src/Abstractions/IHasReadOnlyContextData.cs index a6ac5bba1a9..befd7d9e36f 100644 --- a/src/HotChocolate/Core/src/Abstractions/IHasReadOnlyContextData.cs +++ b/src/HotChocolate/Core/src/Abstractions/IHasReadOnlyContextData.cs @@ -3,7 +3,7 @@ namespace HotChocolate; public interface IHasReadOnlyContextData { /// - /// The context data dictionary can be used by middleware components and + /// Gets the context data dictionary that can be used by middleware components and /// resolvers to retrieve data during execution. /// IReadOnlyDictionary ContextData { get; } diff --git a/src/HotChocolate/Core/src/Types.Analyzers/FileBuilders/TypeFileBuilderBase.cs b/src/HotChocolate/Core/src/Types.Analyzers/FileBuilders/TypeFileBuilderBase.cs index 2dca6346561..7d82246eb4b 100644 --- a/src/HotChocolate/Core/src/Types.Analyzers/FileBuilders/TypeFileBuilderBase.cs +++ b/src/HotChocolate/Core/src/Types.Analyzers/FileBuilders/TypeFileBuilderBase.cs @@ -149,15 +149,15 @@ protected virtual void WriteResolverBindingExtendsWith(IOutputTypeInfo type, Res "var pagingOptions = global::{0}.GetPagingOptions(c.Context, null);", WellKnownTypes.PagingHelper); Writer.WriteIndentedLine( - "c.Definition.State = c.Definition.State.SetItem(" + "c.Configuration.State = c.Configuration.State.SetItem(" + "HotChocolate.WellKnownContextData.PagingOptions, pagingOptions);"); Writer.WriteIndentedLine( - "c.Definition.ContextData[HotChocolate.WellKnownContextData.PagingOptions] = " + "c.Configuration.ContextData[HotChocolate.WellKnownContextData.PagingOptions] = " + "pagingOptions;"); } Writer.WriteIndentedLine( - "c.Definition.Resolvers = r.{0}();", + "c.Configuration.Resolvers = r.{0}();", resolver.Member.Name); if (resolver.ResultKind is not ResolverResultKind.Pure @@ -165,7 +165,7 @@ protected virtual void WriteResolverBindingExtendsWith(IOutputTypeInfo type, Res && resolver.Member.IsListType(out var elementType)) { Writer.WriteIndentedLine( - "c.Definition.ResultPostProcessor = global::{0}<{1}>.Default;", + "c.Configuration.ResultPostProcessor = global::{0}<{1}>.Default;", WellKnownTypes.ListPostProcessor, elementType); } @@ -173,26 +173,26 @@ protected virtual void WriteResolverBindingExtendsWith(IOutputTypeInfo type, Res protected void WriteFieldFlags(Resolver resolver) { - Writer.WriteIndentedLine("c.Definition.SetSourceGeneratorFlags();"); + Writer.WriteIndentedLine("c.Configuration.SetSourceGeneratorFlags();"); if (resolver.Kind is ResolverKind.ConnectionResolver) { - Writer.WriteIndentedLine("c.Definition.SetConnectionFlags();"); + Writer.WriteIndentedLine("c.Configuration.SetConnectionFlags();"); } if ((resolver.Flags & FieldFlags.ConnectionEdgesField) == FieldFlags.ConnectionEdgesField) { - Writer.WriteIndentedLine("c.Definition.SetConnectionEdgesFieldFlags();"); + Writer.WriteIndentedLine("c.Configuration.SetConnectionEdgesFieldFlags();"); } if ((resolver.Flags & FieldFlags.ConnectionNodesField) == FieldFlags.ConnectionNodesField) { - Writer.WriteIndentedLine("c.Definition.SetConnectionNodesFieldFlags();"); + Writer.WriteIndentedLine("c.Configuration.SetConnectionNodesFieldFlags();"); } if ((resolver.Flags & FieldFlags.TotalCount) == FieldFlags.TotalCount) { - Writer.WriteIndentedLine("c.Definition.SetConnectionTotalCountFieldFlags();"); + Writer.WriteIndentedLine("c.Configuration.SetConnectionTotalCountFieldFlags();"); } } diff --git a/src/HotChocolate/Core/src/Types/SchemaPrinter.cs b/src/HotChocolate/Core/src/Types/SchemaPrinter.cs index b7f8bc8fbca..54af184e8ee 100644 --- a/src/HotChocolate/Core/src/Types/SchemaPrinter.cs +++ b/src/HotChocolate/Core/src/Types/SchemaPrinter.cs @@ -354,7 +354,7 @@ private static EnumTypeDefinitionNode PrintEnumType(EnumType enumType) ); } - private static EnumValueDefinitionNode PrintEnumValue(IEnumValue enumValue) + private static EnumValueDefinitionNode PrintEnumValue(EnumValue enumValue) { var directives = enumValue.Directives .Select(PrintDirective) diff --git a/src/HotChocolate/Core/src/Types/Types/Contracts/EnumValue.cs b/src/HotChocolate/Core/src/Types/Types/Contracts/EnumValue.cs new file mode 100644 index 00000000000..5273a9189e2 --- /dev/null +++ b/src/HotChocolate/Core/src/Types/Types/Contracts/EnumValue.cs @@ -0,0 +1,70 @@ +#nullable enable + +using HotChocolate.Configuration; +using HotChocolate.Types.Helpers; + +namespace HotChocolate.Types; + +/// +/// Represents a GraphQL enum value. +/// +public abstract class EnumValue + : IHasDirectives + , IHasReadOnlyContextData + , ITypeSystemMember + , IEnumValueCompletion +{ + /// + /// The GraphQL name of this enum value. + /// + public abstract string Name { get; } + + /// + /// Gets the GraphQL description for this enum value. + /// + public abstract string? Description { get; } + + /// + /// Defines if this enum value is deprecated. + /// + public abstract bool IsDeprecated { get; } + + /// + /// Gets the deprecation reason for this enum value. + /// + public abstract string? DeprecationReason { get; } + + /// + /// Gets the runtime value. + /// + public abstract object Value { get; } + + /// + /// Gets the directives of this enum value. + /// + public abstract IDirectiveCollection Directives { get; } + + /// + /// Gets the context data dictionary that can be used by middleware components and + /// resolvers to retrieve data during execution. + /// + public abstract IReadOnlyDictionary ContextData { get; } + + /// + /// Will be invoked before the metadata of this enum value is completed. + /// + /// + /// The type completion context. + /// + /// + /// The declaring member of this enum value. + /// + protected virtual void OnCompleteMetadata( + ITypeCompletionContext context, + ITypeSystemMember declaringMember) + { + } + + void IEnumValueCompletion.CompleteMetadata(ITypeCompletionContext context, ITypeSystemMember declaringMember) + => OnCompleteMetadata(context, declaringMember); +} diff --git a/src/HotChocolate/Core/src/Types/Types/Contracts/IEnumType.cs b/src/HotChocolate/Core/src/Types/Types/Contracts/IEnumType.cs index 3f631491234..ff4c29e2783 100644 --- a/src/HotChocolate/Core/src/Types/Types/Contracts/IEnumType.cs +++ b/src/HotChocolate/Core/src/Types/Types/Contracts/IEnumType.cs @@ -12,7 +12,7 @@ public interface IEnumType : ILeafType /// /// Gets the possible enum values. /// - IReadOnlyList Values { get; } + IReadOnlyList Values { get; } /// /// Tries to get the for @@ -28,7 +28,7 @@ public interface IEnumType : ILeafType /// true if the represents a value of this enum type; /// otherwise, false. /// - bool TryGetValue(string name, [NotNullWhen(true)] out IEnumValue? value); + bool TryGetValue(string name, [NotNullWhen(true)] out EnumValue? value); /// /// Tries to get the for diff --git a/src/HotChocolate/Core/src/Types/Types/Contracts/IEnumValue.cs b/src/HotChocolate/Core/src/Types/Types/Contracts/IEnumValue.cs deleted file mode 100644 index e05ec3b691f..00000000000 --- a/src/HotChocolate/Core/src/Types/Types/Contracts/IEnumValue.cs +++ /dev/null @@ -1,37 +0,0 @@ -#nullable enable - -namespace HotChocolate.Types; - -/// -/// Represents a GraphQL enum value. -/// -public interface IEnumValue - : IHasDirectives - , IHasReadOnlyContextData - , ITypeSystemMember -{ - /// - /// The GraphQL name of this enum value. - /// - string Name { get; } - - /// - /// Gets the GraphQL description for this enum value. - /// - string? Description { get; } - - /// - /// Defines if this enum value is deprecated. - /// - bool IsDeprecated { get; } - - /// - /// Gets the deprecation reason for this enum value. - /// - string? DeprecationReason { get; } - - /// - /// Gets the runtime value. - /// - object Value { get; } -} diff --git a/src/HotChocolate/Core/src/Types/Types/DefaultEnumValue.cs b/src/HotChocolate/Core/src/Types/Types/DefaultEnumValue.cs new file mode 100644 index 00000000000..c1a876e785a --- /dev/null +++ b/src/HotChocolate/Core/src/Types/Types/DefaultEnumValue.cs @@ -0,0 +1,61 @@ +using HotChocolate.Configuration; +using HotChocolate.Properties; +using HotChocolate.Types.Descriptors.Definitions; + +#nullable enable + +namespace HotChocolate.Types; + +public sealed class DefaultEnumValue : EnumValue +{ + private EnumValueConfiguration? _configuration; + private IDirectiveCollection _directives = null!; + + public DefaultEnumValue(EnumValueConfiguration configuration) + { + ArgumentNullException.ThrowIfNull(configuration); + + if (configuration.RuntimeValue is null) + { + throw new ArgumentException( + TypeResources.EnumValue_ValueIsNull, + nameof(configuration)); + } + + _configuration = configuration; + + Name = string.IsNullOrEmpty(configuration.Name) + ? configuration.RuntimeValue.ToString()! + : configuration.Name; + Description = configuration.Description; + DeprecationReason = configuration.DeprecationReason; + IsDeprecated = !string.IsNullOrEmpty(configuration.DeprecationReason); + Value = configuration.RuntimeValue; + ContextData = configuration.GetContextData(); + } + + public override string Name { get; } + + public override string? Description { get; } + + public override bool IsDeprecated { get; } + + public override string? DeprecationReason { get; } + + public override object Value { get; } + + public override IDirectiveCollection Directives => _directives; + + public override IReadOnlyDictionary ContextData { get; } + + protected override void OnCompleteMetadata( + ITypeCompletionContext context, + ITypeSystemMember declaringMember) + { + _directives = DirectiveCollection.CreateAndComplete( + context, + this, + _configuration!.GetDirectives()); + _configuration = null; + } +} diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IEnumValueDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IEnumValueDescriptor.cs index da8bf1ab5cf..f6f950b2e0b 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IEnumValueDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Contracts/IEnumValueDescriptor.cs @@ -8,7 +8,7 @@ public interface IEnumValueDescriptor , IFluent { /// - /// Defines the name of the . + /// Defines the name of the . /// The name represents the public visible enum value name. /// /// The enum value name. @@ -19,7 +19,7 @@ public interface IEnumValueDescriptor IEnumValueDescriptor Name(string value); /// - /// Adds explanatory text to the + /// Adds explanatory text to the /// that can be accessed via introspection. /// /// The enum value description. diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/EnumValueDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/EnumValueDescriptor.cs index fcca9193c17..1f2d98250a8 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/EnumValueDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/EnumValueDescriptor.cs @@ -26,10 +26,10 @@ protected EnumValueDescriptor(IDescriptorContext context, object runtimeValue) } } - protected EnumValueDescriptor(IDescriptorContext context, EnumValueConfiguration definition) + protected EnumValueDescriptor(IDescriptorContext context, EnumValueConfiguration configuration) : base(context) { - Definition = definition ?? throw new ArgumentNullException(nameof(definition)); + Definition = configuration ?? throw new ArgumentNullException(nameof(configuration)); } protected internal override EnumValueConfiguration Definition { get; protected set; } = new(); diff --git a/src/HotChocolate/Core/src/Types/Types/Directives/TagDirectiveExtensions.cs b/src/HotChocolate/Core/src/Types/Types/Directives/TagDirectiveExtensions.cs index c14497326a3..78d45f8f763 100644 --- a/src/HotChocolate/Core/src/Types/Types/Directives/TagDirectiveExtensions.cs +++ b/src/HotChocolate/Core/src/Types/Types/Directives/TagDirectiveExtensions.cs @@ -340,7 +340,7 @@ public static IDirectiveArgumentDescriptor Tag( } /// - /// Adds a @tag(name: "your-value") to an . + /// Adds a @tag(name: "your-value") to an . /// /// enum Episode { /// NEWHOPE @tag(name: "your-value") @@ -374,7 +374,7 @@ public static IEnumValueDescriptor Tag( } /// - /// Adds a @tag(name: "your-value") to an . + /// Adds a @tag(name: "your-value") to an . /// /// schema @myDirective(arg: "value") { /// query: Query diff --git a/src/HotChocolate/Core/src/Types/Types/EnumType.Initialization.cs b/src/HotChocolate/Core/src/Types/Types/EnumType.Initialization.cs index 349cbc9db11..b04de0b07a4 100644 --- a/src/HotChocolate/Core/src/Types/Types/EnumType.Initialization.cs +++ b/src/HotChocolate/Core/src/Types/Types/EnumType.Initialization.cs @@ -14,9 +14,9 @@ namespace HotChocolate.Types; public partial class EnumType { - private FrozenDictionary _nameLookup = default!; - private FrozenDictionary _valueLookup = default!; - private ImmutableArray _values; + private FrozenDictionary _nameLookup = default!; + private FrozenDictionary _valueLookup = default!; + private ImmutableArray _values; private INamingConventions _naming = default!; private Action? _configure; @@ -98,9 +98,9 @@ protected override void OnCompleteType( { base.OnCompleteType(context, definition); - var builder = ImmutableArray.CreateBuilder(definition.Values.Count); - var nameLookupBuilder = new Dictionary(definition.NameComparer); - var valueLookupBuilder = new Dictionary(definition.ValueComparer); + var builder = ImmutableArray.CreateBuilder(definition.Values.Count); + var nameLookupBuilder = new Dictionary(definition.NameComparer); + var valueLookupBuilder = new Dictionary(definition.ValueComparer); _naming = context.DescriptorContext.Naming; foreach (var enumValueDefinition in definition.Values) @@ -148,9 +148,9 @@ protected override void OnCompleteMetadata( protected virtual bool TryCreateEnumValue( ITypeCompletionContext context, EnumValueConfiguration definition, - [NotNullWhen(true)] out IEnumValue? enumValue) + [NotNullWhen(true)] out EnumValue? enumValue) { - enumValue = new EnumValue(definition); + enumValue = new DefaultEnumValue(definition); return true; } } diff --git a/src/HotChocolate/Core/src/Types/Types/EnumType.cs b/src/HotChocolate/Core/src/Types/Types/EnumType.cs index a99688357ad..59af27d5a63 100644 --- a/src/HotChocolate/Core/src/Types/Types/EnumType.cs +++ b/src/HotChocolate/Core/src/Types/Types/EnumType.cs @@ -37,19 +37,19 @@ public partial class EnumType /// /// Gets the enum values of this type. /// - public IReadOnlyList Values => _values; + public IReadOnlyList Values => _values; /// /// Gets a dictionary that allows to look up the enum value by its name. /// - protected IReadOnlyDictionary NameLookup => _nameLookup; + protected IReadOnlyDictionary NameLookup => _nameLookup; /// /// Gets a dictionary that allows to look up the enum value by its runtime value. /// - protected IReadOnlyDictionary ValueLookup => _valueLookup; + protected IReadOnlyDictionary ValueLookup => _valueLookup; - public bool TryGetValue(string name, [NotNullWhen(true)] out IEnumValue? value) + public bool TryGetValue(string name, [NotNullWhen(true)] out EnumValue? value) { if (string.IsNullOrEmpty(name)) { diff --git a/src/HotChocolate/Core/src/Types/Types/EnumValue.cs b/src/HotChocolate/Core/src/Types/Types/EnumValue.cs deleted file mode 100644 index be5849c81b7..00000000000 --- a/src/HotChocolate/Core/src/Types/Types/EnumValue.cs +++ /dev/null @@ -1,63 +0,0 @@ -using HotChocolate.Configuration; -using HotChocolate.Properties; -using HotChocolate.Types.Descriptors.Definitions; -using HotChocolate.Types.Helpers; - -#nullable enable - -namespace HotChocolate.Types; - -public sealed class EnumValue : IEnumValue, IEnumValueCompletion -{ - private EnumValueConfiguration? _enumValueDefinition; - - public EnumValue(EnumValueConfiguration enumValueDefinition) - { - if (enumValueDefinition is null) - { - throw new ArgumentNullException(nameof(enumValueDefinition)); - } - - if (enumValueDefinition.RuntimeValue is null) - { - throw new ArgumentException( - TypeResources.EnumValue_ValueIsNull, - nameof(enumValueDefinition)); - } - - _enumValueDefinition = enumValueDefinition; - - Name = string.IsNullOrEmpty(enumValueDefinition.Name) - ? enumValueDefinition.RuntimeValue.ToString()! - : enumValueDefinition.Name; - Description = enumValueDefinition.Description; - DeprecationReason = enumValueDefinition.DeprecationReason; - IsDeprecated = !string.IsNullOrEmpty(enumValueDefinition.DeprecationReason); - Value = enumValueDefinition.RuntimeValue; - ContextData = enumValueDefinition.GetContextData(); - } - - public string Name { get; } - - public string? Description { get; } - - public bool IsDeprecated { get; } - - public string? DeprecationReason { get; } - - public object Value { get; } - - public IDirectiveCollection Directives { get; private set; } = default!; - - public IReadOnlyDictionary ContextData { get; } - void IEnumValueCompletion.CompleteMetadata( - ITypeCompletionContext context, - ITypeSystemMember declaringMember) - { - Directives = DirectiveCollection.CreateAndComplete( - context, - this, - _enumValueDefinition!.GetDirectives()); - _enumValueDefinition = null; - } -} diff --git a/src/HotChocolate/Core/src/Types/Types/Helpers/DirectiveHelper.cs b/src/HotChocolate/Core/src/Types/Types/Helpers/DirectiveHelper.cs index 14797993d1b..79820baffb2 100644 --- a/src/HotChocolate/Core/src/Types/Types/Helpers/DirectiveHelper.cs +++ b/src/HotChocolate/Core/src/Types/Types/Helpers/DirectiveHelper.cs @@ -13,7 +13,7 @@ public static DirectiveLocation InferDirectiveLocation(object source) UnionType => DirectiveLocation.Union, InputObjectType => DirectiveLocation.InputObject, EnumType => DirectiveLocation.Enum, - IEnumValue => DirectiveLocation.EnumValue, + EnumValue => DirectiveLocation.EnumValue, IOutputField => DirectiveLocation.FieldDefinition, InputField => DirectiveLocation.InputFieldDefinition, Argument => DirectiveLocation.ArgumentDefinition, diff --git a/src/HotChocolate/Core/src/Types/Types/Introspection/__EnumValue.cs b/src/HotChocolate/Core/src/Types/Types/Introspection/__EnumValue.cs index c22a9d626d2..a09b6ab7f59 100644 --- a/src/HotChocolate/Core/src/Types/Types/Introspection/__EnumValue.cs +++ b/src/HotChocolate/Core/src/Types/Types/Introspection/__EnumValue.cs @@ -11,7 +11,7 @@ namespace HotChocolate.Types.Introspection; [Introspection] // ReSharper disable once InconsistentNaming -internal sealed class __EnumValue : ObjectType +internal sealed class __EnumValue : ObjectType { protected override ObjectTypeConfiguration CreateDefinition(ITypeDiscoveryContext context) { @@ -23,7 +23,7 @@ protected override ObjectTypeConfiguration CreateDefinition(ITypeDiscoveryContex var def = new ObjectTypeConfiguration( Names.__EnumValue, EnumValue_Description, - typeof(IEnumValue)) + typeof(EnumValue)) { Fields = { @@ -50,19 +50,19 @@ protected override ObjectTypeConfiguration CreateDefinition(ITypeDiscoveryContex private static class Resolvers { public static object Name(IResolverContext context) - => context.Parent().Name; + => context.Parent().Name; public static object? Description(IResolverContext context) - => context.Parent().Description; + => context.Parent().Description; public static object IsDeprecated(IResolverContext context) - => context.Parent().IsDeprecated; + => context.Parent().IsDeprecated; public static string? DeprecationReason(IResolverContext context) - => context.Parent().DeprecationReason; + => context.Parent().DeprecationReason; public static object AppliedDirectives(IResolverContext context) - => context.Parent().Directives + => context.Parent().Directives .Where(t => t.Type.IsPublic) .Select(d => d.AsSyntaxNode()); } diff --git a/src/HotChocolate/Core/test/Types.Tests/SchemaCoordinateTests.cs b/src/HotChocolate/Core/test/Types.Tests/SchemaCoordinateTests.cs index 73ab70f4ef0..c304bbda836 100644 --- a/src/HotChocolate/Core/test/Types.Tests/SchemaCoordinateTests.cs +++ b/src/HotChocolate/Core/test/Types.Tests/SchemaCoordinateTests.cs @@ -249,7 +249,7 @@ public void GetMember_EnumType_Value() var member = schema.GetMember("Abc.DEF"); // assert - Assert.Equal("DEF", Assert.IsType(member).Name); + Assert.Equal("DEF", Assert.IsType(member).Name); } [Fact] @@ -598,7 +598,7 @@ public void TryGetMember_EnumType_Value() // assert Assert.True(success); - Assert.Equal("DEF", Assert.IsType(member).Name); + Assert.Equal("DEF", Assert.IsType(member).Name); } [Fact] diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/EnumTypeTests.cs b/src/HotChocolate/Core/test/Types.Tests/Types/EnumTypeTests.cs index 885621c2728..94a61335389 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Types/EnumTypeTests.cs +++ b/src/HotChocolate/Core/test/Types.Tests/Types/EnumTypeTests.cs @@ -497,7 +497,7 @@ public void EnumValue_DefinitionIsNull_ArgumentNullException() { // arrange // act - void Action() => new EnumValue(null!); + void Action() => new DefaultEnumValue(null!); // assert Assert.Throws(Action); @@ -508,7 +508,7 @@ public void EnumValue_DefinitionValueIsNull_ArgumentNullException() { // arrange // act - void Action() => new EnumValue(new EnumValueConfiguration()); + void Action() => new DefaultEnumValue(new EnumValueConfiguration()); // assert Assert.Throws(Action); diff --git a/src/HotChocolate/Data/src/Data/Filters/Context/FilterInfo.cs b/src/HotChocolate/Data/src/Data/Filters/Context/FilterInfo.cs index 533490b670a..383e4fe060b 100644 --- a/src/HotChocolate/Data/src/Data/Filters/Context/FilterInfo.cs +++ b/src/HotChocolate/Data/src/Data/Filters/Context/FilterInfo.cs @@ -46,7 +46,7 @@ private void Initialize() var type = Type; if (Type is NonNullType nonNullType) { - type = nonNullType.Type; + type = nonNullType.NullableType; } if (ValueNode is ObjectValueNode valueNode && @@ -87,7 +87,7 @@ private IFilterValueNode CreateValueInfo(IValueNode valueNode, IType type) var normalizedType = type; if (type is NonNullType nonNullType) { - normalizedType = nonNullType.Type; + normalizedType = nonNullType.NullableType; } if (valueNode is ListValueNode listValueNode && diff --git a/src/HotChocolate/Data/src/Data/Filters/Convention/DataTypeExtensionHelper.cs b/src/HotChocolate/Data/src/Data/Filters/Convention/DataTypeExtensionHelper.cs index 3b5cf81e4ea..3b7e4cfe0e4 100644 --- a/src/HotChocolate/Data/src/Data/Filters/Convention/DataTypeExtensionHelper.cs +++ b/src/HotChocolate/Data/src/Data/Filters/Convention/DataTypeExtensionHelper.cs @@ -113,8 +113,8 @@ private static void MergeSortEnumValueDefinitions( typeFields, (_, extensionField, typeField) => { - if (typeField is SortEnumValueDefinition filterTypeField && - extensionField is SortEnumValueDefinition filterExtensionField) + if (typeField is SortEnumValueConfiguration filterTypeField && + extensionField is SortEnumValueConfiguration filterExtensionField) { filterTypeField.Handler ??= filterExtensionField.Handler; } @@ -194,9 +194,9 @@ private static void MergeSortEnumValues( foreach (var extensionField in extensionFields) { EnumValueConfiguration? typeField; - if (extensionField is SortEnumValueDefinition sortEnumValueDefinition) + if (extensionField is SortEnumValueConfiguration sortEnumValueDefinition) { - typeField = typeFields.OfType() + typeField = typeFields.OfType() .FirstOrDefault(t => t.Operation == sortEnumValueDefinition.Operation); } else diff --git a/src/HotChocolate/Data/src/Data/Filters/Extensions/FilterFieldDescriptorExtensions.cs b/src/HotChocolate/Data/src/Data/Filters/Extensions/FilterFieldDescriptorExtensions.cs index 6e98c96d4f7..072662994e3 100644 --- a/src/HotChocolate/Data/src/Data/Filters/Extensions/FilterFieldDescriptorExtensions.cs +++ b/src/HotChocolate/Data/src/Data/Filters/Extensions/FilterFieldDescriptorExtensions.cs @@ -33,7 +33,7 @@ private static TypeReference RewriteTypeToNullableType( if (reference is SchemaTypeReference schemaRef) { return schemaRef.Type is NonNullType nnt - ? schemaRef.WithType(nnt.Type) + ? schemaRef.WithType(nnt.NullableType) : schemaRef; } diff --git a/src/HotChocolate/Data/src/Data/Sorting/Context/SortingInfo.cs b/src/HotChocolate/Data/src/Data/Sorting/Context/SortingInfo.cs index 3ab0636e25d..bd3d680818e 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/Context/SortingInfo.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/Context/SortingInfo.cs @@ -38,7 +38,7 @@ private void Initialize() var type = Type; if (Type is NonNullType nonNullType) { - type = nonNullType.Type; + type = nonNullType.NullableType; } if (ValueNode is ObjectValueNode valueNode && @@ -69,7 +69,7 @@ private ISortingValueNode CreateValueInfo(IValueNode valueNode, IType type) var normalizedType = type; if (type is NonNullType nonNullType) { - normalizedType = nonNullType.Type; + normalizedType = nonNullType.NullableType; } if (valueNode is ListValueNode listValueNode && diff --git a/src/HotChocolate/Data/src/Data/Sorting/Convention/ISortConvention.cs b/src/HotChocolate/Data/src/Data/Sorting/Convention/ISortConvention.cs index 00ce85c2f5b..532fbc8e929 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/Convention/ISortConvention.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/Convention/ISortConvention.cs @@ -134,7 +134,7 @@ bool TryGetFieldHandler( bool TryGetOperationHandler( ITypeCompletionContext context, EnumTypeConfiguration typeDefinition, - SortEnumValueDefinition fieldDefinition, + SortEnumValueConfiguration fieldConfiguration, [NotNullWhen(true)] out ISortOperationHandler? handler); /// diff --git a/src/HotChocolate/Data/src/Data/Sorting/Convention/SortConvention.cs b/src/HotChocolate/Data/src/Data/Sorting/Convention/SortConvention.cs index 4b363dd7ae4..7c0d1b891e4 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/Convention/SortConvention.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/Convention/SortConvention.cs @@ -253,12 +253,12 @@ public virtual void ConfigureField(IObjectFieldDescriptor descriptor) => public bool TryGetOperationHandler( ITypeCompletionContext context, EnumTypeConfiguration typeDefinition, - SortEnumValueDefinition fieldDefinition, + SortEnumValueConfiguration fieldConfiguration, [NotNullWhen(true)] out ISortOperationHandler? handler) { foreach (var sortFieldHandler in _provider.OperationHandlers) { - if (sortFieldHandler.CanHandle(context, typeDefinition, fieldDefinition)) + if (sortFieldHandler.CanHandle(context, typeDefinition, fieldConfiguration)) { handler = sortFieldHandler; return true; diff --git a/src/HotChocolate/Data/src/Data/Sorting/Convention/SortTypeInterceptor.cs b/src/HotChocolate/Data/src/Data/Sorting/Convention/SortTypeInterceptor.cs index 1ec7e28d5a0..0e8c9805657 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/Convention/SortTypeInterceptor.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/Convention/SortTypeInterceptor.cs @@ -208,7 +208,7 @@ private void OnBeforeCompleteType( foreach (var enumValue in definition.Values) { - if (enumValue is SortEnumValueDefinition sortEnumValueDefinition) + if (enumValue is SortEnumValueConfiguration sortEnumValueDefinition) { if (convention.TryGetOperationHandler( completionContext, diff --git a/src/HotChocolate/Data/src/Data/Sorting/Expressions/Handlers/QueryableAscendingSortOperationHandler.cs b/src/HotChocolate/Data/src/Data/Sorting/Expressions/Handlers/QueryableAscendingSortOperationHandler.cs index c380009a79d..e39c491dd88 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/Expressions/Handlers/QueryableAscendingSortOperationHandler.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/Expressions/Handlers/QueryableAscendingSortOperationHandler.cs @@ -12,7 +12,7 @@ protected override QueryableSortOperation HandleOperation( QueryableSortContext context, QueryableFieldSelector fieldSelector, ISortField field, - ISortEnumValue? sortEnumValue) + SortEnumValue? sortEnumValue) { return AscendingSortOperation.From(fieldSelector); } diff --git a/src/HotChocolate/Data/src/Data/Sorting/Expressions/Handlers/QueryableDescendingSortOperationHandler.cs b/src/HotChocolate/Data/src/Data/Sorting/Expressions/Handlers/QueryableDescendingSortOperationHandler.cs index fcea4d21149..9f114412431 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/Expressions/Handlers/QueryableDescendingSortOperationHandler.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/Expressions/Handlers/QueryableDescendingSortOperationHandler.cs @@ -12,7 +12,7 @@ protected override QueryableSortOperation HandleOperation( QueryableSortContext context, QueryableFieldSelector fieldSelector, ISortField field, - ISortEnumValue? sortEnumValue) + SortEnumValue? sortEnumValue) { return DescendingSortOperation.From(fieldSelector); } diff --git a/src/HotChocolate/Data/src/Data/Sorting/Expressions/Handlers/QueryableOperationHandlerBase.cs b/src/HotChocolate/Data/src/Data/Sorting/Expressions/Handlers/QueryableOperationHandlerBase.cs index 20c75942b81..c2db2e62490 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/Expressions/Handlers/QueryableOperationHandlerBase.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/Expressions/Handlers/QueryableOperationHandlerBase.cs @@ -19,15 +19,15 @@ protected QueryableOperationHandlerBase(int operation) public override bool CanHandle( ITypeCompletionContext context, EnumTypeConfiguration typeDefinition, - SortEnumValueDefinition valueDefinition) + SortEnumValueConfiguration valueConfiguration) { - return valueDefinition.Operation == _operation; + return valueConfiguration.Operation == _operation; } public override bool TryHandleEnter( QueryableSortContext context, ISortField field, - ISortEnumValue? sortEnumValue, + SortEnumValue? sortEnumValue, EnumValueNode valueNode, [NotNullWhen(true)] out ISyntaxVisitorAction? action) { @@ -61,5 +61,5 @@ protected abstract QueryableSortOperation HandleOperation( QueryableSortContext context, QueryableFieldSelector fieldSelector, ISortField field, - ISortEnumValue? sortEnumValue); + SortEnumValue? sortEnumValue); } diff --git a/src/HotChocolate/Data/src/Data/Sorting/Fields/ISortEnumValue.cs b/src/HotChocolate/Data/src/Data/Sorting/Fields/ISortEnumValue.cs deleted file mode 100644 index 2f383dadd3c..00000000000 --- a/src/HotChocolate/Data/src/Data/Sorting/Fields/ISortEnumValue.cs +++ /dev/null @@ -1,10 +0,0 @@ -using HotChocolate.Types; - -namespace HotChocolate.Data.Sorting; - -public interface ISortEnumValue : IEnumValue -{ - ISortOperationHandler Handler { get; } - - int Operation { get; } -} diff --git a/src/HotChocolate/Data/src/Data/Sorting/Fields/SortEnumValue.cs b/src/HotChocolate/Data/src/Data/Sorting/Fields/SortEnumValue.cs index 1f178f36320..67865d9f8c1 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/Fields/SortEnumValue.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/Fields/SortEnumValue.cs @@ -1,65 +1,65 @@ using HotChocolate.Configuration; +using HotChocolate.Properties; using HotChocolate.Types; namespace HotChocolate.Data.Sorting; -public sealed class SortEnumValue : ISortEnumValue +public sealed class SortEnumValue : EnumValue { - private readonly DirectiveCollection _directives; + private SortEnumValueConfiguration? _configuration; + private IDirectiveCollection _directives = null!; - public SortEnumValue( - ITypeCompletionContext completionContext, - SortEnumValueDefinition enumValueDefinition) + public SortEnumValue(SortEnumValueConfiguration configuration) { - if (completionContext == null) - { - throw new ArgumentNullException(nameof(completionContext)); - } + ArgumentNullException.ThrowIfNull(configuration); - if (enumValueDefinition is null) - { - throw new ArgumentNullException(nameof(enumValueDefinition)); - } - - if (enumValueDefinition.Value is null) + if (configuration.RuntimeValue is null) { throw new ArgumentException( - DataResources.SortEnumValue_ValueIsNull, - nameof(enumValueDefinition)); + TypeResources.EnumValue_ValueIsNull, + nameof(configuration)); } - Name = !string.IsNullOrEmpty(enumValueDefinition.Name) - ? enumValueDefinition.Name - : enumValueDefinition.Value.ToString()!; - Description = enumValueDefinition.Description; - DeprecationReason = enumValueDefinition.DeprecationReason; - IsDeprecated = enumValueDefinition.IsDeprecated; - Value = enumValueDefinition.Value; - ContextData = enumValueDefinition.GetContextData(); - Handler = enumValueDefinition.Handler; - Operation = enumValueDefinition.Operation; - - _directives = DirectiveCollection.CreateAndComplete( - completionContext, - this, - enumValueDefinition.GetDirectives()); + _configuration = configuration; + + Name = string.IsNullOrEmpty(configuration.Name) + ? configuration.RuntimeValue.ToString()! + : configuration.Name; + Description = configuration.Description; + DeprecationReason = configuration.DeprecationReason; + IsDeprecated = !string.IsNullOrEmpty(configuration.DeprecationReason); + Value = configuration.RuntimeValue; + ContextData = configuration.GetContextData(); + Handler = configuration.Handler; + Operation = configuration.Operation; } - public string Name { get; } + public override string Name { get; } - public string? Description { get; } + public override string? Description { get; } - public bool IsDeprecated { get; } + public override bool IsDeprecated { get; } - public string? DeprecationReason { get; } + public override string? DeprecationReason { get; } - public object Value { get; } + public override object Value { get; } - public IDirectiveCollection Directives => _directives; + public override IDirectiveCollection Directives => _directives; - public IReadOnlyDictionary ContextData { get; } + public override IReadOnlyDictionary ContextData { get; } public ISortOperationHandler Handler { get; } public int Operation { get; } + + protected override void OnCompleteMetadata( + ITypeCompletionContext context, + ITypeSystemMember declaringMember) + { + _directives = DirectiveCollection.CreateAndComplete( + context, + this, + _configuration!.GetDirectives()); + _configuration = null; + } } diff --git a/src/HotChocolate/Data/src/Data/Sorting/SortEnumType.cs b/src/HotChocolate/Data/src/Data/Sorting/SortEnumType.cs index d41acb1a57b..f834bbc8753 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/SortEnumType.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/SortEnumType.cs @@ -43,11 +43,11 @@ protected virtual void Configure(ISortEnumTypeDescriptor descriptor) protected override bool TryCreateEnumValue( ITypeCompletionContext context, EnumValueConfiguration definition, - [NotNullWhen(true)] out IEnumValue? enumValue) + [NotNullWhen(true)] out EnumValue? enumValue) { - if (definition is SortEnumValueDefinition sortDefinition) + if (definition is SortEnumValueConfiguration sortDefinition) { - enumValue = new SortEnumValue(context, sortDefinition); + enumValue = new SortEnumValue(sortDefinition); return true; } @@ -55,7 +55,7 @@ protected override bool TryCreateEnumValue( return false; } - public ISortEnumValue? ParseSortLiteral(IValueNode valueSyntax) + public SortEnumValue? ParseSortLiteral(IValueNode valueSyntax) { if (valueSyntax is null) { @@ -64,14 +64,14 @@ protected override bool TryCreateEnumValue( if (valueSyntax is EnumValueNode evn && ValueLookup.TryGetValue(evn.Value, out var ev) && - ev is ISortEnumValue sortEnumValue) + ev is SortEnumValue sortEnumValue) { return sortEnumValue; } if (valueSyntax is StringValueNode svn && NameLookup.TryGetValue(svn.Value, out ev) && - ev is ISortEnumValue sortEnumValueOfString) + ev is SortEnumValue sortEnumValueOfString) { return sortEnumValueOfString; } @@ -91,7 +91,5 @@ protected override bool TryCreateEnumValue( } protected sealed override void Configure(IEnumTypeDescriptor descriptor) - { - throw new NotSupportedException(); - } + => throw new NotSupportedException(); } diff --git a/src/HotChocolate/Data/src/Data/Sorting/SortEnumTypeDescriptor.cs b/src/HotChocolate/Data/src/Data/Sorting/SortEnumTypeDescriptor.cs index cea7a9b4ab2..ba27a97ee45 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/SortEnumTypeDescriptor.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/SortEnumTypeDescriptor.cs @@ -51,7 +51,7 @@ protected override void OnCreateDefinition( } var values = Values.Select(t => t.CreateConfiguration()) - .OfType() + .OfType() .ToDictionary(t => t.Value); definition.Values.Clear(); diff --git a/src/HotChocolate/Data/src/Data/Sorting/SortEnumValueConfiguration.cs b/src/HotChocolate/Data/src/Data/Sorting/SortEnumValueConfiguration.cs new file mode 100644 index 00000000000..0e26b6c314e --- /dev/null +++ b/src/HotChocolate/Data/src/Data/Sorting/SortEnumValueConfiguration.cs @@ -0,0 +1,16 @@ +using HotChocolate.Types.Descriptors.Definitions; + +namespace HotChocolate.Data.Sorting; + +public class SortEnumValueConfiguration : EnumValueConfiguration +{ + public ISortOperationHandler Handler { get; set; } = null!; + + public int Operation { get; set; } + + public object Value + { + get => RuntimeValue!; + set => RuntimeValue = value; + } +} diff --git a/src/HotChocolate/Data/src/Data/Sorting/SortEnumValueDefinition.cs b/src/HotChocolate/Data/src/Data/Sorting/SortEnumValueDefinition.cs deleted file mode 100644 index cc8401fde42..00000000000 --- a/src/HotChocolate/Data/src/Data/Sorting/SortEnumValueDefinition.cs +++ /dev/null @@ -1,16 +0,0 @@ -using HotChocolate.Types.Descriptors.Definitions; - -namespace HotChocolate.Data.Sorting; - -public class SortEnumValueDefinition : EnumValueConfiguration -{ - public ISortOperationHandler Handler { get; set; } = default!; - - public int Operation { get; set; } - - public object Value - { - get => base.RuntimeValue!; - set => base.RuntimeValue = value; - } -} diff --git a/src/HotChocolate/Data/src/Data/Sorting/SortEnumValueDescriptor.cs b/src/HotChocolate/Data/src/Data/Sorting/SortEnumValueDescriptor.cs index 3694a55d6a9..cf891766d31 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/SortEnumValueDescriptor.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/SortEnumValueDescriptor.cs @@ -12,7 +12,7 @@ protected SortEnumValueDescriptor( IDescriptorContext context, string? scope, int value) - : base(context, new SortEnumValueDefinition { Operation = value, }) + : base(context, new SortEnumValueConfiguration { Operation = value, }) { var convention = context.GetSortConvention(scope); Definition.Name = convention.GetOperationName(value); @@ -22,8 +22,8 @@ protected SortEnumValueDescriptor( protected SortEnumValueDescriptor( IDescriptorContext context, - SortEnumValueDefinition definition) - : base(context, definition) + SortEnumValueConfiguration configuration) + : base(context, configuration) { } diff --git a/src/HotChocolate/Data/src/Data/Sorting/Visitor/ISortOperationHandler.cs b/src/HotChocolate/Data/src/Data/Sorting/Visitor/ISortOperationHandler.cs index 276c274db5b..1586eae8803 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/Visitor/ISortOperationHandler.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/Visitor/ISortOperationHandler.cs @@ -15,10 +15,10 @@ public interface ISortOperationHandler /// /// The discovery context of the schema /// The definition of the declaring type of the field - /// The definition of the field + /// The definition of the field /// Returns true if the field can be handled bool CanHandle( ITypeCompletionContext context, EnumTypeConfiguration typeDefinition, - SortEnumValueDefinition valueDefinition); + SortEnumValueConfiguration valueConfiguration); } diff --git a/src/HotChocolate/Data/src/Data/Sorting/Visitor/ISortOperationHandler~1.cs b/src/HotChocolate/Data/src/Data/Sorting/Visitor/ISortOperationHandler~1.cs index 6f74e333852..81a3efbe4e2 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/Visitor/ISortOperationHandler~1.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/Visitor/ISortOperationHandler~1.cs @@ -25,7 +25,7 @@ public interface ISortOperationHandler bool TryHandleEnter( TContext context, ISortField field, - ISortEnumValue? enumValue, + SortEnumValue? enumValue, EnumValueNode valueNode, [NotNullWhen(true)] out ISyntaxVisitorAction? action); } diff --git a/src/HotChocolate/Data/src/Data/Sorting/Visitor/SortOperationHandler.cs b/src/HotChocolate/Data/src/Data/Sorting/Visitor/SortOperationHandler.cs index 0baffa64e31..af0eb10d525 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/Visitor/SortOperationHandler.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/Visitor/SortOperationHandler.cs @@ -18,7 +18,7 @@ public abstract class SortOperationHandler public virtual bool TryHandleEnter( TContext context, ISortField field, - ISortEnumValue? sortValue, + SortEnumValue? sortValue, EnumValueNode node, [NotNullWhen(true)] out ISyntaxVisitorAction? action) { @@ -30,5 +30,5 @@ public virtual bool TryHandleEnter( public abstract bool CanHandle( ITypeCompletionContext context, EnumTypeConfiguration typeDefinition, - SortEnumValueDefinition valueDefinition); + SortEnumValueConfiguration valueConfiguration); } diff --git a/src/HotChocolate/Data/src/Data/Sorting/Visitor/SortVisitor.cs b/src/HotChocolate/Data/src/Data/Sorting/Visitor/SortVisitor.cs index 353e57bac4b..aaf44f7a21c 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/Visitor/SortVisitor.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/Visitor/SortVisitor.cs @@ -46,7 +46,7 @@ protected override ISyntaxVisitorAction OnFieldLeave( protected override ISyntaxVisitorAction OnOperationEnter( TContext context, ISortField field, - ISortEnumValue? sortValue, + SortEnumValue? sortValue, EnumValueNode valueNode) { if (sortValue?.Handler is ISortOperationHandler handler && diff --git a/src/HotChocolate/Data/src/Data/Sorting/Visitor/SortVisitorBase`2.cs b/src/HotChocolate/Data/src/Data/Sorting/Visitor/SortVisitorBase`2.cs index d38db3062f3..a05b9411efb 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/Visitor/SortVisitorBase`2.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/Visitor/SortVisitorBase`2.cs @@ -24,7 +24,7 @@ protected abstract ISyntaxVisitorAction OnFieldLeave( protected abstract ISyntaxVisitorAction OnOperationEnter( TContext context, ISortField field, - ISortEnumValue? sortEnumValue, + SortEnumValue? sortEnumValue, EnumValueNode enumValueNode); protected override ISyntaxVisitorAction Enter( diff --git a/src/HotChocolate/Data/src/Data/ThrowHelper.cs b/src/HotChocolate/Data/src/Data/ThrowHelper.cs index 3b1828b46dc..a8c5be1e189 100644 --- a/src/HotChocolate/Data/src/Data/ThrowHelper.cs +++ b/src/HotChocolate/Data/src/Data/ThrowHelper.cs @@ -237,7 +237,7 @@ public static SchemaException SortInterceptor_NoFieldHandlerFoundForField( public static SchemaException SortInterceptor_NoOperationHandlerFoundForValue( EnumTypeConfiguration type, - SortEnumValueDefinition value) => + SortEnumValueConfiguration value) => new SchemaException( SchemaErrorBuilder.New() .SetMessage( diff --git a/src/HotChocolate/Data/test/Data.Sorting.Tests/Mock/MatchAnyQueryableOperationHandler.cs b/src/HotChocolate/Data/test/Data.Sorting.Tests/Mock/MatchAnyQueryableOperationHandler.cs index 265f979b755..22ae4ad63e0 100644 --- a/src/HotChocolate/Data/test/Data.Sorting.Tests/Mock/MatchAnyQueryableOperationHandler.cs +++ b/src/HotChocolate/Data/test/Data.Sorting.Tests/Mock/MatchAnyQueryableOperationHandler.cs @@ -10,5 +10,5 @@ public class MatchAnyQueryableOperationHandler public override bool CanHandle( ITypeCompletionContext context, EnumTypeConfiguration typeDefinition, - SortEnumValueDefinition valueDefinition) => true; + SortEnumValueConfiguration valueConfiguration) => true; } diff --git a/src/HotChocolate/MongoDb/src/Data/Sorting/Handlers/MongoDbSortOperationHandlerBase.cs b/src/HotChocolate/MongoDb/src/Data/Sorting/Handlers/MongoDbSortOperationHandlerBase.cs index 0830dc53724..a21341da813 100644 --- a/src/HotChocolate/MongoDb/src/Data/Sorting/Handlers/MongoDbSortOperationHandlerBase.cs +++ b/src/HotChocolate/MongoDb/src/Data/Sorting/Handlers/MongoDbSortOperationHandlerBase.cs @@ -30,16 +30,16 @@ protected MongoDbSortOperationHandlerBase( public override bool CanHandle( ITypeCompletionContext context, EnumTypeConfiguration typeDefinition, - SortEnumValueDefinition valueDefinition) + SortEnumValueConfiguration valueConfiguration) { - return valueDefinition.Operation == _operation; + return valueConfiguration.Operation == _operation; } /// public override bool TryHandleEnter( MongoDbSortVisitorContext context, ISortField field, - ISortEnumValue? sortValue, + SortEnumValue? sortValue, EnumValueNode node, [NotNullWhen(true)] out ISyntaxVisitorAction? action) { diff --git a/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Analyzers/DocumentAnalyzer.CollectEnumTypes.cs b/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Analyzers/DocumentAnalyzer.CollectEnumTypes.cs index 58f3691e13e..bd8dd03d56b 100644 --- a/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Analyzers/DocumentAnalyzer.CollectEnumTypes.cs +++ b/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Analyzers/DocumentAnalyzer.CollectEnumTypes.cs @@ -21,8 +21,7 @@ private static void CollectEnumTypes(IDocumentAnalyzerContext context) { rename = enumValue.Directives.SingleOrDefault(); - var value = - enumValue.Directives.SingleOrDefault(); + var value = enumValue.Directives.SingleOrDefault(); values.Add(new EnumValueModel( rename?.Name ?? GetEnumValue(enumValue.Name), diff --git a/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Analyzers/EnumTypeUsageAnalyzer.cs b/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Analyzers/EnumTypeUsageAnalyzer.cs index 72261ba6e3f..24b900b087a 100644 --- a/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Analyzers/EnumTypeUsageAnalyzer.cs +++ b/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Analyzers/EnumTypeUsageAnalyzer.cs @@ -122,7 +122,7 @@ private void VisitInputType(IInputType type) type = elementType; continue; - case NonNullType { Type: IInputType innerType }: + case NonNullType { NullableType: IInputType innerType }: type = innerType; continue; diff --git a/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Analyzers/InputObjectTypeUsageAnalyzer.cs b/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Analyzers/InputObjectTypeUsageAnalyzer.cs index 3ca06879a0e..dfd388e399d 100644 --- a/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Analyzers/InputObjectTypeUsageAnalyzer.cs +++ b/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Analyzers/InputObjectTypeUsageAnalyzer.cs @@ -40,7 +40,7 @@ private void VisitInputType(IInputType type) type = elementType; continue; - case NonNullType { Type: IInputType innerType }: + case NonNullType { NullableType: IInputType innerType }: type = innerType; continue; diff --git a/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Analyzers/Models/EnumValueModel.cs b/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Analyzers/Models/EnumValueModel.cs index 691339cfbb9..8b252eb1aee 100644 --- a/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Analyzers/Models/EnumValueModel.cs +++ b/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Analyzers/Models/EnumValueModel.cs @@ -11,7 +11,7 @@ public sealed class EnumValueModel public EnumValueModel( string name, string? description, - IEnumValue value, + EnumValue value, string? underlyingValue) { Name = name.EnsureGraphQLName(); @@ -27,7 +27,7 @@ public EnumValueModel( public string? Description { get; } - public IEnumValue Value { get; } + public EnumValue Value { get; } public string? UnderlyingValue { get; } } diff --git a/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Mappers/TypeDescriptorMapper.cs b/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Mappers/TypeDescriptorMapper.cs index f475491bb2d..04569c926bb 100644 --- a/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Mappers/TypeDescriptorMapper.cs +++ b/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Mappers/TypeDescriptorMapper.cs @@ -498,13 +498,13 @@ private static ITypeDescriptor BuildFieldType( if (kind == PropertyKind.SkipOrIncludeField) { return BuildFieldType( - nnt.Type, + nnt.NullableType, namedTypeDescriptor); } return new NonNullTypeDescriptor( BuildFieldType( - nnt.Type, + nnt.NullableType, namedTypeDescriptor)); } From 80eedf8199aad64fe5e9e098caf477b9873b1921 Mon Sep 17 00:00:00 2001 From: Michael Staib Date: Tue, 15 Apr 2025 23:34:41 +0200 Subject: [PATCH 8/9] Fixed tests and naming issues --- .../Descriptors/EntityResolverDescriptor.cs | 14 +-- .../ApolloFederation/Types/ServerFields.cs | 2 +- .../Types/Descriptors/ArgumentDescriptor.cs | 22 ++-- .../Descriptors/ArgumentDescriptorBase~1.cs | 38 +++--- .../Types/Descriptors/DescriptorBase~1.cs | 24 ++-- .../DirectiveArgumentDescriptor.cs | 24 ++-- .../Descriptors/DirectiveTypeDescriptor.cs | 38 +++--- .../Descriptors/DirectiveTypeDescriptor~1.cs | 12 +- .../Types/Descriptors/EnumTypeDescriptor.cs | 44 +++---- .../Types/Descriptors/EnumValueDescriptor.cs | 36 +++--- .../Types/Descriptors/InputFieldDescriptor.cs | 24 ++-- .../Descriptors/InputObjectTypeDescriptor.cs | 40 +++---- .../InputObjectTypeDescriptor~1.cs | 8 +- .../Descriptors/InterfaceFieldDescriptor.cs | 42 +++---- .../Descriptors/InterfaceTypeDescriptor.cs | 44 +++---- .../Descriptors/InterfaceTypeDescriptor~1.cs | 10 +- .../Descriptors/ObjectFieldDescriptor.cs | 110 +++++++++--------- .../Types/Descriptors/ObjectTypeDescriptor.cs | 86 +++++++------- .../Descriptors/ObjectTypeDescriptorBase~1.cs | 22 ++-- .../Descriptors/ObjectTypeDescriptor~1.cs | 6 +- .../ObjectTypeExtensionDescriptor~1.cs | 12 +- .../Descriptors/OutputFieldDescriptorBase.cs | 34 +++--- .../Types/Descriptors/ScalarTypeDescriptor.cs | 18 +-- .../Types/Descriptors/SchemaTypeDescriptor.cs | 16 +-- .../Types/Descriptors/UnionTypeDescriptor.cs | 38 +++--- .../Introspection/IntrospectionFields.cs | 4 +- .../Types/Types/ObjectType.Initialization.cs | 4 +- .../Types/Relay/Descriptors/NodeDescriptor.cs | 20 ++-- .../Relay/Descriptors/NodeDescriptorBase.cs | 44 +++---- .../Relay/Descriptors/NodeDescriptor~1.cs | 18 +-- .../BoundNodeIdValueSerializer.cs | 17 ++- .../ObservableSourceStreamAdapter.cs | 8 +- ...eSource_BatchDataLoader_MatchesSnapshot.md | 4 +- ...OperationTests.Partial_Static_QueryType.md | 4 +- .../OperationTests.Root_NodeResolver.md | 4 +- ...tionTests.Root_Projection_Single_Entity.md | 4 +- ...ingTests.GenerateSource_ConnectionFlags.md | 44 +++---- ...erateSource_ConnectionT_MatchesSnapshot.md | 4 +- ...Source_CustomConnection_MatchesSnapshot.md | 40 +++---- ...onnection_No_Duplicates_MatchesSnapshot.md | 60 +++++----- ...nnection_ConnectionName_MatchesSnapshot.md | 40 +++---- ...ction_IncludeTotalCount_MatchesSnapshot.md | 40 +++---- ...GenericCustomConnection_MatchesSnapshot.md | 60 +++++----- ...tion_WithConnectionName_MatchesSnapshot.md | 90 +++++++------- ...it_From_ConnectionBase_Inherit_PageEdge.md | 44 +++---- ...erit_From_ConnectionBase_Reuse_PageEdge.md | 40 +++---- ...m_ConnectionBase_Reuse_PageEdge_Generic.md | 40 +++---- ...erateSource_Inherit_From_PageConnection.md | 44 +++---- ...esolverTests.Ensure_Entity_Becomes_Node.md | 4 +- ...y_Becomes_Node_With_Query_Node_Resolver.md | 8 +- ...WithGlobalStateArgument_MatchesSnapshot.md | 4 +- ...alStateSetStateArgument_MatchesSnapshot.md | 4 +- ...rWithLocalStateArgument_MatchesSnapshot.md | 4 +- ...alStateSetStateArgument_MatchesSnapshot.md | 4 +- ...WithScopedStateArgument_MatchesSnapshot.md | 4 +- ...edStateSetStateArgument_MatchesSnapshot.md | 4 +- .../ResolverTests.Inject_QueryContext.md | 6 +- ...sts.Register_ClrType_InferSchemaTypes.snap | 6 +- ...sts.Register_SchemaType_ClrTypeExists.snap | 6 +- ...erTests.Upgrade_Type_From_GenericType.snap | 6 +- .../src/Data/Filters/FilterFieldDescriptor.cs | 42 +++---- .../Data/Filters/FilterInputTypeDescriptor.cs | 74 ++++++------ .../Filters/FilterInputTypeDescriptor`1.cs | 16 +-- .../Filters/FilterOperationFieldDescriptor.cs | 25 ++-- .../Filters/IgnoreFilterFieldDescriptor.cs | 4 +- .../Data/Sorting/IgnoreSortFieldDescriptor.cs | 4 +- .../Data/Sorting/SortEnumTypeDescriptor.cs | 38 +++--- .../Data/Sorting/SortEnumValueDescriptor.cs | 12 +- .../src/Data/Sorting/SortFieldDescriptor.cs | 50 ++++---- .../Data/Sorting/SortInputTypeDescriptor.cs | 58 ++++----- .../Data/Sorting/SortInputTypeDescriptor`1.cs | 18 +-- 71 files changed, 924 insertions(+), 918 deletions(-) diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Descriptors/EntityResolverDescriptor.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Descriptors/EntityResolverDescriptor.cs index 35449f29707..4eb50603328 100644 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Descriptors/EntityResolverDescriptor.cs +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/Descriptors/EntityResolverDescriptor.cs @@ -38,17 +38,17 @@ internal EntityResolverDescriptor( .Extend() .OnBeforeCreate(OnCompleteDefinition); - Definition.EntityType = entityType; + Configuration.EntityType = entityType; } private void OnCompleteDefinition(ObjectTypeConfiguration definition) { - if (Definition.ResolverDefinition is not null) + if (Configuration.ResolverDefinition is not null) { if (definition.ContextData.TryGetValue(EntityResolver, out var value) && value is List resolvers) { - resolvers.Add(Definition.ResolverDefinition.Value); + resolvers.Add(Configuration.ResolverDefinition.Value); } else { @@ -56,7 +56,7 @@ private void OnCompleteDefinition(ObjectTypeConfiguration definition) EntityResolver, new List { - Definition.ResolverDefinition.Value, + Configuration.ResolverDefinition.Value, }); } } @@ -115,7 +115,7 @@ public IObjectTypeDescriptor ResolveReferenceWith() public IObjectTypeDescriptor ResolveReferenceWith(Type type) => ResolveReferenceWith( Context.TypeInspector.GetNodeResolverMethod( - Definition.EntityType ?? type, + Configuration.EntityType ?? type, type)!); private IObjectTypeDescriptor ResolveReference( @@ -126,9 +126,9 @@ private IObjectTypeDescriptor ResolveReference( ArgumentNullException.ThrowIfNull(required); - Definition.ResolverDefinition = new(fieldResolver, required); + Configuration.ResolverDefinition = new(fieldResolver, required); return _typeDescriptor; } - protected internal override EntityResolverDefinition Definition { get; protected set; } = new(); + protected internal override EntityResolverDefinition Configuration { get; protected set; } = new(); } diff --git a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/ServerFields.cs b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/ServerFields.cs index 4392650b435..e172e52382a 100644 --- a/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/ServerFields.cs +++ b/src/HotChocolate/ApolloFederation/src/ApolloFederation/Types/ServerFields.cs @@ -13,7 +13,7 @@ internal static ObjectFieldConfiguration CreateServiceField(IDescriptorContext c { var descriptor = ObjectFieldDescriptor.New(context, WellKnownFieldNames.Service); descriptor.Type>>().Resolve(_service); - descriptor.Definition.PureResolver = Resolve; + descriptor.Configuration.PureResolver = Resolve; static _Service Resolve(IResolverContext ctx) => _service; diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/ArgumentDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/ArgumentDescriptor.cs index 50e358bf1c7..a998def0997 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/ArgumentDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/ArgumentDescriptor.cs @@ -21,7 +21,7 @@ protected internal ArgumentDescriptor( string argumentName) : base(context) { - Definition.Name = argumentName; + Configuration.Name = argumentName; } /// @@ -38,7 +38,7 @@ protected internal ArgumentDescriptor( throw new ArgumentNullException(nameof(argumentType)); } - Definition.Type = context.TypeInspector.GetTypeRef(argumentType, TypeContext.Input); + Configuration.Type = context.TypeInspector.GetTypeRef(argumentType, TypeContext.Input); } /// @@ -49,14 +49,14 @@ protected internal ArgumentDescriptor( ParameterInfo parameter) : base(context) { - Definition.Name = context.Naming.GetArgumentName(parameter); - Definition.Description = context.Naming.GetArgumentDescription(parameter); - Definition.Type = context.TypeInspector.GetArgumentTypeRef(parameter); - Definition.Parameter = parameter; + Configuration.Name = context.Naming.GetArgumentName(parameter); + Configuration.Description = context.Naming.GetArgumentDescription(parameter); + Configuration.Type = context.TypeInspector.GetArgumentTypeRef(parameter); + Configuration.Parameter = parameter; if (context.TypeInspector.TryGetDefaultValue(parameter, out var defaultValue)) { - Definition.RuntimeDefaultValue = defaultValue; + Configuration.RuntimeDefaultValue = defaultValue; } if (context.Naming.IsDeprecated(parameter, out var reason)) @@ -73,7 +73,7 @@ protected internal ArgumentDescriptor( ArgumentConfiguration definition) : base(context) { - Definition = definition ?? throw new ArgumentNullException(nameof(definition)); + Configuration = definition ?? throw new ArgumentNullException(nameof(definition)); } /// @@ -81,13 +81,13 @@ protected override void OnCreateDefinition(ArgumentConfiguration definition) { Context.Descriptors.Push(this); - if (Definition is { AttributesAreApplied: false, Parameter: not null, }) + if (Configuration is { AttributesAreApplied: false, Parameter: not null, }) { Context.TypeInspector.ApplyAttributes( Context, this, - Definition.Parameter); - Definition.AttributesAreApplied = true; + Configuration.Parameter); + Configuration.AttributesAreApplied = true; } base.OnCreateDefinition(definition); diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/ArgumentDescriptorBase~1.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/ArgumentDescriptorBase~1.cs index 16bd65be7a2..aa788d0f432 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/ArgumentDescriptorBase~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/ArgumentDescriptorBase~1.cs @@ -19,11 +19,11 @@ namespace HotChocolate.Types.Descriptors; protected ArgumentDescriptorBase(IDescriptorContext context) : base(context) { - Definition = new T(); + Configuration = new T(); } /// - protected internal override T Definition { get; protected set; } + protected internal override T Configuration { get; protected set; } /// protected void Deprecated(string? reason) @@ -34,20 +34,20 @@ protected void Deprecated(string? reason) } else { - Definition.DeprecationReason = reason; + Configuration.DeprecationReason = reason; } } /// protected void Deprecated() { - Definition.DeprecationReason = WellKnownDirectives.DeprecationDefaultReason; + Configuration.DeprecationReason = WellKnownDirectives.DeprecationDefaultReason; } /// protected void Description(string value) { - Definition.Description = value; + Configuration.Description = value; } /// @@ -79,7 +79,7 @@ public void Type(Type type) throw new ArgumentException(TypeResources.ArgumentDescriptor_InputTypeViolation); } - Definition.SetMoreSpecificType(typeInfo.GetExtendedType(), TypeContext.Input); + Configuration.SetMoreSpecificType(typeInfo.GetExtendedType(), TypeContext.Input); } /// @@ -98,7 +98,7 @@ public void Type(TInputType inputType) nameof(inputType)); } - Definition.Type = new SchemaTypeReference(inputType); + Configuration.Type = new SchemaTypeReference(inputType); } /// @@ -129,7 +129,7 @@ public void Type(TypeReference typeReference) throw new ArgumentNullException(nameof(typeReference)); } - Definition.Type = typeReference; + Configuration.Type = typeReference; } /// @@ -140,14 +140,14 @@ public void Type(ITypeNode typeNode) throw new ArgumentNullException(nameof(typeNode)); } - Definition.SetMoreSpecificType(typeNode, TypeContext.Input); + Configuration.SetMoreSpecificType(typeNode, TypeContext.Input); } /// public void DefaultValue(IValueNode? value) { - Definition.DefaultValue = value ?? NullValueNode.Default; - Definition.RuntimeDefaultValue = null; + Configuration.DefaultValue = value ?? NullValueNode.Default; + Configuration.RuntimeDefaultValue = null; } /// @@ -155,27 +155,27 @@ public void DefaultValue(object? value) { if (value is null) { - Definition.DefaultValue = NullValueNode.Default; - Definition.RuntimeDefaultValue = null; + Configuration.DefaultValue = NullValueNode.Default; + Configuration.RuntimeDefaultValue = null; } else { var type = Context.TypeInspector.GetType(value.GetType()); - Definition.SetMoreSpecificType(type, TypeContext.Input); - Definition.RuntimeDefaultValue = value; - Definition.DefaultValue = null; + Configuration.SetMoreSpecificType(type, TypeContext.Input); + Configuration.RuntimeDefaultValue = value; + Configuration.DefaultValue = null; } } /// public void Directive(TDirective directiveInstance) where TDirective : class - => Definition.AddDirective(directiveInstance, Context.TypeInspector); + => Configuration.AddDirective(directiveInstance, Context.TypeInspector); /// public void Directive() where TDirective : class, new() - => Definition.AddDirective(new TDirective(), Context.TypeInspector); + => Configuration.AddDirective(new TDirective(), Context.TypeInspector); /// public void Directive(string name, params ArgumentNode[] arguments) - => Definition.AddDirective(name, arguments); + => Configuration.AddDirective(name, arguments); } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/DescriptorBase~1.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/DescriptorBase~1.cs index 990a108678a..6289737e0e8 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/DescriptorBase~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/DescriptorBase~1.cs @@ -17,9 +17,9 @@ public abstract class DescriptorBase(IDescriptorContext context) IDescriptorContext IHasDescriptorContext.Context => Context; - protected internal abstract T Definition { get; protected set; } + protected internal abstract T Configuration { get; protected set; } - T IDescriptorExtension.Configuration => Definition; + T IDescriptorExtension.Configuration => Configuration; public IDescriptorExtension Extend() => this; @@ -51,12 +51,12 @@ public IDescriptorExtension ExtendWith( public T CreateConfiguration() { - OnCreateDefinition(Definition); + OnCreateDefinition(Configuration); - if (Definition.HasTasks) + if (Configuration.HasTasks) { var i = 0; - var configurations = Definition.Tasks; + var configurations = Configuration.Tasks; do { @@ -72,7 +72,7 @@ public T CreateConfiguration() } while (i < configurations.Count); } - return Definition; + return Configuration; } protected virtual void OnCreateDefinition(T definition) @@ -105,9 +105,9 @@ private void OnBeforeCreate(Action configure) throw new ArgumentNullException(nameof(configure)); } - Definition.Tasks.Add(new OnCreateTypeSystemConfigurationTask( + Configuration.Tasks.Add(new OnCreateTypeSystemConfigurationTask( (c, d) => configure(c, (T)d), - Definition)); + Configuration)); } INamedDependencyDescriptor IDescriptorExtension.OnBeforeNaming( @@ -128,10 +128,10 @@ private INamedDependencyDescriptor OnBeforeNaming( var configuration = new OnCompleteTypeSystemConfigurationTask( (c, d) => configure(c, (T)d), - Definition, + Configuration, ApplyConfigurationOn.BeforeNaming); - Definition.Tasks.Add(configuration); + Configuration.Tasks.Add(configuration); return new NamedDependencyDescriptor(Context.TypeInspector, configuration); } @@ -149,10 +149,10 @@ private ICompletedDependencyDescriptor OnBeforeCompletion( { var configuration = new OnCompleteTypeSystemConfigurationTask( (c, d) => configure(c, (T)d), - Definition, + Configuration, ApplyConfigurationOn.BeforeCompletion); - Definition.Tasks.Add(configuration); + Configuration.Tasks.Add(configuration); return new CompletedDependencyDescriptor(Context.TypeInspector, configuration); } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/DirectiveArgumentDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/DirectiveArgumentDescriptor.cs index d5f9d525a0c..8ce75f56d58 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/DirectiveArgumentDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/DirectiveArgumentDescriptor.cs @@ -21,7 +21,7 @@ protected internal DirectiveArgumentDescriptor( string argumentName) : base(context) { - Definition.Name = argumentName; + Configuration.Name = argumentName; } /// @@ -32,16 +32,16 @@ protected internal DirectiveArgumentDescriptor( PropertyInfo property) : base(context) { - Definition.Name = context.Naming.GetMemberName( + Configuration.Name = context.Naming.GetMemberName( property, MemberKind.DirectiveArgument); - Definition.Description = context.Naming.GetMemberDescription( + Configuration.Description = context.Naming.GetMemberDescription( property, MemberKind.DirectiveArgument); - Definition.Type = context.TypeInspector.GetInputReturnTypeRef(property); - Definition.Property = property; + Configuration.Type = context.TypeInspector.GetInputReturnTypeRef(property); + Configuration.Property = property; if (context.TypeInspector.TryGetDefaultValue(property, out var defaultValue)) { - Definition.RuntimeDefaultValue = defaultValue; + Configuration.RuntimeDefaultValue = defaultValue; } if (context.Naming.IsDeprecated(property, out var reason)) @@ -58,7 +58,7 @@ protected internal DirectiveArgumentDescriptor( DirectiveArgumentConfiguration definition) : base(context) { - Definition = definition ?? throw new ArgumentNullException(nameof(definition)); + Configuration = definition ?? throw new ArgumentNullException(nameof(definition)); } /// @@ -66,10 +66,10 @@ protected override void OnCreateDefinition(DirectiveArgumentConfiguration defini { Context.Descriptors.Push(this); - if (Definition is { AttributesAreApplied: false, Property: not null, }) + if (Configuration is { AttributesAreApplied: false, Property: not null, }) { - Context.TypeInspector.ApplyAttributes(Context, this, Definition.Property); - Definition.AttributesAreApplied = true; + Context.TypeInspector.ApplyAttributes(Context, this, Configuration.Property); + Configuration.AttributesAreApplied = true; } base.OnCreateDefinition(definition); @@ -80,7 +80,7 @@ protected override void OnCreateDefinition(DirectiveArgumentConfiguration defini /// public IDirectiveArgumentDescriptor Name(string value) { - Definition.Name = value; + Configuration.Name = value; return this; } @@ -152,7 +152,7 @@ public IDirectiveArgumentDescriptor Name(string value) /// public IDirectiveArgumentDescriptor Ignore(bool ignore = true) { - Definition.Ignore = ignore; + Configuration.Ignore = ignore; return this; } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/DirectiveTypeDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/DirectiveTypeDescriptor.cs index d664addd2e1..59a3eb87ec0 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/DirectiveTypeDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/DirectiveTypeDescriptor.cs @@ -22,19 +22,19 @@ protected internal DirectiveTypeDescriptor( throw new ArgumentNullException(nameof(clrType)); } - Definition.RuntimeType = clrType; - Definition.Name = context.Naming.GetTypeName( + Configuration.RuntimeType = clrType; + Configuration.Name = context.Naming.GetTypeName( clrType, TypeKind.Directive); - Definition.Description = context.Naming.GetTypeDescription( + Configuration.Description = context.Naming.GetTypeDescription( clrType, TypeKind.Directive); - Definition.IsPublic = + Configuration.IsPublic = context.Options.DefaultDirectiveVisibility == DirectiveVisibility.Public; } protected internal DirectiveTypeDescriptor(IDescriptorContext context) : base(context) { - Definition.RuntimeType = typeof(object); + Configuration.RuntimeType = typeof(object); } protected internal DirectiveTypeDescriptor( @@ -42,10 +42,10 @@ protected internal DirectiveTypeDescriptor( DirectiveTypeConfiguration definition) : base(context) { - Definition = definition ?? throw new ArgumentNullException(nameof(definition)); + Configuration = definition ?? throw new ArgumentNullException(nameof(definition)); } - protected internal override DirectiveTypeConfiguration Definition { get; protected set; } = new(); + protected internal override DirectiveTypeConfiguration Configuration { get; protected set; } = new(); protected ICollection Arguments { get; } = new List(); @@ -55,13 +55,13 @@ protected override void OnCreateDefinition( { Context.Descriptors.Push(this); - if (!Definition.AttributesAreApplied && Definition.RuntimeType != typeof(object)) + if (!Configuration.AttributesAreApplied && Configuration.RuntimeType != typeof(object)) { Context.TypeInspector.ApplyAttributes( Context, this, - Definition.RuntimeType); - Definition.AttributesAreApplied = true; + Configuration.RuntimeType); + Configuration.AttributesAreApplied = true; } var arguments = new Dictionary(StringComparer.Ordinal); @@ -90,19 +90,19 @@ protected virtual void OnCompleteArguments( public IDirectiveTypeDescriptor Name(string value) { - Definition.Name = value; + Configuration.Name = value; return this; } public IDirectiveTypeDescriptor Description(string value) { - Definition.Description = value; + Configuration.Description = value; return this; } public IDirectiveArgumentDescriptor Argument(string name) { - var descriptor = Arguments.FirstOrDefault(t => t.Definition.Name.EqualsOrdinal(name)); + var descriptor = Arguments.FirstOrDefault(t => t.Configuration.Name.EqualsOrdinal(name)); if (descriptor is not null) { @@ -116,7 +116,7 @@ public IDirectiveArgumentDescriptor Argument(string name) public IDirectiveTypeDescriptor Location(DirectiveLocation value) { - Definition.Locations |= value; + Configuration.Locations |= value; return this; } @@ -127,7 +127,7 @@ public IDirectiveTypeDescriptor Use(DirectiveMiddleware middleware) throw new ArgumentNullException(nameof(middleware)); } - Definition.MiddlewareComponents.Add(middleware); + Configuration.MiddlewareComponents.Add(middleware); return this; } @@ -151,19 +151,19 @@ public IDirectiveTypeDescriptor Use( public IDirectiveTypeDescriptor Repeatable() { - Definition.IsRepeatable = true; + Configuration.IsRepeatable = true; return this; } public IDirectiveTypeDescriptor Public() { - Definition.IsPublic = true; + Configuration.IsPublic = true; return this; } public IDirectiveTypeDescriptor Internal() { - Definition.IsPublic = false; + Configuration.IsPublic = false; return this; } @@ -179,7 +179,7 @@ public static DirectiveTypeDescriptor FromSchemaType( Type schemaType) { var descriptor = New(context, schemaType); - descriptor.Definition.RuntimeType = typeof(object); + descriptor.Configuration.RuntimeType = typeof(object); return descriptor; } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/DirectiveTypeDescriptor~1.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/DirectiveTypeDescriptor~1.cs index 801981c9a0b..64251346eda 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/DirectiveTypeDescriptor~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/DirectiveTypeDescriptor~1.cs @@ -16,7 +16,7 @@ public class DirectiveTypeDescriptor protected internal DirectiveTypeDescriptor(IDescriptorContext context) : base(context, typeof(T)) { - Definition.Arguments.BindingBehavior = context.Options.DefaultBindingBehavior; + Configuration.Arguments.BindingBehavior = context.Options.DefaultBindingBehavior; } protected internal DirectiveTypeDescriptor( @@ -24,16 +24,16 @@ protected internal DirectiveTypeDescriptor( DirectiveTypeConfiguration definition) : base(context, definition) { - Definition = definition; + Configuration = definition; } - Type IHasRuntimeType.RuntimeType => Definition.RuntimeType; + Type IHasRuntimeType.RuntimeType => Configuration.RuntimeType; protected override void OnCompleteArguments( IDictionary arguments, ISet handledProperties) { - if (Definition.Arguments.IsImplicitBinding()) + if (Configuration.Arguments.IsImplicitBinding()) { FieldDescriptorUtilities.AddImplicitFields( this, @@ -62,7 +62,7 @@ protected override void OnCompleteArguments( public IDirectiveTypeDescriptor BindArguments( BindingBehavior behavior) { - Definition.Arguments.BindingBehavior = behavior; + Configuration.Arguments.BindingBehavior = behavior; return this; } @@ -83,7 +83,7 @@ public IDirectiveArgumentDescriptor Argument( if (property.ExtractMember() is PropertyInfo p) { var descriptor = - Arguments.FirstOrDefault(t => t.Definition.Property == p); + Arguments.FirstOrDefault(t => t.Configuration.Property == p); if (descriptor is { }) { return descriptor; diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/EnumTypeDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/EnumTypeDescriptor.cs index 35fc60ddc0f..51df50d95fe 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/EnumTypeDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/EnumTypeDescriptor.cs @@ -11,26 +11,26 @@ public class EnumTypeDescriptor protected EnumTypeDescriptor(IDescriptorContext context) : base(context) { - Definition.RuntimeType = typeof(object); - Definition.Values.BindingBehavior = context.Options.DefaultBindingBehavior; + Configuration.RuntimeType = typeof(object); + Configuration.Values.BindingBehavior = context.Options.DefaultBindingBehavior; } protected EnumTypeDescriptor(IDescriptorContext context, Type clrType) : base(context) { - Definition.RuntimeType = clrType ?? throw new ArgumentNullException(nameof(clrType)); - Definition.Name = context.Naming.GetTypeName(clrType, TypeKind.Enum); - Definition.Description = context.Naming.GetTypeDescription(clrType, TypeKind.Enum); - Definition.Values.BindingBehavior = context.Options.DefaultBindingBehavior; + Configuration.RuntimeType = clrType ?? throw new ArgumentNullException(nameof(clrType)); + Configuration.Name = context.Naming.GetTypeName(clrType, TypeKind.Enum); + Configuration.Description = context.Naming.GetTypeDescription(clrType, TypeKind.Enum); + Configuration.Values.BindingBehavior = context.Options.DefaultBindingBehavior; } protected EnumTypeDescriptor(IDescriptorContext context, EnumTypeConfiguration definition) : base(context) { - Definition = definition ?? throw new ArgumentNullException(nameof(definition)); + Configuration = definition ?? throw new ArgumentNullException(nameof(definition)); } - protected internal override EnumTypeConfiguration Definition { get; protected set; } = new(); + protected internal override EnumTypeConfiguration Configuration { get; protected set; } = new(); protected ICollection Values { get; } = new List(); @@ -40,13 +40,13 @@ protected override void OnCreateDefinition( { Context.Descriptors.Push(this); - if (!Definition.AttributesAreApplied && Definition.RuntimeType != typeof(object)) + if (!Configuration.AttributesAreApplied && Configuration.RuntimeType != typeof(object)) { Context.TypeInspector.ApplyAttributes( Context, this, - Definition.RuntimeType); - Definition.AttributesAreApplied = true; + Configuration.RuntimeType); + Configuration.AttributesAreApplied = true; } var values = Values.Select(t => t.CreateConfiguration()).ToDictionary(t => t.RuntimeValue); @@ -91,20 +91,20 @@ protected void AddImplicitValues( public IEnumTypeDescriptor Name(string value) { - Definition.Name = value; + Configuration.Name = value; return this; } public IEnumTypeDescriptor Description(string value) { - Definition.Description = value; + Configuration.Description = value; return this; } public IEnumTypeDescriptor BindValues( BindingBehavior behavior) { - Definition.Values.BindingBehavior = behavior; + Configuration.Values.BindingBehavior = behavior; return this; } @@ -116,21 +116,21 @@ public IEnumTypeDescriptor BindValuesImplicitly() => public IEnumTypeDescriptor NameComparer(IEqualityComparer comparer) { - Definition.NameComparer = comparer ?? throw new ArgumentNullException(nameof(comparer)); + Configuration.NameComparer = comparer ?? throw new ArgumentNullException(nameof(comparer)); return this; } public IEnumTypeDescriptor ValueComparer(IEqualityComparer comparer) { - Definition.ValueComparer = comparer ?? throw new ArgumentNullException(nameof(comparer)); + Configuration.ValueComparer = comparer ?? throw new ArgumentNullException(nameof(comparer)); return this; } public IEnumValueDescriptor Value(T value) { var descriptor = Values.FirstOrDefault(t => - t.Definition.RuntimeValue is not null && - t.Definition.RuntimeValue.Equals(value)); + t.Configuration.RuntimeValue is not null && + t.Configuration.RuntimeValue.Equals(value)); if (descriptor is not null) { @@ -145,20 +145,20 @@ t.Definition.RuntimeValue is not null && public IEnumTypeDescriptor Directive(T directiveInstance) where T : class { - Definition.AddDirective(directiveInstance, Context.TypeInspector); + Configuration.AddDirective(directiveInstance, Context.TypeInspector); return this; } public IEnumTypeDescriptor Directive() where T : class, new() { - Definition.AddDirective(new T(), Context.TypeInspector); + Configuration.AddDirective(new T(), Context.TypeInspector); return this; } public IEnumTypeDescriptor Directive(string name, params ArgumentNode[] arguments) { - Definition.AddDirective(name, arguments); + Configuration.AddDirective(name, arguments); return this; } @@ -180,7 +180,7 @@ public static EnumTypeDescriptor FromSchemaType( Type schemaType) { var descriptor = New(context, schemaType); - descriptor.Definition.RuntimeType = typeof(object); + descriptor.Configuration.RuntimeType = typeof(object); return descriptor; } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/EnumValueDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/EnumValueDescriptor.cs index 1f2d98250a8..ca6adf5db43 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/EnumValueDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/EnumValueDescriptor.cs @@ -16,9 +16,9 @@ protected EnumValueDescriptor(IDescriptorContext context, object runtimeValue) throw new ArgumentNullException(nameof(runtimeValue)); } - Definition.RuntimeValue = runtimeValue; - Definition.Description = context.Naming.GetEnumValueDescription(runtimeValue); - Definition.Member = context.TypeInspector.GetEnumValueMember(runtimeValue); + Configuration.RuntimeValue = runtimeValue; + Configuration.Description = context.Naming.GetEnumValueDescription(runtimeValue); + Configuration.Member = context.TypeInspector.GetEnumValueMember(runtimeValue); if (context.Naming.IsDeprecated(runtimeValue, out var reason)) { @@ -29,24 +29,24 @@ protected EnumValueDescriptor(IDescriptorContext context, object runtimeValue) protected EnumValueDescriptor(IDescriptorContext context, EnumValueConfiguration configuration) : base(context) { - Definition = configuration ?? throw new ArgumentNullException(nameof(configuration)); + Configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); } - protected internal override EnumValueConfiguration Definition { get; protected set; } = new(); + protected internal override EnumValueConfiguration Configuration { get; protected set; } = new(); protected override void OnCreateDefinition(EnumValueConfiguration definition) { Context.Descriptors.Push(this); - if (Definition is { AttributesAreApplied: false, Member: not null, }) + if (Configuration is { AttributesAreApplied: false, Member: not null, }) { Context.TypeInspector.ApplyAttributes( Context, this, - Definition.Member); - Definition.AttributesAreApplied = true; + Configuration.Member); + Configuration.AttributesAreApplied = true; - if (Context.TypeInspector.IsMemberIgnored(Definition.Member)) + if (Context.TypeInspector.IsMemberIgnored(Configuration.Member)) { Ignore(); } @@ -54,7 +54,7 @@ protected override void OnCreateDefinition(EnumValueConfiguration definition) if (string.IsNullOrEmpty(definition.Name)) { - Definition.Name = Context.Naming.GetEnumValueName(Definition.RuntimeValue!); + Configuration.Name = Context.Naming.GetEnumValueName(Configuration.RuntimeValue!); } base.OnCreateDefinition(definition); @@ -64,13 +64,13 @@ protected override void OnCreateDefinition(EnumValueConfiguration definition) public IEnumValueDescriptor Name(string value) { - Definition.Name = value; + Configuration.Name = value; return this; } public IEnumValueDescriptor Description(string value) { - Definition.Description = value; + Configuration.Description = value; return this; } @@ -81,39 +81,39 @@ public IEnumValueDescriptor Deprecated(string reason) return Deprecated(); } - Definition.DeprecationReason = reason; + Configuration.DeprecationReason = reason; return this; } public IEnumValueDescriptor Deprecated() { - Definition.DeprecationReason = WellKnownDirectives.DeprecationDefaultReason; + Configuration.DeprecationReason = WellKnownDirectives.DeprecationDefaultReason; return this; } public IEnumValueDescriptor Ignore(bool ignore = true) { - Definition.Ignore = ignore; + Configuration.Ignore = ignore; return this; } public IEnumValueDescriptor Directive(T directiveInstance) where T : class { - Definition.AddDirective(directiveInstance, Context.TypeInspector); + Configuration.AddDirective(directiveInstance, Context.TypeInspector); return this; } public IEnumValueDescriptor Directive() where T : class, new() { - Definition.AddDirective(new T(), Context.TypeInspector); + Configuration.AddDirective(new T(), Context.TypeInspector); return this; } public IEnumValueDescriptor Directive(string name, params ArgumentNode[] arguments) { - Definition.AddDirective(name, arguments); + Configuration.AddDirective(name, arguments); return this; } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/InputFieldDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/InputFieldDescriptor.cs index 1f451c9ea6d..2633df40e63 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/InputFieldDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/InputFieldDescriptor.cs @@ -19,7 +19,7 @@ protected internal InputFieldDescriptor( string fieldName) : base(context) { - Definition.Name = fieldName; + Configuration.Name = fieldName; } /// @@ -30,7 +30,7 @@ protected internal InputFieldDescriptor( InputFieldConfiguration definition) : base(context) { - Definition = definition ?? throw new ArgumentNullException(nameof(definition)); + Configuration = definition ?? throw new ArgumentNullException(nameof(definition)); } /// @@ -41,15 +41,15 @@ protected internal InputFieldDescriptor( PropertyInfo property) : base(context) { - Definition.Property = property + Configuration.Property = property ?? throw new ArgumentNullException(nameof(property)); - Definition.Name = context.Naming.GetMemberName(property, InputObjectField); - Definition.Description = context.Naming.GetMemberDescription(property, InputObjectField); - Definition.Type = context.TypeInspector.GetInputReturnTypeRef(property); + Configuration.Name = context.Naming.GetMemberName(property, InputObjectField); + Configuration.Description = context.Naming.GetMemberDescription(property, InputObjectField); + Configuration.Type = context.TypeInspector.GetInputReturnTypeRef(property); if (context.TypeInspector.TryGetDefaultValue(property, out var defaultValue)) { - Definition.RuntimeDefaultValue = defaultValue; + Configuration.RuntimeDefaultValue = defaultValue; } if (context.Naming.IsDeprecated(property, out var reason)) @@ -63,13 +63,13 @@ protected override void OnCreateDefinition(InputFieldConfiguration definition) { Context.Descriptors.Push(this); - if (Definition is { AttributesAreApplied: false, Property: not null, }) + if (Configuration is { AttributesAreApplied: false, Property: not null, }) { Context.TypeInspector.ApplyAttributes( Context, this, - Definition.Property); - Definition.AttributesAreApplied = true; + Configuration.Property); + Configuration.AttributesAreApplied = true; } base.OnCreateDefinition(definition); @@ -80,7 +80,7 @@ protected override void OnCreateDefinition(InputFieldConfiguration definition) /// public IInputFieldDescriptor Name(string value) { - Definition.Name = value; + Configuration.Name = value; return this; } @@ -152,7 +152,7 @@ public IInputFieldDescriptor Name(string value) /// public IInputFieldDescriptor Ignore(bool ignore = true) { - Definition.Ignore = ignore; + Configuration.Ignore = ignore; return this; } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/InputObjectTypeDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/InputObjectTypeDescriptor.cs index cf783f5887e..b0a9295fe91 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/InputObjectTypeDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/InputObjectTypeDescriptor.cs @@ -23,17 +23,17 @@ protected InputObjectTypeDescriptor(IDescriptorContext context, Type runtimeType throw new ArgumentNullException(nameof(runtimeType)); } - Definition.RuntimeType = runtimeType; - Definition.Name = context.Naming.GetTypeName( + Configuration.RuntimeType = runtimeType; + Configuration.Name = context.Naming.GetTypeName( runtimeType, TypeKind.InputObject); - Definition.Description = context.Naming.GetTypeDescription( + Configuration.Description = context.Naming.GetTypeDescription( runtimeType, TypeKind.InputObject); } protected InputObjectTypeDescriptor(IDescriptorContext context) : base(context) { - Definition.RuntimeType = typeof(object); + Configuration.RuntimeType = typeof(object); } protected InputObjectTypeDescriptor( @@ -41,7 +41,7 @@ protected InputObjectTypeDescriptor( InputObjectTypeConfiguration definition) : base(context) { - Definition = definition ?? throw new ArgumentNullException(nameof(definition)); + Configuration = definition ?? throw new ArgumentNullException(nameof(definition)); foreach (var field in definition.Fields) { @@ -49,7 +49,7 @@ protected InputObjectTypeDescriptor( } } - protected internal override InputObjectTypeConfiguration Definition { get; protected set; } = + protected internal override InputObjectTypeConfiguration Configuration { get; protected set; } = new(); protected ICollection Fields => _fields; @@ -59,13 +59,13 @@ protected override void OnCreateDefinition( { Context.Descriptors.Push(this); - if (!Definition.AttributesAreApplied && Definition.RuntimeType != typeof(object)) + if (!Configuration.AttributesAreApplied && Configuration.RuntimeType != typeof(object)) { Context.TypeInspector.ApplyAttributes( Context, this, - Definition.RuntimeType); - Definition.AttributesAreApplied = true; + Configuration.RuntimeType); + Configuration.AttributesAreApplied = true; } var fields = TypeMemHelper.RentInputFieldDefinitionMap(); @@ -88,8 +88,8 @@ protected override void OnCreateDefinition( OnCompleteFields(fields, handledMembers); - Definition.Fields.Clear(); - Definition.Fields.AddRange(fields.Values); + Configuration.Fields.Clear(); + Configuration.Fields.AddRange(fields.Values); TypeMemHelper.Return(fields); TypeMemHelper.Return(handledMembers); @@ -103,11 +103,11 @@ protected void InferFieldsFromFieldBindingType( IDictionary fields, ISet handledMembers) { - if (Definition.Fields.IsImplicitBinding()) + if (Configuration.Fields.IsImplicitBinding()) { var inspector = Context.TypeInspector; var naming = Context.Naming; - var type = Definition.RuntimeType; + var type = Configuration.RuntimeType; var members = inspector.GetMembers(type); foreach (var member in members) @@ -142,19 +142,19 @@ protected virtual void OnCompleteFields( public IInputObjectTypeDescriptor Name(string value) { - Definition.Name = value; + Configuration.Name = value; return this; } public IInputObjectTypeDescriptor Description(string value) { - Definition.Description = value; + Configuration.Description = value; return this; } public IInputFieldDescriptor Field(string name) { - var fieldDescriptor = _fields.Find(t => t.Definition.Name.EqualsOrdinal(name)); + var fieldDescriptor = _fields.Find(t => t.Configuration.Name.EqualsOrdinal(name)); if (fieldDescriptor is not null) { @@ -169,14 +169,14 @@ public IInputFieldDescriptor Field(string name) public IInputObjectTypeDescriptor Directive(T directive) where T : class { - Definition.AddDirective(directive, Context.TypeInspector); + Configuration.AddDirective(directive, Context.TypeInspector); return this; } public IInputObjectTypeDescriptor Directive() where T : class, new() { - Definition.AddDirective(new T(), Context.TypeInspector); + Configuration.AddDirective(new T(), Context.TypeInspector); return this; } @@ -184,7 +184,7 @@ public IInputObjectTypeDescriptor Directive( string name, params ArgumentNode[] arguments) { - Definition.AddDirective(name, arguments); + Configuration.AddDirective(name, arguments); return this; } @@ -200,7 +200,7 @@ public static InputObjectTypeDescriptor FromSchemaType( Type schemaType) { var descriptor = New(context, schemaType); - descriptor.Definition.RuntimeType = typeof(object); + descriptor.Configuration.RuntimeType = typeof(object); return descriptor; } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/InputObjectTypeDescriptor~1.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/InputObjectTypeDescriptor~1.cs index 122144dfd8a..0ef2520fc7c 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/InputObjectTypeDescriptor~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/InputObjectTypeDescriptor~1.cs @@ -15,7 +15,7 @@ public class InputObjectTypeDescriptor protected internal InputObjectTypeDescriptor(IDescriptorContext context) : base(context, typeof(T)) { - Definition.Fields.BindingBehavior = context.Options.DefaultBindingBehavior; + Configuration.Fields.BindingBehavior = context.Options.DefaultBindingBehavior; } protected internal InputObjectTypeDescriptor( @@ -25,7 +25,7 @@ protected internal InputObjectTypeDescriptor( { } - Type IHasRuntimeType.RuntimeType => Definition.RuntimeType; + Type IHasRuntimeType.RuntimeType => Configuration.RuntimeType; protected override void OnCompleteFields( IDictionary fields, @@ -50,7 +50,7 @@ protected override void OnCompleteFields( public IInputObjectTypeDescriptor BindFields( BindingBehavior behavior) { - Definition.Fields.BindingBehavior = behavior; + Configuration.Fields.BindingBehavior = behavior; return this; } @@ -65,7 +65,7 @@ public IInputFieldDescriptor Field( { if (property.ExtractMember() is PropertyInfo p) { - var fieldDescriptor = Fields.FirstOrDefault(t => t.Definition.Property == p); + var fieldDescriptor = Fields.FirstOrDefault(t => t.Configuration.Property == p); if (fieldDescriptor is not null) { diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/InterfaceFieldDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/InterfaceFieldDescriptor.cs index 5ffe1001a04..ab042767f92 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/InterfaceFieldDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/InterfaceFieldDescriptor.cs @@ -24,7 +24,7 @@ protected internal InterfaceFieldDescriptor( string fieldName) : base(context) { - Definition.Name = fieldName; + Configuration.Name = fieldName; } protected internal InterfaceFieldDescriptor( @@ -32,7 +32,7 @@ protected internal InterfaceFieldDescriptor( InterfaceFieldConfiguration definition) : base(context) { - Definition = definition ?? throw new ArgumentNullException(nameof(definition)); + Configuration = definition ?? throw new ArgumentNullException(nameof(definition)); } protected internal InterfaceFieldDescriptor( @@ -42,10 +42,10 @@ protected internal InterfaceFieldDescriptor( { var naming = context.Naming; - Definition.Member = member ?? throw new ArgumentNullException(nameof(member)); - Definition.Name = naming.GetMemberName(member, MemberKind.InterfaceField); - Definition.Description = naming.GetMemberDescription(member, MemberKind.InterfaceField); - Definition.Type = context.TypeInspector.GetOutputReturnTypeRef(member); + Configuration.Member = member ?? throw new ArgumentNullException(nameof(member)); + Configuration.Name = naming.GetMemberName(member, MemberKind.InterfaceField); + Configuration.Description = naming.GetMemberDescription(member, MemberKind.InterfaceField); + Configuration.Type = context.TypeInspector.GetOutputReturnTypeRef(member); if (naming.IsDeprecated(member, out var reason)) { @@ -59,16 +59,16 @@ protected internal InterfaceFieldDescriptor( } } - protected internal override InterfaceFieldConfiguration Definition { get; protected set; } = new(); + protected internal override InterfaceFieldConfiguration Configuration { get; protected set; } = new(); protected override void OnCreateDefinition(InterfaceFieldConfiguration definition) { Context.Descriptors.Push(this); - if (Definition is { AttributesAreApplied: false, Member: not null, }) + if (Configuration is { AttributesAreApplied: false, Member: not null, }) { - Context.TypeInspector.ApplyAttributes(Context, this, Definition.Member); - Definition.AttributesAreApplied = true; + Context.TypeInspector.ApplyAttributes(Context, this, Configuration.Member); + Configuration.AttributesAreApplied = true; } base.OnCreateDefinition(definition); @@ -144,7 +144,7 @@ private void CompleteArguments(InterfaceFieldConfiguration definition) public IInterfaceFieldDescriptor StreamResult(bool hasStreamResult = true) { - Definition.HasStreamResult = hasStreamResult; + Configuration.HasStreamResult = hasStreamResult; return this; } @@ -169,7 +169,7 @@ public IInterfaceFieldDescriptor Resolve(FieldResolverDelegate fieldResolver) throw new ArgumentNullException(nameof(fieldResolver)); } - Definition.Resolver = fieldResolver; + Configuration.Resolver = fieldResolver; return this; } @@ -182,11 +182,11 @@ public IInterfaceFieldDescriptor Resolve( throw new ArgumentNullException(nameof(fieldResolver)); } - Definition.Resolver = fieldResolver; + Configuration.Resolver = fieldResolver; if (resultType is not null) { - Definition.SetMoreSpecificType( + Configuration.SetMoreSpecificType( Context.TypeInspector.GetType(resultType), TypeContext.Output); @@ -200,7 +200,7 @@ public IInterfaceFieldDescriptor Resolve( if (!clrResultType.IsSchemaType()) { - Definition.ResultType = clrResultType; + Configuration.ResultType = clrResultType; } } } @@ -244,14 +244,14 @@ private IInterfaceFieldDescriptor ResolveWithInternal( if (propertyOrMethod is PropertyInfo or MethodInfo) { - Definition.SetMoreSpecificType( + Configuration.SetMoreSpecificType( Context.TypeInspector.GetReturnType(propertyOrMethod), TypeContext.Output); - Definition.ResolverType = resolverType; - Definition.ResolverMember = propertyOrMethod; - Definition.Resolver = null; - Definition.ResultType = propertyOrMethod.GetReturnType(); + Configuration.ResolverType = resolverType; + Configuration.ResolverMember = propertyOrMethod; + Configuration.Resolver = null; + Configuration.ResultType = propertyOrMethod.GetReturnType(); if (propertyOrMethod is MethodInfo m) { @@ -274,7 +274,7 @@ public IInterfaceFieldDescriptor Use(FieldMiddleware middleware) throw new ArgumentNullException(nameof(middleware)); } - Definition.MiddlewareDefinitions.Add(new(middleware)); + Configuration.MiddlewareDefinitions.Add(new(middleware)); return this; } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/InterfaceTypeDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/InterfaceTypeDescriptor.cs index 378f854d78a..d22cbc9af4a 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/InterfaceTypeDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/InterfaceTypeDescriptor.cs @@ -21,16 +21,16 @@ protected InterfaceTypeDescriptor( throw new ArgumentNullException(nameof(clrType)); } - Definition.RuntimeType = clrType; - Definition.Name = context.Naming.GetTypeName(clrType, TypeKind.Interface); - Definition.Description = context.Naming.GetTypeDescription(clrType, TypeKind.Interface); + Configuration.RuntimeType = clrType; + Configuration.Name = context.Naming.GetTypeName(clrType, TypeKind.Interface); + Configuration.Description = context.Naming.GetTypeDescription(clrType, TypeKind.Interface); } protected InterfaceTypeDescriptor( IDescriptorContext context) : base(context) { - Definition.RuntimeType = typeof(object); + Configuration.RuntimeType = typeof(object); } protected InterfaceTypeDescriptor( @@ -38,7 +38,7 @@ protected InterfaceTypeDescriptor( InterfaceTypeConfiguration definition) : base(context) { - Definition = definition ?? throw new ArgumentNullException(nameof(definition)); + Configuration = definition ?? throw new ArgumentNullException(nameof(definition)); foreach (var field in definition.Fields) { @@ -46,7 +46,7 @@ protected InterfaceTypeDescriptor( } } - protected internal override InterfaceTypeConfiguration Definition { get; protected set; } = + protected internal override InterfaceTypeConfiguration Configuration { get; protected set; } = new(); protected ICollection Fields { get; } = @@ -57,13 +57,13 @@ protected override void OnCreateDefinition( { Context.Descriptors.Push(this); - if (!Definition.AttributesAreApplied && Definition.RuntimeType != typeof(object)) + if (!Configuration.AttributesAreApplied && Configuration.RuntimeType != typeof(object)) { Context.TypeInspector.ApplyAttributes( Context, this, - Definition.RuntimeType); - Definition.AttributesAreApplied = true; + Configuration.RuntimeType); + Configuration.AttributesAreApplied = true; } var fields = new Dictionary(); @@ -77,8 +77,8 @@ protected override void OnCreateDefinition( OnCompleteFields(fields, handledMembers); - Definition.Fields.Clear(); - Definition.Fields.AddRange(fields.Values); + Configuration.Fields.Clear(); + Configuration.Fields.AddRange(fields.Values); base.OnCreateDefinition(definition); @@ -93,13 +93,13 @@ protected virtual void OnCompleteFields( public IInterfaceTypeDescriptor Name(string value) { - Definition.Name = value; + Configuration.Name = value; return this; } public IInterfaceTypeDescriptor Description(string value) { - Definition.Description = value; + Configuration.Description = value; return this; } @@ -112,7 +112,7 @@ public IInterfaceTypeDescriptor Implements() TypeResources.InterfaceTypeDescriptor_InterfaceBaseClass); } - Definition.Interfaces.Add( + Configuration.Interfaces.Add( Context.TypeInspector.GetTypeRef(typeof(T), TypeContext.Output)); return this; } @@ -125,7 +125,7 @@ public IInterfaceTypeDescriptor Implements(T type) throw new ArgumentNullException(nameof(type)); } - Definition.Interfaces.Add(new SchemaTypeReference(type)); + Configuration.Interfaces.Add(new SchemaTypeReference(type)); return this; } @@ -136,13 +136,13 @@ public IInterfaceTypeDescriptor Implements(NamedTypeNode type) throw new ArgumentNullException(nameof(type)); } - Definition.Interfaces.Add(TypeReference.Create(type, TypeContext.Output)); + Configuration.Interfaces.Add(TypeReference.Create(type, TypeContext.Output)); return this; } public IInterfaceFieldDescriptor Field(string name) { - var fieldDescriptor = Fields.FirstOrDefault(t => t.Definition.Name.EqualsOrdinal(name)); + var fieldDescriptor = Fields.FirstOrDefault(t => t.Configuration.Name.EqualsOrdinal(name)); if (fieldDescriptor is not null) { @@ -157,7 +157,7 @@ public IInterfaceFieldDescriptor Field(string name) public IInterfaceTypeDescriptor ResolveAbstractType( ResolveAbstractType typeResolver) { - Definition.ResolveAbstractType = typeResolver + Configuration.ResolveAbstractType = typeResolver ?? throw new ArgumentNullException(nameof(typeResolver)); return this; } @@ -165,20 +165,20 @@ public IInterfaceTypeDescriptor ResolveAbstractType( public IInterfaceTypeDescriptor Directive(T directiveInstance) where T : class { - Definition.AddDirective(directiveInstance, Context.TypeInspector); + Configuration.AddDirective(directiveInstance, Context.TypeInspector); return this; } public IInterfaceTypeDescriptor Directive() where T : class, new() { - Definition.AddDirective(new T(), Context.TypeInspector); + Configuration.AddDirective(new T(), Context.TypeInspector); return this; } public IInterfaceTypeDescriptor Directive(string name, params ArgumentNode[] arguments) { - Definition.AddDirective(name, arguments); + Configuration.AddDirective(name, arguments); return this; } @@ -194,7 +194,7 @@ public static InterfaceTypeDescriptor FromSchemaType( IDescriptorContext context, Type schemaType) { var descriptor = New(context, schemaType); - descriptor.Definition.RuntimeType = typeof(object); + descriptor.Configuration.RuntimeType = typeof(object); return descriptor; } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/InterfaceTypeDescriptor~1.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/InterfaceTypeDescriptor~1.cs index 05359b57062..0188d05fef1 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/InterfaceTypeDescriptor~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/InterfaceTypeDescriptor~1.cs @@ -16,7 +16,7 @@ public class InterfaceTypeDescriptor protected internal InterfaceTypeDescriptor(IDescriptorContext context) : base(context, typeof(T)) { - Definition.Fields.BindingBehavior = context.Options.DefaultBindingBehavior; + Configuration.Fields.BindingBehavior = context.Options.DefaultBindingBehavior; } protected internal InterfaceTypeDescriptor( @@ -26,13 +26,13 @@ protected internal InterfaceTypeDescriptor( { } - Type IHasRuntimeType.RuntimeType => Definition.RuntimeType; + Type IHasRuntimeType.RuntimeType => Configuration.RuntimeType; protected override void OnCompleteFields( IDictionary fields, ISet handledMembers) { - if (Definition.Fields.IsImplicitBinding()) + if (Configuration.Fields.IsImplicitBinding()) { FieldDescriptorUtilities.AddImplicitFields( this, @@ -59,7 +59,7 @@ protected override void OnCompleteFields( public IInterfaceTypeDescriptor BindFields( BindingBehavior behavior) { - Definition.Fields.BindingBehavior = behavior; + Configuration.Fields.BindingBehavior = behavior; return this; } @@ -100,7 +100,7 @@ public IInterfaceFieldDescriptor Field( var member = propertyOrMethod.ExtractMember(); if (member is PropertyInfo or MethodInfo) { - var fieldDescriptor = Fields.FirstOrDefault(t => t.Definition.Member == member); + var fieldDescriptor = Fields.FirstOrDefault(t => t.Configuration.Member == member); if (fieldDescriptor is not null) { diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/ObjectFieldDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/ObjectFieldDescriptor.cs index 0cec64373b0..3c96e02c0c1 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/ObjectFieldDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/ObjectFieldDescriptor.cs @@ -18,7 +18,7 @@ namespace HotChocolate.Types.Descriptors; public class ObjectFieldDescriptor : OutputFieldDescriptorBase - , IObjectFieldDescriptor + , IObjectFieldDescriptor { private bool _argumentsInitialized; private ParameterInfo[] _parameterInfos = []; @@ -31,9 +31,9 @@ protected ObjectFieldDescriptor( string fieldName) : base(context) { - Definition.Name = fieldName; - Definition.ResultType = typeof(object); - Definition.IsParallelExecutable = + Configuration.Name = fieldName; + Configuration.ResultType = typeof(object); + Configuration.IsParallelExecutable = context.Options.DefaultResolverStrategy is ExecutionStrategy.Parallel; } @@ -48,15 +48,15 @@ protected ObjectFieldDescriptor( : base(context) { var naming = context.Naming; - Definition.Member = member ?? throw new ArgumentNullException(nameof(member)); - Definition.Name = naming.GetMemberName(member, MemberKind.ObjectField); - Definition.Description = naming.GetMemberDescription(member, MemberKind.ObjectField); - Definition.Type = context.TypeInspector.GetOutputReturnTypeRef(member); - Definition.SourceType = sourceType; - Definition.ResolverType = resolverType == sourceType + Configuration.Member = member ?? throw new ArgumentNullException(nameof(member)); + Configuration.Name = naming.GetMemberName(member, MemberKind.ObjectField); + Configuration.Description = naming.GetMemberDescription(member, MemberKind.ObjectField); + Configuration.Type = context.TypeInspector.GetOutputReturnTypeRef(member); + Configuration.SourceType = sourceType; + Configuration.ResolverType = resolverType == sourceType ? null : resolverType; - Definition.IsParallelExecutable = + Configuration.IsParallelExecutable = context.Options.DefaultResolverStrategy is ExecutionStrategy.Parallel; if (naming.IsDeprecated(member, out var reason)) @@ -68,11 +68,11 @@ protected ObjectFieldDescriptor( { _parameterInfos = m.GetParameters(); Parameters = _parameterInfos.ToDictionary(t => t.Name!, StringComparer.Ordinal); - Definition.ResultType = m.ReturnType; + Configuration.ResultType = m.ReturnType; } else if (member is PropertyInfo p) { - Definition.ResultType = p.PropertyType; + Configuration.ResultType = p.PropertyType; } } @@ -86,10 +86,10 @@ protected ObjectFieldDescriptor( Type? resolverType = null) : base(context) { - Definition.Expression = expression ?? throw new ArgumentNullException(nameof(expression)); - Definition.SourceType = sourceType; - Definition.ResolverType = resolverType; - Definition.IsParallelExecutable = + Configuration.Expression = expression ?? throw new ArgumentNullException(nameof(expression)); + Configuration.SourceType = sourceType; + Configuration.ResolverType = resolverType; + Configuration.IsParallelExecutable = context.Options.DefaultResolverStrategy is ExecutionStrategy.Parallel; var member = expression.TryExtractCallMember(); @@ -97,9 +97,9 @@ protected ObjectFieldDescriptor( if (member is not null) { var naming = context.Naming; - Definition.Name = naming.GetMemberName(member, MemberKind.ObjectField); - Definition.Description = naming.GetMemberDescription(member, MemberKind.ObjectField); - Definition.Type = context.TypeInspector.GetOutputReturnTypeRef(member); + Configuration.Name = naming.GetMemberName(member, MemberKind.ObjectField); + Configuration.Description = naming.GetMemberDescription(member, MemberKind.ObjectField); + Configuration.Type = context.TypeInspector.GetOutputReturnTypeRef(member); if (naming.IsDeprecated(member, out var reason)) { @@ -108,17 +108,17 @@ protected ObjectFieldDescriptor( if (member is MethodInfo m) { - Definition.ResultType = m.ReturnType; + Configuration.ResultType = m.ReturnType; } else if (member is PropertyInfo p) { - Definition.ResultType = p.PropertyType; + Configuration.ResultType = p.PropertyType; } } else { - Definition.Type = context.TypeInspector.GetOutputTypeRef(expression.ReturnType); - Definition.ResultType = expression.ReturnType; + Configuration.Type = context.TypeInspector.GetOutputTypeRef(expression.ReturnType); + Configuration.ResultType = expression.ReturnType; } } @@ -130,10 +130,10 @@ protected ObjectFieldDescriptor( ObjectFieldConfiguration definition) : base(context) { - Definition = definition ?? throw new ArgumentNullException(nameof(definition)); + Configuration = definition ?? throw new ArgumentNullException(nameof(definition)); } - protected internal override ObjectFieldConfiguration Definition { get; protected set; } = new(); + protected internal override ObjectFieldConfiguration Configuration { get; protected set; } = new(); /// protected override void OnCreateDefinition(ObjectFieldConfiguration definition) @@ -142,10 +142,10 @@ protected override void OnCreateDefinition(ObjectFieldConfiguration definition) var member = definition.ResolverMember ?? definition.Member; - if (!Definition.AttributesAreApplied && member is not null) + if (!Configuration.AttributesAreApplied && member is not null) { Context.TypeInspector.ApplyAttributes(Context, this, member); - Definition.AttributesAreApplied = true; + Configuration.AttributesAreApplied = true; } base.OnCreateDefinition(definition); @@ -229,9 +229,9 @@ private void CompleteArguments(ObjectFieldConfiguration definition) continue; } - Definition.Flags |= FieldFlags.WithRequirements; - Definition.ContextData[FieldRequirementsSyntax] = requirements; - Definition.ContextData[FieldRequirementsEntity] = parameter.ParameterType; + Configuration.Flags |= FieldFlags.WithRequirements; + Configuration.ContextData[FieldRequirementsSyntax] = requirements; + Configuration.ContextData[FieldRequirementsEntity] = parameter.ParameterType; } } @@ -300,7 +300,7 @@ private void CompleteArguments(ObjectFieldConfiguration definition) /// public IObjectFieldDescriptor StreamResult(bool hasStreamResult = true) { - Definition.HasStreamResult = hasStreamResult; + Configuration.HasStreamResult = hasStreamResult; return this; } @@ -328,7 +328,7 @@ public IObjectFieldDescriptor Resolve(FieldResolverDelegate fieldResolver) throw new ArgumentNullException(nameof(fieldResolver)); } - Definition.Resolver = fieldResolver; + Configuration.Resolver = fieldResolver; return this; } @@ -342,11 +342,11 @@ public IObjectFieldDescriptor Resolve( throw new ArgumentNullException(nameof(fieldResolver)); } - Definition.Resolver = fieldResolver; + Configuration.Resolver = fieldResolver; if (resultType is not null) { - Definition.SetMoreSpecificType( + Configuration.SetMoreSpecificType( Context.TypeInspector.GetType(resultType), TypeContext.Output); @@ -360,7 +360,7 @@ public IObjectFieldDescriptor Resolve( if (!clrResultType.IsSchemaType()) { - Definition.ResultType = clrResultType; + Configuration.ResultType = clrResultType; } } } @@ -406,14 +406,14 @@ private IObjectFieldDescriptor ResolveWithInternal( if (propertyOrMethod is PropertyInfo or MethodInfo) { - Definition.SetMoreSpecificType( + Configuration.SetMoreSpecificType( Context.TypeInspector.GetReturnType(propertyOrMethod), TypeContext.Output); - Definition.ResolverType = resolverType; - Definition.ResolverMember = propertyOrMethod; - Definition.Resolver = null; - Definition.ResultType = propertyOrMethod.GetReturnType(); + Configuration.ResolverType = resolverType; + Configuration.ResolverMember = propertyOrMethod; + Configuration.Resolver = null; + Configuration.ResultType = propertyOrMethod.GetReturnType(); if (propertyOrMethod is MethodInfo m) { @@ -432,7 +432,7 @@ private IObjectFieldDescriptor ResolveWithInternal( /// public IObjectFieldDescriptor Subscribe(SubscribeResolverDelegate subscribeResolver) { - Definition.SubscribeResolver = subscribeResolver; + Configuration.SubscribeResolver = subscribeResolver; return this; } @@ -444,7 +444,7 @@ public IObjectFieldDescriptor Use(FieldMiddleware middleware) throw new ArgumentNullException(nameof(middleware)); } - Definition.MiddlewareDefinitions.Add(new(middleware)); + Configuration.MiddlewareDefinitions.Add(new(middleware)); return this; } @@ -482,15 +482,15 @@ public IObjectFieldDescriptor ParentRequires(string? requires) { if (!(requires?.Length > 0)) { - Definition.Flags &= ~FieldFlags.WithRequirements; - Definition.ContextData.Remove(FieldRequirementsSyntax); - Definition.ContextData.Remove(FieldRequirementsEntity); + Configuration.Flags &= ~FieldFlags.WithRequirements; + Configuration.ContextData.Remove(FieldRequirementsSyntax); + Configuration.ContextData.Remove(FieldRequirementsEntity); return this; } - Definition.Flags |= FieldFlags.WithRequirements; - Definition.ContextData[FieldRequirementsSyntax] = requires; - Definition.ContextData[FieldRequirementsEntity] = typeof(TParent); + Configuration.Flags |= FieldFlags.WithRequirements; + Configuration.ContextData[FieldRequirementsSyntax] = requires; + Configuration.ContextData[FieldRequirementsEntity] = typeof(TParent); return this; } @@ -498,15 +498,15 @@ public IObjectFieldDescriptor ParentRequires(string? requires) { if (!(requires?.Length > 0)) { - Definition.Flags &= ~FieldFlags.WithRequirements; - Definition.ContextData.Remove(FieldRequirementsSyntax); - Definition.ContextData.Remove(FieldRequirementsEntity); + Configuration.Flags &= ~FieldFlags.WithRequirements; + Configuration.ContextData.Remove(FieldRequirementsSyntax); + Configuration.ContextData.Remove(FieldRequirementsEntity); return this; } - Definition.Flags |= FieldFlags.WithRequirements; - Definition.ContextData[FieldRequirementsSyntax] = requires; - Definition.ContextData[FieldRequirementsEntity] = Definition.SourceType; + Configuration.Flags |= FieldFlags.WithRequirements; + Configuration.ContextData[FieldRequirementsSyntax] = requires; + Configuration.ContextData[FieldRequirementsEntity] = Configuration.SourceType; return this; } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/ObjectTypeDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/ObjectTypeDescriptor.cs index 5a7b600f40b..f98063fa27c 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/ObjectTypeDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/ObjectTypeDescriptor.cs @@ -25,15 +25,15 @@ protected ObjectTypeDescriptor(IDescriptorContext context, Type clrType) throw new ArgumentNullException(nameof(clrType)); } - Definition.RuntimeType = clrType; - Definition.Name = context.Naming.GetTypeName(clrType, TypeKind.Object); - Definition.Description = context.Naming.GetTypeDescription(clrType, TypeKind.Object); + Configuration.RuntimeType = clrType; + Configuration.Name = context.Naming.GetTypeName(clrType, TypeKind.Object); + Configuration.Description = context.Naming.GetTypeDescription(clrType, TypeKind.Object); } protected ObjectTypeDescriptor(IDescriptorContext context) : base(context) { - Definition.RuntimeType = typeof(object); + Configuration.RuntimeType = typeof(object); } protected ObjectTypeDescriptor( @@ -41,7 +41,7 @@ protected ObjectTypeDescriptor( ObjectTypeConfiguration definition) : base(context) { - Definition = definition ?? throw new ArgumentNullException(nameof(definition)); + Configuration = definition ?? throw new ArgumentNullException(nameof(definition)); foreach (var field in definition.Fields) { @@ -49,7 +49,7 @@ protected ObjectTypeDescriptor( } } - protected internal override ObjectTypeConfiguration Definition { get; protected set; } = new(); + protected internal override ObjectTypeConfiguration Configuration { get; protected set; } = new(); protected ICollection Fields => _fields; @@ -58,16 +58,16 @@ protected override void OnCreateDefinition( { Context.Descriptors.Push(this); - if (Definition is { AttributesAreApplied: false, FieldBindingType: not null, }) + if (Configuration is { AttributesAreApplied: false, FieldBindingType: not null, }) { Context.TypeInspector.ApplyAttributes( Context, this, - Definition.FieldBindingType); + Configuration.FieldBindingType); - if (Definition.AttributeBindingTypes.Length > 0) + if (Configuration.AttributeBindingTypes.Length > 0) { - foreach (var type in Definition.AttributeBindingTypes) + foreach (var type in Configuration.AttributeBindingTypes) { Context.TypeInspector.ApplyAttributes( Context, @@ -76,18 +76,18 @@ protected override void OnCreateDefinition( } } - Definition.AttributesAreApplied = true; + Configuration.AttributesAreApplied = true; } foreach (var field in _fields) { - if (field.Definition.Ignore) + if (field.Configuration.Ignore) { // if this definition is used for a type extension we need a // binding to a field which shall be ignored. In case this is a // definition for the type it will be ignored by the type initialization. - Definition.FieldIgnores.Add( - new ObjectFieldBinding(field.Definition.Name, ObjectFieldBindingType.Field)); + Configuration.FieldIgnores.Add( + new ObjectFieldBinding(field.Configuration.Name, ObjectFieldBindingType.Field)); } } @@ -113,13 +113,13 @@ protected override void OnCreateDefinition( // if we find fields that match field name that are ignored we will // remove them from the field map. - foreach (var ignore in Definition.GetFieldIgnores()) + foreach (var ignore in Configuration.GetFieldIgnores()) { fields.Remove(ignore.Name); } - Definition.Fields.Clear(); - Definition.Fields.AddRange(fields.Values); + Configuration.Fields.Clear(); + Configuration.Fields.AddRange(fields.Values); TypeMemHelper.Return(fields); TypeMemHelper.Return(handledMembers); @@ -149,14 +149,14 @@ private protected void InferFieldsFromFieldBindingType( HashSet? subscribeRes = null; Dictionary? subscribeResLook = null; - if (Definition.Fields.IsImplicitBinding() && - Definition.FieldBindingType is not null) + if (Configuration.Fields.IsImplicitBinding() && + Configuration.FieldBindingType is not null) { var inspector = Context.TypeInspector; var naming = Context.Naming; - var type = Definition.FieldBindingType; - var isExtension = Definition.IsExtension; - var includeStatic = (Definition.FieldBindingFlags & Static) == Static; + var type = Configuration.FieldBindingType; + var isExtension = Configuration.IsExtension; + var includeStatic = (Configuration.FieldBindingFlags & Static) == Static; var members = inspector.GetMembers(type, isExtension, includeStatic); foreach (var member in members) @@ -170,13 +170,13 @@ private protected void InferFieldsFromFieldBindingType( var descriptor = ObjectFieldDescriptor.New( Context, member, - Definition.RuntimeType, + Configuration.RuntimeType, type); if (subscribeResLook is not null && subscribeResLook.TryGetValue(member, out var with)) { - descriptor.Definition.SubscribeWith = with; + descriptor.Configuration.SubscribeWith = with; } if (isExtension && inspector.IsMemberIgnored(member)) @@ -239,13 +239,13 @@ protected virtual void OnCompleteFields( public IObjectTypeDescriptor Name(string value) { - Definition.Name = value; + Configuration.Name = value; return this; } public IObjectTypeDescriptor Description(string? value) { - Definition.Description = value; + Configuration.Description = value; return this; } @@ -258,7 +258,7 @@ public IObjectTypeDescriptor Implements() ObjectTypeDescriptor_InterfaceBaseClass); } - Definition.Interfaces.Add( + Configuration.Interfaces.Add( Context.TypeInspector.GetTypeRef(typeof(T))); return this; } @@ -271,7 +271,7 @@ public IObjectTypeDescriptor Implements(T type) throw new ArgumentNullException(nameof(type)); } - Definition.Interfaces.Add(new SchemaTypeReference(type)); + Configuration.Interfaces.Add(new SchemaTypeReference(type)); return this; } @@ -283,19 +283,19 @@ public IObjectTypeDescriptor Implements(NamedTypeNode type) throw new ArgumentNullException(nameof(type)); } - Definition.Interfaces.Add(TypeReference.Create(type, TypeContext.Output)); + Configuration.Interfaces.Add(TypeReference.Create(type, TypeContext.Output)); return this; } public IObjectTypeDescriptor IsOfType(IsOfType? isOfType) { - Definition.IsOfType = isOfType ?? throw new ArgumentNullException(nameof(isOfType)); + Configuration.IsOfType = isOfType ?? throw new ArgumentNullException(nameof(isOfType)); return this; } public IObjectFieldDescriptor Field(string name) { - var fieldDescriptor = _fields.Find(t => t.Definition.Name.EqualsOrdinal(name)); + var fieldDescriptor = _fields.Find(t => t.Configuration.Name.EqualsOrdinal(name)); if (fieldDescriptor is not null) { @@ -321,7 +321,7 @@ public IObjectFieldDescriptor Field( if (propertyOrMethod is PropertyInfo || propertyOrMethod is MethodInfo) { - var fieldDescriptor = _fields.Find(t => t.Definition.Member == propertyOrMethod); + var fieldDescriptor = _fields.Find(t => t.Configuration.Member == propertyOrMethod); if (fieldDescriptor is not null) { @@ -331,8 +331,8 @@ public IObjectFieldDescriptor Field( fieldDescriptor = ObjectFieldDescriptor.New( Context, propertyOrMethod, - Definition.RuntimeType, - propertyOrMethod.ReflectedType ?? Definition.RuntimeType); + Configuration.RuntimeType, + propertyOrMethod.ReflectedType ?? Configuration.RuntimeType); _fields.Add(fieldDescriptor); return fieldDescriptor; } @@ -354,7 +354,7 @@ public IObjectFieldDescriptor Field( if (member is PropertyInfo or MethodInfo) { - var fieldDescriptor = _fields.Find(t => t.Definition.Member == member); + var fieldDescriptor = _fields.Find(t => t.Configuration.Member == member); if (fieldDescriptor is not null) { @@ -364,7 +364,7 @@ public IObjectFieldDescriptor Field( fieldDescriptor = ObjectFieldDescriptor.New( Context, member, - Definition.RuntimeType, + Configuration.RuntimeType, typeof(TResolver)); _fields.Add(fieldDescriptor); return fieldDescriptor; @@ -375,7 +375,7 @@ public IObjectFieldDescriptor Field( var fieldDescriptor = ObjectFieldDescriptor.New( Context, propertyOrMethod, - Definition.RuntimeType, + Configuration.RuntimeType, typeof(TResolver)); _fields.Add(fieldDescriptor); return fieldDescriptor; @@ -389,32 +389,32 @@ public IObjectFieldDescriptor Field( public IObjectTypeDescriptor Directive(T directiveInstance) where T : class { - Definition.AddDirective(directiveInstance, Context.TypeInspector); + Configuration.AddDirective(directiveInstance, Context.TypeInspector); return this; } public IObjectTypeDescriptor Directive() where T : class, new() { - Definition.AddDirective(new T(), Context.TypeInspector); + Configuration.AddDirective(new T(), Context.TypeInspector); return this; } public IObjectTypeDescriptor Directive(string name, params ArgumentNode[] arguments) { - Definition.AddDirective(name, arguments); + Configuration.AddDirective(name, arguments); return this; } public IObjectTypeDescriptor ExtendsType(Type extendsType) { - Definition.ExtendsType = extendsType; + Configuration.ExtendsType = extendsType; return this; } public IObjectTypeDescriptor ExtendsType() { - Definition.ExtendsType = typeof(T); + Configuration.ExtendsType = typeof(T); return this; } @@ -438,7 +438,7 @@ public static ObjectTypeExtensionDescriptor NewExtension( public static ObjectTypeDescriptor FromSchemaType( IDescriptorContext context, Type schemaType) => - new(context, schemaType) { Definition = { RuntimeType = typeof(object), }, }; + new(context, schemaType) { Configuration = { RuntimeType = typeof(object), }, }; public static ObjectTypeDescriptor From( IDescriptorContext context, diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/ObjectTypeDescriptorBase~1.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/ObjectTypeDescriptorBase~1.cs index 3b181c71700..52231e0cfb9 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/ObjectTypeDescriptorBase~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/ObjectTypeDescriptorBase~1.cs @@ -25,7 +25,7 @@ protected ObjectTypeDescriptorBase( ObjectTypeConfiguration definition) : base(context, definition) { } - Type IHasRuntimeType.RuntimeType => Definition.RuntimeType; + Type IHasRuntimeType.RuntimeType => Configuration.RuntimeType; protected override void OnCompleteFields( IDictionary fields, @@ -51,7 +51,7 @@ protected override void OnCompleteFields( public IObjectTypeDescriptor BindFields( BindingBehavior behavior) { - if (behavior == Definition.Fields.BindingBehavior) + if (behavior == Configuration.Fields.BindingBehavior) { // nothing changed so we just return! return this; @@ -59,13 +59,13 @@ public IObjectTypeDescriptor BindFields( if (behavior == BindingBehavior.Explicit) { - Definition.Fields.BindingBehavior = BindingBehavior.Explicit; - Definition.FieldBindingFlags = Default; + Configuration.Fields.BindingBehavior = BindingBehavior.Explicit; + Configuration.FieldBindingFlags = Default; } else { - Definition.Fields.BindingBehavior = BindingBehavior.Implicit; - Definition.FieldBindingFlags = Instance; + Configuration.Fields.BindingBehavior = BindingBehavior.Implicit; + Configuration.FieldBindingFlags = Instance; } return this; @@ -74,7 +74,7 @@ public IObjectTypeDescriptor BindFields( public IObjectTypeDescriptor BindFields( FieldBindingFlags bindingFlags) { - if (bindingFlags == Definition.FieldBindingFlags) + if (bindingFlags == Configuration.FieldBindingFlags) { // nothing changed so we just return! return this; @@ -82,13 +82,13 @@ public IObjectTypeDescriptor BindFields( if (bindingFlags == Default) { - Definition.Fields.BindingBehavior = BindingBehavior.Explicit; - Definition.FieldBindingFlags = Default; + Configuration.Fields.BindingBehavior = BindingBehavior.Explicit; + Configuration.FieldBindingFlags = Default; } else { - Definition.Fields.BindingBehavior = BindingBehavior.Implicit; - Definition.FieldBindingFlags = bindingFlags; + Configuration.Fields.BindingBehavior = BindingBehavior.Implicit; + Configuration.FieldBindingFlags = bindingFlags; } return this; diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/ObjectTypeDescriptor~1.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/ObjectTypeDescriptor~1.cs index 39486a351bd..218083170c0 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/ObjectTypeDescriptor~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/ObjectTypeDescriptor~1.cs @@ -7,8 +7,8 @@ public class ObjectTypeDescriptor : ObjectTypeDescriptorBase protected internal ObjectTypeDescriptor(IDescriptorContext context) : base(context, typeof(T)) { - Definition.Fields.BindingBehavior = context.Options.DefaultBindingBehavior; - Definition.FieldBindingFlags = context.Options.DefaultFieldBindingFlags; + Configuration.Fields.BindingBehavior = context.Options.DefaultBindingBehavior; + Configuration.FieldBindingFlags = context.Options.DefaultFieldBindingFlags; } protected internal ObjectTypeDescriptor( @@ -16,6 +16,6 @@ protected internal ObjectTypeDescriptor( ObjectTypeConfiguration definition) : base(context, definition) { - Definition = definition; + Configuration = definition; } } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/ObjectTypeExtensionDescriptor~1.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/ObjectTypeExtensionDescriptor~1.cs index 65f31b4150f..108366e1d32 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/ObjectTypeExtensionDescriptor~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/ObjectTypeExtensionDescriptor~1.cs @@ -8,11 +8,11 @@ public class ObjectTypeExtensionDescriptor protected internal ObjectTypeExtensionDescriptor(IDescriptorContext context) : base(context) { - Definition.Name = context.Naming.GetTypeName(typeof(T), TypeKind.Object); - Definition.Description = context.Naming.GetTypeDescription(typeof(T), TypeKind.Object); - Definition.Fields.BindingBehavior = context.Options.DefaultBindingBehavior; - Definition.FieldBindingFlags = context.Options.DefaultFieldBindingFlags; - Definition.FieldBindingType = typeof(T); - Definition.IsExtension = true; + Configuration.Name = context.Naming.GetTypeName(typeof(T), TypeKind.Object); + Configuration.Description = context.Naming.GetTypeDescription(typeof(T), TypeKind.Object); + Configuration.Fields.BindingBehavior = context.Options.DefaultBindingBehavior; + Configuration.FieldBindingFlags = context.Options.DefaultFieldBindingFlags; + Configuration.FieldBindingType = typeof(T); + Configuration.IsExtension = true; } } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/OutputFieldDescriptorBase.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/OutputFieldDescriptorBase.cs index f728ae9fe4e..68d8e456dc8 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/OutputFieldDescriptorBase.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/OutputFieldDescriptorBase.cs @@ -36,16 +36,16 @@ protected override void OnCreateDefinition(TDefinition definition) { foreach (var argument in Arguments) { - Definition.Arguments.Add(argument.CreateConfiguration()); + Configuration.Arguments.Add(argument.CreateConfiguration()); } } } protected void Name(string name) - => Definition.Name = name; + => Configuration.Name = name; protected void Description(string? description) - => Definition.Description = description; + => Configuration.Description = description; protected void Type() where TOutputType : IOutputType @@ -61,7 +61,7 @@ protected void Type(Type type) TypeResources.ObjectFieldDescriptorBase_FieldType); } - Definition.SetMoreSpecificType( + Configuration.SetMoreSpecificType( typeInfo.GetExtendedType(), TypeContext.Output); } @@ -80,7 +80,7 @@ protected void Type(TOutputType outputType) TypeResources.ObjectFieldDescriptorBase_FieldType); } - Definition.Type = new SchemaTypeReference(outputType); + Configuration.Type = new SchemaTypeReference(outputType); } protected void Type(ITypeNode typeNode) @@ -89,7 +89,7 @@ protected void Type(ITypeNode typeNode) { throw new ArgumentNullException(nameof(typeNode)); } - Definition.SetMoreSpecificType(typeNode, TypeContext.Output); + Configuration.SetMoreSpecificType(typeNode, TypeContext.Output); } protected void Argument( @@ -106,14 +106,14 @@ protected void Argument( Parameters.TryGetValue(name, out var parameter); var descriptor = parameter is null - ? Arguments.FirstOrDefault(t => t.Definition.Name.EqualsOrdinal(name)) - : Arguments.FirstOrDefault(t => t.Definition.Parameter == parameter); + ? Arguments.FirstOrDefault(t => t.Configuration.Name.EqualsOrdinal(name)) + : Arguments.FirstOrDefault(t => t.Configuration.Parameter == parameter); - if (descriptor is null && Definition.Arguments.Count > 0) + if (descriptor is null && Configuration.Arguments.Count > 0) { var definition = parameter is null - ? Definition.Arguments.FirstOrDefault(t => t.Name.EqualsOrdinal(name)) - : Definition.Arguments.FirstOrDefault(t => t.Parameter == parameter); + ? Configuration.Arguments.FirstOrDefault(t => t.Name.EqualsOrdinal(name)) + : Configuration.Arguments.FirstOrDefault(t => t.Parameter == parameter); if (definition is not null) { @@ -140,24 +140,24 @@ public void Deprecated(string? reason) } else { - Definition.DeprecationReason = reason; + Configuration.DeprecationReason = reason; } } public void Deprecated() - => Definition.DeprecationReason = DeprecationDefaultReason; + => Configuration.DeprecationReason = DeprecationDefaultReason; protected void Ignore(bool ignore = true) - => Definition.Ignore = ignore; + => Configuration.Ignore = ignore; protected void Directive(T directive) where T : class - => Definition.AddDirective(directive, Context.TypeInspector); + => Configuration.AddDirective(directive, Context.TypeInspector); protected void Directive() where T : class, new() - => Definition.AddDirective(new T(), Context.TypeInspector); + => Configuration.AddDirective(new T(), Context.TypeInspector); protected void Directive(string name, params ArgumentNode[] arguments) - => Definition.AddDirective(name, arguments); + => Configuration.AddDirective(name, arguments); } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/ScalarTypeDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/ScalarTypeDescriptor.cs index 9b9b36af7b8..4f5519e1a4b 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/ScalarTypeDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/ScalarTypeDescriptor.cs @@ -15,20 +15,20 @@ protected ScalarTypeDescriptor(IDescriptorContext context) { } - protected internal override ScalarTypeConfiguration Definition { get; protected set; } = new(); + protected internal override ScalarTypeConfiguration Configuration { get; protected set; } = new(); protected override void OnCreateDefinition(ScalarTypeConfiguration definition) { Context.Descriptors.Push(this); - if (!Definition.AttributesAreApplied && - Definition.RuntimeType != typeof(object)) + if (!Configuration.AttributesAreApplied && + Configuration.RuntimeType != typeof(object)) { Context.TypeInspector.ApplyAttributes( Context, this, - Definition.RuntimeType); - Definition.AttributesAreApplied = true; + Configuration.RuntimeType); + Configuration.AttributesAreApplied = true; } base.OnCreateDefinition(definition); @@ -39,20 +39,20 @@ protected override void OnCreateDefinition(ScalarTypeConfiguration definition) public IScalarTypeDescriptor Directive(T directiveInstance) where T : class { - Definition.AddDirective(directiveInstance, Context.TypeInspector); + Configuration.AddDirective(directiveInstance, Context.TypeInspector); return this; } public IScalarTypeDescriptor Directive() where T : class, new() { - Definition.AddDirective(new T(), Context.TypeInspector); + Configuration.AddDirective(new T(), Context.TypeInspector); return this; } public IScalarTypeDescriptor Directive(string name, params ArgumentNode[] arguments) { - Definition.AddDirective(name, arguments); + Configuration.AddDirective(name, arguments); return this; } @@ -61,5 +61,5 @@ public static ScalarTypeDescriptor New( string name, string? description, Type scalarType) - => new(context) { Definition = { Name = name, Description = description, RuntimeType = scalarType } }; + => new(context) { Configuration = { Name = name, Description = description, RuntimeType = scalarType } }; } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/SchemaTypeDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/SchemaTypeDescriptor.cs index 65b1f424332..fb362d810f1 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/SchemaTypeDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/SchemaTypeDescriptor.cs @@ -15,7 +15,7 @@ protected SchemaTypeDescriptor(IDescriptorContext context, Type type) { throw new ArgumentNullException(nameof(type)); } - Definition.Name = context.Naming.GetTypeName(type); + Configuration.Name = context.Naming.GetTypeName(type); } protected SchemaTypeDescriptor( @@ -23,34 +23,34 @@ protected SchemaTypeDescriptor( SchemaTypeConfiguration definition) : base(context) { - Definition = definition; + Configuration = definition; } - protected internal override SchemaTypeConfiguration Definition { get; protected set; } = new(); + protected internal override SchemaTypeConfiguration Configuration { get; protected set; } = new(); public ISchemaTypeDescriptor Name(string value) { - Definition.Name = value; + Configuration.Name = value; return this; } public ISchemaTypeDescriptor Description(string value) { - Definition.Description = value; + Configuration.Description = value; return this; } public ISchemaTypeDescriptor Directive(T directiveInstance) where T : class { - Definition.GetLegacyDefinition().AddDirective(directiveInstance, Context.TypeInspector); + Configuration.GetLegacyDefinition().AddDirective(directiveInstance, Context.TypeInspector); return this; } public ISchemaTypeDescriptor Directive() where T : class, new() { - Definition.GetLegacyDefinition().AddDirective(new T(), Context.TypeInspector); + Configuration.GetLegacyDefinition().AddDirective(new T(), Context.TypeInspector); return this; } @@ -58,7 +58,7 @@ public ISchemaTypeDescriptor Directive( string name, params ArgumentNode[] arguments) { - Definition.GetLegacyDefinition().AddDirective(name, arguments); + Configuration.GetLegacyDefinition().AddDirective(name, arguments); return this; } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/UnionTypeDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/UnionTypeDescriptor.cs index 4f9cc65aad9..fc703593340 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/UnionTypeDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/UnionTypeDescriptor.cs @@ -16,9 +16,9 @@ protected UnionTypeDescriptor(IDescriptorContext context, Type clrType) throw new ArgumentNullException(nameof(clrType)); } - Definition.RuntimeType = clrType; - Definition.Name = context.Naming.GetTypeName(clrType, TypeKind.Union); - Definition.Description = context.Naming.GetTypeDescription(clrType, TypeKind.Union); + Configuration.RuntimeType = clrType; + Configuration.Name = context.Naming.GetTypeName(clrType, TypeKind.Union); + Configuration.Description = context.Naming.GetTypeDescription(clrType, TypeKind.Union); } protected UnionTypeDescriptor( @@ -26,25 +26,25 @@ protected UnionTypeDescriptor( UnionTypeConfiguration definition) : base(context) { - Definition = definition; + Configuration = definition; } protected UnionTypeDescriptor(IDescriptorContext context) : base(context) { - Definition.RuntimeType = typeof(object); + Configuration.RuntimeType = typeof(object); } - protected internal override UnionTypeConfiguration Definition { get; protected set; } = new(); + protected internal override UnionTypeConfiguration Configuration { get; protected set; } = new(); protected override void OnCreateDefinition(UnionTypeConfiguration definition) { Context.Descriptors.Push(this); - if (!Definition.AttributesAreApplied && Definition.RuntimeType != typeof(object)) + if (!Configuration.AttributesAreApplied && Configuration.RuntimeType != typeof(object)) { - Context.TypeInspector.ApplyAttributes(Context, this, Definition.RuntimeType); - Definition.AttributesAreApplied = true; + Context.TypeInspector.ApplyAttributes(Context, this, Configuration.RuntimeType); + Configuration.AttributesAreApplied = true; } base.OnCreateDefinition(definition); @@ -54,20 +54,20 @@ protected override void OnCreateDefinition(UnionTypeConfiguration definition) public IUnionTypeDescriptor Name(string value) { - Definition.Name = value; + Configuration.Name = value; return this; } public IUnionTypeDescriptor Description(string value) { - Definition.Description = value; + Configuration.Description = value; return this; } public IUnionTypeDescriptor Type() where TObjectType : ObjectType { - Definition.Types.Add( + Configuration.Types.Add( Context.TypeInspector.GetTypeRef(typeof(TObjectType), TypeContext.Output)); return this; } @@ -79,7 +79,7 @@ public IUnionTypeDescriptor Type(TObjectType objectType) { throw new ArgumentNullException(nameof(objectType)); } - Definition.Types.Add(TypeReference.Create(objectType)); + Configuration.Types.Add(TypeReference.Create(objectType)); return this; } @@ -89,14 +89,14 @@ public IUnionTypeDescriptor Type(NamedTypeNode objectType) { throw new ArgumentNullException(nameof(objectType)); } - Definition.Types.Add(TypeReference.Create(objectType, TypeContext.Output)); + Configuration.Types.Add(TypeReference.Create(objectType, TypeContext.Output)); return this; } public IUnionTypeDescriptor ResolveAbstractType( ResolveAbstractType resolveAbstractType) { - Definition.ResolveAbstractType = resolveAbstractType + Configuration.ResolveAbstractType = resolveAbstractType ?? throw new ArgumentNullException(nameof(resolveAbstractType)); return this; } @@ -104,14 +104,14 @@ public IUnionTypeDescriptor ResolveAbstractType( public IUnionTypeDescriptor Directive(T directiveInstance) where T : class { - Definition.AddDirective(directiveInstance, Context.TypeInspector); + Configuration.AddDirective(directiveInstance, Context.TypeInspector); return this; } public IUnionTypeDescriptor Directive() where T : class, new() { - Definition.AddDirective(new T(), Context.TypeInspector); + Configuration.AddDirective(new T(), Context.TypeInspector); return this; } @@ -119,7 +119,7 @@ public IUnionTypeDescriptor Directive( string name, params ArgumentNode[] arguments) { - Definition.AddDirective(name, arguments); + Configuration.AddDirective(name, arguments); return this; } @@ -137,7 +137,7 @@ public static UnionTypeDescriptor FromSchemaType( Type schemaType) { var descriptor = New(context, schemaType); - descriptor.Definition.RuntimeType = typeof(object); + descriptor.Configuration.RuntimeType = typeof(object); return descriptor; } diff --git a/src/HotChocolate/Core/src/Types/Types/Introspection/IntrospectionFields.cs b/src/HotChocolate/Core/src/Types/Types/Introspection/IntrospectionFields.cs index 74959889cf3..c488c36b5af 100644 --- a/src/HotChocolate/Core/src/Types/Types/Introspection/IntrospectionFields.cs +++ b/src/HotChocolate/Core/src/Types/Types/Introspection/IntrospectionFields.cs @@ -35,7 +35,7 @@ internal static ObjectFieldConfiguration CreateSchemaField(IDescriptorContext co .Description(TypeResources.SchemaField_Description) .Type>(); - descriptor.Definition.PureResolver = Resolve; + descriptor.Configuration.PureResolver = Resolve; static ISchema Resolve(IResolverContext ctx) => ctx.Schema; @@ -53,7 +53,7 @@ internal static ObjectFieldConfiguration CreateTypeField(IDescriptorContext cont .Type<__Type>() .Resolve(Resolve); - descriptor.Definition.PureResolver = Resolve; + descriptor.Configuration.PureResolver = Resolve; static INamedType? Resolve(IResolverContext ctx) { diff --git a/src/HotChocolate/Core/src/Types/Types/ObjectType.Initialization.cs b/src/HotChocolate/Core/src/Types/Types/ObjectType.Initialization.cs index 9b7bb9f9c96..f53d0fad527 100644 --- a/src/HotChocolate/Core/src/Types/Types/ObjectType.Initialization.cs +++ b/src/HotChocolate/Core/src/Types/Types/ObjectType.Initialization.cs @@ -31,9 +31,9 @@ protected override ObjectTypeConfiguration CreateDefinition( GetType()); _configure!.Invoke(descriptor); - if (!descriptor.Definition.NeedsNameCompletion) + if (!descriptor.Configuration.NeedsNameCompletion) { - context.DescriptorContext.TypeConfiguration.Apply(descriptor.Definition.Name, descriptor); + context.DescriptorContext.TypeConfiguration.Apply(descriptor.Configuration.Name, descriptor); } return descriptor.CreateConfiguration(); diff --git a/src/HotChocolate/Core/src/Types/Types/Relay/Descriptors/NodeDescriptor.cs b/src/HotChocolate/Core/src/Types/Types/Relay/Descriptors/NodeDescriptor.cs index 8899df898ef..96b469d08cf 100644 --- a/src/HotChocolate/Core/src/Types/Types/Relay/Descriptors/NodeDescriptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Relay/Descriptors/NodeDescriptor.cs @@ -36,7 +36,7 @@ public NodeDescriptor(IObjectTypeDescriptor descriptor, Type? nodeType = null) .Extend() .OnBeforeCompletion(OnCompleteDefinition); - Definition.NodeType = nodeType; + Configuration.NodeType = nodeType; } internal void OnCompleteDefinition( @@ -46,7 +46,7 @@ internal void OnCompleteDefinition( internal void ConfigureNodeField(IObjectTypeDescriptor typeDescriptor) { - if (Definition.IdMember is null) + if (Configuration.IdMember is null) { var descriptor = typeDescriptor .Field(NodeType.Names.Id) @@ -57,7 +57,7 @@ internal void ConfigureNodeField(IObjectTypeDescriptor typeDescriptor) else { var descriptor = typeDescriptor - .Field(Definition.IdMember) + .Field(Configuration.IdMember) .Name(NodeType.Names.Id) .Type>(); @@ -67,7 +67,7 @@ internal void ConfigureNodeField(IObjectTypeDescriptor typeDescriptor) protected override IObjectFieldDescriptor ConfigureNodeField() { - if (Definition.IdMember is null) + if (Configuration.IdMember is null) { var descriptor = _typeDescriptor .Field(NodeType.Names.Id) @@ -78,7 +78,7 @@ protected override IObjectFieldDescriptor ConfigureNodeField() else { var descriptor = _typeDescriptor - .Field(Definition.IdMember) + .Field(Configuration.IdMember) .Name(NodeType.Names.Id) .Type>(); @@ -96,7 +96,7 @@ public INodeDescriptor IdField(MemberInfo propertyOrMethod) if (propertyOrMethod is PropertyInfo or MethodInfo) { - Definition.IdMember = propertyOrMethod; + Configuration.IdMember = propertyOrMethod; return this; } @@ -107,11 +107,11 @@ public INodeDescriptor IdField(MemberInfo propertyOrMethod) public IObjectFieldDescriptor ResolveNode(Type type) => ResolveNodeWith( Context.TypeInspector.GetNodeResolverMethod( - Definition.NodeType ?? type)!); + Configuration.NodeType ?? type)!); internal void TryResolveNode(Type type) { - var resolver = Context.TypeInspector.GetNodeResolverMethod(Definition.NodeType ?? type); + var resolver = Context.TypeInspector.GetNodeResolverMethod(Configuration.NodeType ?? type); if (resolver is not null) { @@ -123,7 +123,7 @@ internal void TryResolveNode(Type type) public IObjectFieldDescriptor ResolveNodeWith() => ResolveNodeWith( Context.TypeInspector.GetNodeResolverMethod( - Definition.NodeType ?? typeof(TResolver), + Configuration.NodeType ?? typeof(TResolver), typeof(TResolver))!); /// () public IObjectFieldDescriptor ResolveNodeWith(Type type) => ResolveNodeWith( Context.TypeInspector.GetNodeResolverMethod( - Definition.NodeType ?? type, + Configuration.NodeType ?? type, type)!); } diff --git a/src/HotChocolate/Core/src/Types/Types/Relay/Descriptors/NodeDescriptorBase.cs b/src/HotChocolate/Core/src/Types/Types/Relay/Descriptors/NodeDescriptorBase.cs index 8dbde929e82..ff28b70083e 100644 --- a/src/HotChocolate/Core/src/Types/Types/Relay/Descriptors/NodeDescriptorBase.cs +++ b/src/HotChocolate/Core/src/Types/Types/Relay/Descriptors/NodeDescriptorBase.cs @@ -16,7 +16,7 @@ namespace HotChocolate.Types.Relay.Descriptors; public abstract class NodeDescriptorBase(IDescriptorContext context) : DescriptorBase(context) { - protected internal sealed override NodeDefinition Definition { get; protected set; } = new(); + protected internal sealed override NodeDefinition Configuration { get; protected set; } = new(); protected abstract IObjectFieldDescriptor ConfigureNodeField(); @@ -29,8 +29,8 @@ public abstract class NodeDescriptorBase(IDescriptorContext context) public virtual IObjectFieldDescriptor ResolveNode( FieldResolverDelegate fieldResolver) { - Definition.ResolverField ??= new ObjectFieldConfiguration(); - Definition.ResolverField.Resolver = fieldResolver ?? + Configuration.ResolverField ??= new ObjectFieldConfiguration(); + Configuration.ResolverField.Resolver = fieldResolver ?? throw new ArgumentNullException(nameof(fieldResolver)); return ConfigureNodeField(); @@ -84,9 +84,9 @@ public IObjectFieldDescriptor ResolveNodeWith( if (member is MethodInfo m) { - Definition.ResolverField ??= new ObjectFieldConfiguration(); - Definition.ResolverField.Member = m; - Definition.ResolverField.ResolverType = typeof(TResolver); + Configuration.ResolverField ??= new ObjectFieldConfiguration(); + Configuration.ResolverField.Member = m; + Configuration.ResolverField.ResolverType = typeof(TResolver); return ConfigureNodeField(); } @@ -108,9 +108,9 @@ public IObjectFieldDescriptor ResolveNodeWith(MethodInfo method) throw new ArgumentNullException(nameof(method)); } - Definition.ResolverField ??= new ObjectFieldConfiguration(); - Definition.ResolverField.Member = method; - Definition.ResolverField.ResolverType = method.DeclaringType ?? typeof(object); + Configuration.ResolverField ??= new ObjectFieldConfiguration(); + Configuration.ResolverField.Member = method; + Configuration.ResolverField.ResolverType = method.DeclaringType ?? typeof(object); return ConfigureNodeField(); } @@ -118,36 +118,36 @@ protected void CompleteResolver(ITypeCompletionContext context, ObjectTypeConfig { var descriptorContext = context.DescriptorContext; - if (Definition.ResolverField is not null) + if (Configuration.ResolverField is not null) { // we let the descriptor complete on the definition object. ObjectFieldDescriptor - .From(descriptorContext, Definition.ResolverField) + .From(descriptorContext, Configuration.ResolverField) .CreateConfiguration(); // after that all middleware should be available on the field definition and we can // start compiling the resolver and the resolver pipeline. - if (Definition.ResolverField.Resolver is null && - Definition.ResolverField.Member is not null) + if (Configuration.ResolverField.Resolver is null && + Configuration.ResolverField.Member is not null) { - Definition.ResolverField.Resolvers = + Configuration.ResolverField.Resolvers = Context.ResolverCompiler.CompileResolve( - Definition.ResolverField.Member, + Configuration.ResolverField.Member, typeof(object), - Definition.ResolverField.ResolverType, + Configuration.ResolverField.ResolverType, parameterExpressionBuilders: ParameterExpressionBuilders); } - if (Definition.ResolverField.Resolver is not null) + if (Configuration.ResolverField.Resolver is not null) { var pipeline = FieldMiddlewareCompiler.Compile( context.GlobalComponents, - Definition.ResolverField.GetMiddlewareDefinitions(), - Definition.ResolverField.GetResultConverters(), - Definition.ResolverField.Resolver, + Configuration.ResolverField.GetMiddlewareDefinitions(), + Configuration.ResolverField.GetResultConverters(), + Configuration.ResolverField.Resolver, false); - var directiveDefs = Definition.ResolverField.GetDirectives(); + var directiveDefs = Configuration.ResolverField.GetDirectives(); if (directiveDefs.Count > 0) { @@ -155,7 +155,7 @@ protected void CompleteResolver(ITypeCompletionContext context, ObjectTypeConfig DirectiveCollection.CreateAndComplete( context, DirectiveLocation.FieldDefinition, - Definition.ResolverField, + Configuration.ResolverField, directiveDefs); foreach (var directive in directives) diff --git a/src/HotChocolate/Core/src/Types/Types/Relay/Descriptors/NodeDescriptor~1.cs b/src/HotChocolate/Core/src/Types/Types/Relay/Descriptors/NodeDescriptor~1.cs index 39001036445..b6158389b25 100644 --- a/src/HotChocolate/Core/src/Types/Types/Relay/Descriptors/NodeDescriptor~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/Relay/Descriptors/NodeDescriptor~1.cs @@ -48,7 +48,7 @@ private void OnCompleteDefinition( ITypeCompletionContext context, ObjectTypeConfiguration definition) { - if (Definition.ResolverField is null) + if (Configuration.ResolverField is null) { var resolverMethod = Context.TypeInspector.GetNodeResolverMethod(typeof(TNode), typeof(TNode)); @@ -72,14 +72,14 @@ private void OnCompleteDefinition( protected override IObjectFieldDescriptor ConfigureNodeField() { - Definition.NodeType = typeof(TNode); + Configuration.NodeType = typeof(TNode); - if (Definition.IdMember is null) + if (Configuration.IdMember is null) { - Definition.IdMember = Context.TypeInspector.GetNodeIdMember(typeof(TNode)); + Configuration.IdMember = Context.TypeInspector.GetNodeIdMember(typeof(TNode)); } - if (Definition.IdMember is null) + if (Configuration.IdMember is null) { var descriptor = _typeDescriptor .Field(NodeType.Names.Id) @@ -90,7 +90,7 @@ protected override IObjectFieldDescriptor ConfigureNodeField() else { var descriptor = _typeDescriptor - .Field(Definition.IdMember) + .Field(Configuration.IdMember) .Name(NodeType.Names.Id) .Type>(); @@ -111,8 +111,8 @@ public INodeDescriptor IdField( if (member is MethodInfo or PropertyInfo) { - Definition.IdMember = member; - return new NodeDescriptor(Context, Definition, ConfigureNodeField); + Configuration.IdMember = member; + return new NodeDescriptor(Context, Configuration, ConfigureNodeField); } throw new ArgumentException(NodeDescriptor_IdMember, nameof(member)); @@ -128,7 +128,7 @@ public INodeDescriptor IdField(MemberInfo propertyOrMethod) if (propertyOrMethod is MethodInfo or PropertyInfo) { - Definition.IdMember = propertyOrMethod; + Configuration.IdMember = propertyOrMethod; return this; } diff --git a/src/HotChocolate/Core/src/Types/Types/Relay/Serialization/BoundNodeIdValueSerializer.cs b/src/HotChocolate/Core/src/Types/Types/Relay/Serialization/BoundNodeIdValueSerializer.cs index 22ab0cf4026..0cafff11416 100644 --- a/src/HotChocolate/Core/src/Types/Types/Relay/Serialization/BoundNodeIdValueSerializer.cs +++ b/src/HotChocolate/Core/src/Types/Types/Relay/Serialization/BoundNodeIdValueSerializer.cs @@ -1,14 +1,19 @@ #nullable enable namespace HotChocolate.Types.Relay; -internal sealed class BoundNodeIdValueSerializer( - string typeName, - INodeIdValueSerializer serializer) - : IEquatable +internal sealed class BoundNodeIdValueSerializer : IEquatable { - public string TypeName { get; } = typeName; + public string TypeName { get; } - public INodeIdValueSerializer Serializer { get; } = serializer; + public INodeIdValueSerializer Serializer { get; } + + public BoundNodeIdValueSerializer( + string typeName, + INodeIdValueSerializer serializer) + { + TypeName = typeName; + Serializer = serializer; + } public bool Equals(BoundNodeIdValueSerializer? other) { diff --git a/src/HotChocolate/Core/src/Types/Utilities/Subscriptions/ObservableSourceStreamAdapter.cs b/src/HotChocolate/Core/src/Types/Utilities/Subscriptions/ObservableSourceStreamAdapter.cs index a81aebedb01..54269e98b47 100644 --- a/src/HotChocolate/Core/src/Types/Utilities/Subscriptions/ObservableSourceStreamAdapter.cs +++ b/src/HotChocolate/Core/src/Types/Utilities/Subscriptions/ObservableSourceStreamAdapter.cs @@ -45,7 +45,7 @@ public async IAsyncEnumerator GetAsyncEnumerator( await _wait.Task.ConfigureAwait(false); } - if (_exception is { }) + if (_exception is not null) { _isCompleted = true; throw _exception; @@ -62,7 +62,7 @@ public void OnCompleted() { _isCompleted = true; - if (_wait != null && !_wait.Task.IsCompleted) + if (_wait is { Task.IsCompleted: false }) { _wait.SetResult(null); } @@ -72,7 +72,7 @@ public void OnError(Exception error) { _exception = error; - if (_wait != null && !_wait.Task.IsCompleted) + if (_wait is { Task.IsCompleted: false }) { _wait.SetResult(null); } @@ -82,7 +82,7 @@ public void OnNext(T value) { _queue.Enqueue(value); - if (_wait != null && !_wait.Task.IsCompleted) + if (_wait is { Task.IsCompleted: false }) { _wait.SetResult(null); } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeTests.GenerateSource_BatchDataLoader_MatchesSnapshot.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeTests.GenerateSource_BatchDataLoader_MatchesSnapshot.md index 01dae28a53a..51b4e1e215f 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeTests.GenerateSource_BatchDataLoader_MatchesSnapshot.md +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeTests.GenerateSource_BatchDataLoader_MatchesSnapshot.md @@ -39,8 +39,8 @@ namespace TestNamespace .Field(thisType.GetMember("GetAuthorAsync", global::HotChocolate.Utilities.ReflectionUtils.StaticMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.GetAuthorAsync(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.GetAuthorAsync(); }, resolvers); diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/OperationTests.Partial_Static_QueryType.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/OperationTests.Partial_Static_QueryType.md index 201a2a36158..ba2183c9270 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/OperationTests.Partial_Static_QueryType.md +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/OperationTests.Partial_Static_QueryType.md @@ -66,8 +66,8 @@ namespace TestNamespace .Field(thisType.GetMember("GetTest", global::HotChocolate.Utilities.ReflectionUtils.StaticMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.GetTest(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.GetTest(); }, resolvers); diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/OperationTests.Root_NodeResolver.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/OperationTests.Root_NodeResolver.md index 3a27558698b..558863843e1 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/OperationTests.Root_NodeResolver.md +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/OperationTests.Root_NodeResolver.md @@ -66,8 +66,8 @@ namespace TestNamespace .Field(thisType.GetMember("GetTest", global::HotChocolate.Utilities.ReflectionUtils.StaticMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.GetTest(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.GetTest(); }, resolvers); diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/OperationTests.Root_Projection_Single_Entity.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/OperationTests.Root_Projection_Single_Entity.md index 78579248333..3dc2aa84e80 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/OperationTests.Root_Projection_Single_Entity.md +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/OperationTests.Root_Projection_Single_Entity.md @@ -66,8 +66,8 @@ namespace TestNamespace .Field(thisType.GetMember("GetTest", global::HotChocolate.Utilities.ReflectionUtils.StaticMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.GetTest(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.GetTest(); }, resolvers); diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_ConnectionFlags.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_ConnectionFlags.md index 6c707518423..926b6c6df33 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_ConnectionFlags.md +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_ConnectionFlags.md @@ -34,9 +34,9 @@ namespace TestNamespace .Type>>() .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionEdgesFieldFlags(); - c.Definition.Resolvers = r.Edges(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionEdgesFieldFlags(); + c.Configuration.Resolvers = r.Edges(); }, resolvers); @@ -44,9 +44,9 @@ namespace TestNamespace .Field(thisType.GetMember("Nodes", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionNodesFieldFlags(); - c.Definition.Resolvers = r.Nodes(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionNodesFieldFlags(); + c.Configuration.Resolvers = r.Nodes(); }, resolvers); @@ -54,8 +54,8 @@ namespace TestNamespace .Field(thisType.GetMember("PageInfo", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.PageInfo(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.PageInfo(); }, resolvers); @@ -63,9 +63,9 @@ namespace TestNamespace .Field(thisType.GetMember("TotalCount", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionTotalCountFieldFlags(); - c.Definition.Resolvers = r.TotalCount(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionTotalCountFieldFlags(); + c.Configuration.Resolvers = r.TotalCount(); }, resolvers); } @@ -147,8 +147,8 @@ namespace TestNamespace .Field(thisType.GetMember("Author", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.Author(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.Author(); }, resolvers); @@ -156,8 +156,8 @@ namespace TestNamespace .Field(thisType.GetMember("Node", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.Node(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.Node(); }, resolvers); @@ -165,8 +165,8 @@ namespace TestNamespace .Field(thisType.GetMember("Cursor", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.Cursor(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.Cursor(); }, resolvers); } @@ -238,12 +238,12 @@ namespace TestNamespace.Types.Root .Type>() .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionFlags(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionFlags(); var pagingOptions = global::HotChocolate.Types.Pagination.PagingHelper.GetPagingOptions(c.Context, null); - c.Definition.State = c.Definition.State.SetItem(HotChocolate.WellKnownContextData.PagingOptions, pagingOptions); - c.Definition.ContextData[HotChocolate.WellKnownContextData.PagingOptions] = pagingOptions; - c.Definition.Resolvers = r.GetAuthorsAsync(); + c.Configuration.State = c.Configuration.State.SetItem(HotChocolate.WellKnownContextData.PagingOptions, pagingOptions); + c.Configuration.ContextData[HotChocolate.WellKnownContextData.PagingOptions] = pagingOptions; + c.Configuration.Resolvers = r.GetAuthorsAsync(); }, resolvers); diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_ConnectionT_MatchesSnapshot.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_ConnectionT_MatchesSnapshot.md index 5fdb3a87eec..01cda62e79e 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_ConnectionT_MatchesSnapshot.md +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_ConnectionT_MatchesSnapshot.md @@ -30,8 +30,8 @@ namespace TestNamespace .Field(thisType.GetMember("GetAuthorsAsync", global::HotChocolate.Utilities.ReflectionUtils.StaticMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.GetAuthorsAsync(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.GetAuthorsAsync(); }, resolvers); diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_CustomConnection_MatchesSnapshot.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_CustomConnection_MatchesSnapshot.md index ef997ccbca1..5d2014b04ad 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_CustomConnection_MatchesSnapshot.md +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_CustomConnection_MatchesSnapshot.md @@ -34,9 +34,9 @@ namespace TestNamespace .Type>>>() .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionEdgesFieldFlags(); - c.Definition.Resolvers = r.Edges(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionEdgesFieldFlags(); + c.Configuration.Resolvers = r.Edges(); }, resolvers); @@ -44,9 +44,9 @@ namespace TestNamespace .Field(thisType.GetMember("Nodes", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionNodesFieldFlags(); - c.Definition.Resolvers = r.Nodes(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionNodesFieldFlags(); + c.Configuration.Resolvers = r.Nodes(); }, resolvers); @@ -54,8 +54,8 @@ namespace TestNamespace .Field(thisType.GetMember("PageInfo", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.PageInfo(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.PageInfo(); }, resolvers); @@ -63,9 +63,9 @@ namespace TestNamespace .Field(thisType.GetMember("TotalCount", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionTotalCountFieldFlags(); - c.Definition.Resolvers = r.TotalCount(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionTotalCountFieldFlags(); + c.Configuration.Resolvers = r.TotalCount(); }, resolvers); } @@ -147,8 +147,8 @@ namespace TestNamespace .Field(thisType.GetMember("Node", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.Node(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.Node(); }, resolvers); @@ -156,8 +156,8 @@ namespace TestNamespace .Field(thisType.GetMember("Cursor", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.Cursor(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.Cursor(); }, resolvers); } @@ -220,12 +220,12 @@ namespace TestNamespace .Type>() .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionFlags(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionFlags(); var pagingOptions = global::HotChocolate.Types.Pagination.PagingHelper.GetPagingOptions(c.Context, null); - c.Definition.State = c.Definition.State.SetItem(HotChocolate.WellKnownContextData.PagingOptions, pagingOptions); - c.Definition.ContextData[HotChocolate.WellKnownContextData.PagingOptions] = pagingOptions; - c.Definition.Resolvers = r.GetAuthorsAsync(); + c.Configuration.State = c.Configuration.State.SetItem(HotChocolate.WellKnownContextData.PagingOptions, pagingOptions); + c.Configuration.ContextData[HotChocolate.WellKnownContextData.PagingOptions] = pagingOptions; + c.Configuration.Resolvers = r.GetAuthorsAsync(); }, resolvers); diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_CustomConnection_No_Duplicates_MatchesSnapshot.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_CustomConnection_No_Duplicates_MatchesSnapshot.md index 9d44c4c1166..f08b57b1ba2 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_CustomConnection_No_Duplicates_MatchesSnapshot.md +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_CustomConnection_No_Duplicates_MatchesSnapshot.md @@ -34,9 +34,9 @@ namespace TestNamespace .Type>>>() .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionEdgesFieldFlags(); - c.Definition.Resolvers = r.Edges(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionEdgesFieldFlags(); + c.Configuration.Resolvers = r.Edges(); }, resolvers); @@ -44,9 +44,9 @@ namespace TestNamespace .Field(thisType.GetMember("Nodes", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionNodesFieldFlags(); - c.Definition.Resolvers = r.Nodes(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionNodesFieldFlags(); + c.Configuration.Resolvers = r.Nodes(); }, resolvers); @@ -54,8 +54,8 @@ namespace TestNamespace .Field(thisType.GetMember("PageInfo", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.PageInfo(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.PageInfo(); }, resolvers); @@ -63,9 +63,9 @@ namespace TestNamespace .Field(thisType.GetMember("TotalCount", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionTotalCountFieldFlags(); - c.Definition.Resolvers = r.TotalCount(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionTotalCountFieldFlags(); + c.Configuration.Resolvers = r.TotalCount(); }, resolvers); } @@ -147,8 +147,8 @@ namespace TestNamespace .Field(thisType.GetMember("Node", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.Node(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.Node(); }, resolvers); @@ -156,8 +156,8 @@ namespace TestNamespace .Field(thisType.GetMember("Cursor", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.Cursor(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.Cursor(); }, resolvers); } @@ -220,12 +220,12 @@ namespace TestNamespace.Types.Nodes .Type>() .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionFlags(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionFlags(); var pagingOptions = global::HotChocolate.Types.Pagination.PagingHelper.GetPagingOptions(c.Context, null); - c.Definition.State = c.Definition.State.SetItem(HotChocolate.WellKnownContextData.PagingOptions, pagingOptions); - c.Definition.ContextData[HotChocolate.WellKnownContextData.PagingOptions] = pagingOptions; - c.Definition.Resolvers = r.GetAuthorsAsync(); + c.Configuration.State = c.Configuration.State.SetItem(HotChocolate.WellKnownContextData.PagingOptions, pagingOptions); + c.Configuration.ContextData[HotChocolate.WellKnownContextData.PagingOptions] = pagingOptions; + c.Configuration.Resolvers = r.GetAuthorsAsync(); }, resolvers); @@ -318,12 +318,12 @@ namespace TestNamespace.Types.Root .Type>() .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionFlags(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionFlags(); var pagingOptions = global::HotChocolate.Types.Pagination.PagingHelper.GetPagingOptions(c.Context, null); - c.Definition.State = c.Definition.State.SetItem(HotChocolate.WellKnownContextData.PagingOptions, pagingOptions); - c.Definition.ContextData[HotChocolate.WellKnownContextData.PagingOptions] = pagingOptions; - c.Definition.Resolvers = r.GetAuthorsAsync(); + c.Configuration.State = c.Configuration.State.SetItem(HotChocolate.WellKnownContextData.PagingOptions, pagingOptions); + c.Configuration.ContextData[HotChocolate.WellKnownContextData.PagingOptions] = pagingOptions; + c.Configuration.Resolvers = r.GetAuthorsAsync(); }, resolvers); @@ -333,12 +333,12 @@ namespace TestNamespace.Types.Root .Type>() .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionFlags(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionFlags(); var pagingOptions = global::HotChocolate.Types.Pagination.PagingHelper.GetPagingOptions(c.Context, null); - c.Definition.State = c.Definition.State.SetItem(HotChocolate.WellKnownContextData.PagingOptions, pagingOptions); - c.Definition.ContextData[HotChocolate.WellKnownContextData.PagingOptions] = pagingOptions; - c.Definition.Resolvers = r.GetAuthors2Async(); + c.Configuration.State = c.Configuration.State.SetItem(HotChocolate.WellKnownContextData.PagingOptions, pagingOptions); + c.Configuration.ContextData[HotChocolate.WellKnownContextData.PagingOptions] = pagingOptions; + c.Configuration.Resolvers = r.GetAuthors2Async(); }, resolvers); diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_CustomConnection_UseConnection_ConnectionName_MatchesSnapshot.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_CustomConnection_UseConnection_ConnectionName_MatchesSnapshot.md index 574059fa9a9..4ed42a0008b 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_CustomConnection_UseConnection_ConnectionName_MatchesSnapshot.md +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_CustomConnection_UseConnection_ConnectionName_MatchesSnapshot.md @@ -32,12 +32,12 @@ namespace TestNamespace .Type>() .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionFlags(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionFlags(); var pagingOptions = global::HotChocolate.Types.Pagination.PagingHelper.GetPagingOptions(c.Context, null); - c.Definition.State = c.Definition.State.SetItem(HotChocolate.WellKnownContextData.PagingOptions, pagingOptions); - c.Definition.ContextData[HotChocolate.WellKnownContextData.PagingOptions] = pagingOptions; - c.Definition.Resolvers = r.GetAuthorsAsync(); + c.Configuration.State = c.Configuration.State.SetItem(HotChocolate.WellKnownContextData.PagingOptions, pagingOptions); + c.Configuration.ContextData[HotChocolate.WellKnownContextData.PagingOptions] = pagingOptions; + c.Configuration.Resolvers = r.GetAuthorsAsync(); }, resolvers); @@ -131,9 +131,9 @@ namespace TestNamespace .Type>>>() .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionEdgesFieldFlags(); - c.Definition.Resolvers = r.Edges(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionEdgesFieldFlags(); + c.Configuration.Resolvers = r.Edges(); }, resolvers); @@ -141,9 +141,9 @@ namespace TestNamespace .Field(thisType.GetMember("Nodes", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionNodesFieldFlags(); - c.Definition.Resolvers = r.Nodes(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionNodesFieldFlags(); + c.Configuration.Resolvers = r.Nodes(); }, resolvers); @@ -151,8 +151,8 @@ namespace TestNamespace .Field(thisType.GetMember("PageInfo", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.PageInfo(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.PageInfo(); }, resolvers); @@ -160,9 +160,9 @@ namespace TestNamespace .Field(thisType.GetMember("TotalCount", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionTotalCountFieldFlags(); - c.Definition.Resolvers = r.TotalCount(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionTotalCountFieldFlags(); + c.Configuration.Resolvers = r.TotalCount(); }, resolvers); } @@ -244,8 +244,8 @@ namespace TestNamespace .Field(thisType.GetMember("Node", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.Node(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.Node(); }, resolvers); @@ -253,8 +253,8 @@ namespace TestNamespace .Field(thisType.GetMember("Cursor", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.Cursor(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.Cursor(); }, resolvers); } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_CustomConnection_UseConnection_IncludeTotalCount_MatchesSnapshot.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_CustomConnection_UseConnection_IncludeTotalCount_MatchesSnapshot.md index 2b0d1237b9d..3000c6ec729 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_CustomConnection_UseConnection_IncludeTotalCount_MatchesSnapshot.md +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_CustomConnection_UseConnection_IncludeTotalCount_MatchesSnapshot.md @@ -34,9 +34,9 @@ namespace TestNamespace .Type>>>() .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionEdgesFieldFlags(); - c.Definition.Resolvers = r.Edges(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionEdgesFieldFlags(); + c.Configuration.Resolvers = r.Edges(); }, resolvers); @@ -44,9 +44,9 @@ namespace TestNamespace .Field(thisType.GetMember("Nodes", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionNodesFieldFlags(); - c.Definition.Resolvers = r.Nodes(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionNodesFieldFlags(); + c.Configuration.Resolvers = r.Nodes(); }, resolvers); @@ -54,8 +54,8 @@ namespace TestNamespace .Field(thisType.GetMember("PageInfo", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.PageInfo(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.PageInfo(); }, resolvers); @@ -63,9 +63,9 @@ namespace TestNamespace .Field(thisType.GetMember("TotalCount", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionTotalCountFieldFlags(); - c.Definition.Resolvers = r.TotalCount(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionTotalCountFieldFlags(); + c.Configuration.Resolvers = r.TotalCount(); }, resolvers); } @@ -147,8 +147,8 @@ namespace TestNamespace .Field(thisType.GetMember("Node", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.Node(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.Node(); }, resolvers); @@ -156,8 +156,8 @@ namespace TestNamespace .Field(thisType.GetMember("Cursor", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.Cursor(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.Cursor(); }, resolvers); } @@ -220,12 +220,12 @@ namespace TestNamespace .Type>() .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionFlags(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionFlags(); var pagingOptions = global::HotChocolate.Types.Pagination.PagingHelper.GetPagingOptions(c.Context, null); - c.Definition.State = c.Definition.State.SetItem(HotChocolate.WellKnownContextData.PagingOptions, pagingOptions); - c.Definition.ContextData[HotChocolate.WellKnownContextData.PagingOptions] = pagingOptions; - c.Definition.Resolvers = r.GetAuthorsAsync(); + c.Configuration.State = c.Configuration.State.SetItem(HotChocolate.WellKnownContextData.PagingOptions, pagingOptions); + c.Configuration.ContextData[HotChocolate.WellKnownContextData.PagingOptions] = pagingOptions; + c.Configuration.Resolvers = r.GetAuthorsAsync(); }, resolvers); diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_GenericCustomConnection_MatchesSnapshot.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_GenericCustomConnection_MatchesSnapshot.md index b8c8d9ee0f7..bf411bb877b 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_GenericCustomConnection_MatchesSnapshot.md +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_GenericCustomConnection_MatchesSnapshot.md @@ -37,9 +37,9 @@ namespace TestNamespace .Type>>>() .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionEdgesFieldFlags(); - c.Definition.Resolvers = r.Edges(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionEdgesFieldFlags(); + c.Configuration.Resolvers = r.Edges(); }, resolvers); @@ -47,9 +47,9 @@ namespace TestNamespace .Field(thisType.GetMember("Nodes", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionNodesFieldFlags(); - c.Definition.Resolvers = r.Nodes(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionNodesFieldFlags(); + c.Configuration.Resolvers = r.Nodes(); }, resolvers); @@ -57,8 +57,8 @@ namespace TestNamespace .Field(thisType.GetMember("PageInfo", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.PageInfo(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.PageInfo(); }, resolvers); @@ -66,9 +66,9 @@ namespace TestNamespace .Field(thisType.GetMember("TotalCount", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionTotalCountFieldFlags(); - c.Definition.Resolvers = r.TotalCount(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionTotalCountFieldFlags(); + c.Configuration.Resolvers = r.TotalCount(); }, resolvers); } @@ -153,8 +153,8 @@ namespace TestNamespace .Field(thisType.GetMember("Node", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.Node(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.Node(); }, resolvers); @@ -162,8 +162,8 @@ namespace TestNamespace .Field(thisType.GetMember("Cursor", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.Cursor(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.Cursor(); }, resolvers); } @@ -226,12 +226,12 @@ namespace TestNamespace.Types.Nodes .Type>() .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionFlags(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionFlags(); var pagingOptions = global::HotChocolate.Types.Pagination.PagingHelper.GetPagingOptions(c.Context, null); - c.Definition.State = c.Definition.State.SetItem(HotChocolate.WellKnownContextData.PagingOptions, pagingOptions); - c.Definition.ContextData[HotChocolate.WellKnownContextData.PagingOptions] = pagingOptions; - c.Definition.Resolvers = r.GetAuthorsAsync(); + c.Configuration.State = c.Configuration.State.SetItem(HotChocolate.WellKnownContextData.PagingOptions, pagingOptions); + c.Configuration.ContextData[HotChocolate.WellKnownContextData.PagingOptions] = pagingOptions; + c.Configuration.Resolvers = r.GetAuthorsAsync(); }, resolvers); @@ -324,12 +324,12 @@ namespace TestNamespace.Types.Root .Type>() .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionFlags(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionFlags(); var pagingOptions = global::HotChocolate.Types.Pagination.PagingHelper.GetPagingOptions(c.Context, null); - c.Definition.State = c.Definition.State.SetItem(HotChocolate.WellKnownContextData.PagingOptions, pagingOptions); - c.Definition.ContextData[HotChocolate.WellKnownContextData.PagingOptions] = pagingOptions; - c.Definition.Resolvers = r.GetAuthorsAsync(); + c.Configuration.State = c.Configuration.State.SetItem(HotChocolate.WellKnownContextData.PagingOptions, pagingOptions); + c.Configuration.ContextData[HotChocolate.WellKnownContextData.PagingOptions] = pagingOptions; + c.Configuration.Resolvers = r.GetAuthorsAsync(); }, resolvers); @@ -339,12 +339,12 @@ namespace TestNamespace.Types.Root .Type>() .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionFlags(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionFlags(); var pagingOptions = global::HotChocolate.Types.Pagination.PagingHelper.GetPagingOptions(c.Context, null); - c.Definition.State = c.Definition.State.SetItem(HotChocolate.WellKnownContextData.PagingOptions, pagingOptions); - c.Definition.ContextData[HotChocolate.WellKnownContextData.PagingOptions] = pagingOptions; - c.Definition.Resolvers = r.GetAuthors2Async(); + c.Configuration.State = c.Configuration.State.SetItem(HotChocolate.WellKnownContextData.PagingOptions, pagingOptions); + c.Configuration.ContextData[HotChocolate.WellKnownContextData.PagingOptions] = pagingOptions; + c.Configuration.Resolvers = r.GetAuthors2Async(); }, resolvers); diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_GenericCustomConnection_WithConnectionName_MatchesSnapshot.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_GenericCustomConnection_WithConnectionName_MatchesSnapshot.md index 5c1022b3725..80224517d3b 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_GenericCustomConnection_WithConnectionName_MatchesSnapshot.md +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_GenericCustomConnection_WithConnectionName_MatchesSnapshot.md @@ -37,9 +37,9 @@ namespace TestNamespace .Type>>() .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionEdgesFieldFlags(); - c.Definition.Resolvers = r.Edges(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionEdgesFieldFlags(); + c.Configuration.Resolvers = r.Edges(); }, resolvers); @@ -47,9 +47,9 @@ namespace TestNamespace .Field(thisType.GetMember("Nodes", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionNodesFieldFlags(); - c.Definition.Resolvers = r.Nodes(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionNodesFieldFlags(); + c.Configuration.Resolvers = r.Nodes(); }, resolvers); @@ -57,8 +57,8 @@ namespace TestNamespace .Field(thisType.GetMember("PageInfo", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.PageInfo(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.PageInfo(); }, resolvers); @@ -66,9 +66,9 @@ namespace TestNamespace .Field(thisType.GetMember("TotalCount", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionTotalCountFieldFlags(); - c.Definition.Resolvers = r.TotalCount(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionTotalCountFieldFlags(); + c.Configuration.Resolvers = r.TotalCount(); }, resolvers); } @@ -153,8 +153,8 @@ namespace TestNamespace .Field(thisType.GetMember("Node", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.Node(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.Node(); }, resolvers); @@ -162,8 +162,8 @@ namespace TestNamespace .Field(thisType.GetMember("Cursor", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.Cursor(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.Cursor(); }, resolvers); } @@ -226,12 +226,12 @@ namespace TestNamespace.Types.Nodes .Type>() .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionFlags(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionFlags(); var pagingOptions = global::HotChocolate.Types.Pagination.PagingHelper.GetPagingOptions(c.Context, null); - c.Definition.State = c.Definition.State.SetItem(HotChocolate.WellKnownContextData.PagingOptions, pagingOptions); - c.Definition.ContextData[HotChocolate.WellKnownContextData.PagingOptions] = pagingOptions; - c.Definition.Resolvers = r.GetAuthorsAsync(); + c.Configuration.State = c.Configuration.State.SetItem(HotChocolate.WellKnownContextData.PagingOptions, pagingOptions); + c.Configuration.ContextData[HotChocolate.WellKnownContextData.PagingOptions] = pagingOptions; + c.Configuration.Resolvers = r.GetAuthorsAsync(); }, resolvers); @@ -324,12 +324,12 @@ namespace TestNamespace.Types.Root .Type>() .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionFlags(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionFlags(); var pagingOptions = global::HotChocolate.Types.Pagination.PagingHelper.GetPagingOptions(c.Context, null); - c.Definition.State = c.Definition.State.SetItem(HotChocolate.WellKnownContextData.PagingOptions, pagingOptions); - c.Definition.ContextData[HotChocolate.WellKnownContextData.PagingOptions] = pagingOptions; - c.Definition.Resolvers = r.GetAuthorsAsync(); + c.Configuration.State = c.Configuration.State.SetItem(HotChocolate.WellKnownContextData.PagingOptions, pagingOptions); + c.Configuration.ContextData[HotChocolate.WellKnownContextData.PagingOptions] = pagingOptions; + c.Configuration.Resolvers = r.GetAuthorsAsync(); }, resolvers); @@ -339,12 +339,12 @@ namespace TestNamespace.Types.Root .Type>() .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionFlags(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionFlags(); var pagingOptions = global::HotChocolate.Types.Pagination.PagingHelper.GetPagingOptions(c.Context, null); - c.Definition.State = c.Definition.State.SetItem(HotChocolate.WellKnownContextData.PagingOptions, pagingOptions); - c.Definition.ContextData[HotChocolate.WellKnownContextData.PagingOptions] = pagingOptions; - c.Definition.Resolvers = r.GetAuthors2Async(); + c.Configuration.State = c.Configuration.State.SetItem(HotChocolate.WellKnownContextData.PagingOptions, pagingOptions); + c.Configuration.ContextData[HotChocolate.WellKnownContextData.PagingOptions] = pagingOptions; + c.Configuration.Resolvers = r.GetAuthors2Async(); }, resolvers); @@ -481,9 +481,9 @@ namespace TestNamespace .Type>>() .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionEdgesFieldFlags(); - c.Definition.Resolvers = r.Edges(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionEdgesFieldFlags(); + c.Configuration.Resolvers = r.Edges(); }, resolvers); @@ -491,9 +491,9 @@ namespace TestNamespace .Field(thisType.GetMember("Nodes", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionNodesFieldFlags(); - c.Definition.Resolvers = r.Nodes(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionNodesFieldFlags(); + c.Configuration.Resolvers = r.Nodes(); }, resolvers); @@ -501,8 +501,8 @@ namespace TestNamespace .Field(thisType.GetMember("PageInfo", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.PageInfo(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.PageInfo(); }, resolvers); @@ -510,9 +510,9 @@ namespace TestNamespace .Field(thisType.GetMember("TotalCount", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionTotalCountFieldFlags(); - c.Definition.Resolvers = r.TotalCount(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionTotalCountFieldFlags(); + c.Configuration.Resolvers = r.TotalCount(); }, resolvers); } @@ -594,8 +594,8 @@ namespace TestNamespace .Field(thisType.GetMember("Node", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.Node(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.Node(); }, resolvers); @@ -603,8 +603,8 @@ namespace TestNamespace .Field(thisType.GetMember("Cursor", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.Cursor(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.Cursor(); }, resolvers); } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_Inherit_From_ConnectionBase_Inherit_PageEdge.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_Inherit_From_ConnectionBase_Inherit_PageEdge.md index 5ae17ca96e6..e325be9c5e0 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_Inherit_From_ConnectionBase_Inherit_PageEdge.md +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_Inherit_From_ConnectionBase_Inherit_PageEdge.md @@ -34,9 +34,9 @@ namespace TestNamespace .Type>>() .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionEdgesFieldFlags(); - c.Definition.Resolvers = r.Edges(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionEdgesFieldFlags(); + c.Configuration.Resolvers = r.Edges(); }, resolvers); @@ -44,9 +44,9 @@ namespace TestNamespace .Field(thisType.GetMember("Nodes", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionNodesFieldFlags(); - c.Definition.Resolvers = r.Nodes(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionNodesFieldFlags(); + c.Configuration.Resolvers = r.Nodes(); }, resolvers); @@ -54,8 +54,8 @@ namespace TestNamespace .Field(thisType.GetMember("PageInfo", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.PageInfo(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.PageInfo(); }, resolvers); @@ -63,9 +63,9 @@ namespace TestNamespace .Field(thisType.GetMember("TotalCount", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionTotalCountFieldFlags(); - c.Definition.Resolvers = r.TotalCount(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionTotalCountFieldFlags(); + c.Configuration.Resolvers = r.TotalCount(); }, resolvers); } @@ -147,8 +147,8 @@ namespace TestNamespace .Field(thisType.GetMember("Author", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.Author(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.Author(); }, resolvers); @@ -156,8 +156,8 @@ namespace TestNamespace .Field(thisType.GetMember("Node", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.Node(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.Node(); }, resolvers); @@ -165,8 +165,8 @@ namespace TestNamespace .Field(thisType.GetMember("Cursor", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.Cursor(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.Cursor(); }, resolvers); } @@ -238,12 +238,12 @@ namespace TestNamespace.Types.Root .Type>() .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionFlags(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionFlags(); var pagingOptions = global::HotChocolate.Types.Pagination.PagingHelper.GetPagingOptions(c.Context, null); - c.Definition.State = c.Definition.State.SetItem(HotChocolate.WellKnownContextData.PagingOptions, pagingOptions); - c.Definition.ContextData[HotChocolate.WellKnownContextData.PagingOptions] = pagingOptions; - c.Definition.Resolvers = r.GetAuthorsAsync(); + c.Configuration.State = c.Configuration.State.SetItem(HotChocolate.WellKnownContextData.PagingOptions, pagingOptions); + c.Configuration.ContextData[HotChocolate.WellKnownContextData.PagingOptions] = pagingOptions; + c.Configuration.Resolvers = r.GetAuthorsAsync(); }, resolvers); diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_Inherit_From_ConnectionBase_Reuse_PageEdge.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_Inherit_From_ConnectionBase_Reuse_PageEdge.md index 814e59ef6cd..f87fd868110 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_Inherit_From_ConnectionBase_Reuse_PageEdge.md +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_Inherit_From_ConnectionBase_Reuse_PageEdge.md @@ -34,9 +34,9 @@ namespace TestNamespace .Type>>() .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionEdgesFieldFlags(); - c.Definition.Resolvers = r.Edges(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionEdgesFieldFlags(); + c.Configuration.Resolvers = r.Edges(); }, resolvers); @@ -44,9 +44,9 @@ namespace TestNamespace .Field(thisType.GetMember("Nodes", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionNodesFieldFlags(); - c.Definition.Resolvers = r.Nodes(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionNodesFieldFlags(); + c.Configuration.Resolvers = r.Nodes(); }, resolvers); @@ -54,8 +54,8 @@ namespace TestNamespace .Field(thisType.GetMember("PageInfo", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.PageInfo(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.PageInfo(); }, resolvers); @@ -63,9 +63,9 @@ namespace TestNamespace .Field(thisType.GetMember("TotalCount", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionTotalCountFieldFlags(); - c.Definition.Resolvers = r.TotalCount(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionTotalCountFieldFlags(); + c.Configuration.Resolvers = r.TotalCount(); }, resolvers); } @@ -147,8 +147,8 @@ namespace TestNamespace .Field(thisType.GetMember("Node", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.Node(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.Node(); }, resolvers); @@ -156,8 +156,8 @@ namespace TestNamespace .Field(thisType.GetMember("Cursor", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.Cursor(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.Cursor(); }, resolvers); } @@ -220,12 +220,12 @@ namespace TestNamespace.Types.Root .Type>() .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionFlags(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionFlags(); var pagingOptions = global::HotChocolate.Types.Pagination.PagingHelper.GetPagingOptions(c.Context, null); - c.Definition.State = c.Definition.State.SetItem(HotChocolate.WellKnownContextData.PagingOptions, pagingOptions); - c.Definition.ContextData[HotChocolate.WellKnownContextData.PagingOptions] = pagingOptions; - c.Definition.Resolvers = r.GetAuthorsAsync(); + c.Configuration.State = c.Configuration.State.SetItem(HotChocolate.WellKnownContextData.PagingOptions, pagingOptions); + c.Configuration.ContextData[HotChocolate.WellKnownContextData.PagingOptions] = pagingOptions; + c.Configuration.Resolvers = r.GetAuthorsAsync(); }, resolvers); diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_Inherit_From_ConnectionBase_Reuse_PageEdge_Generic.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_Inherit_From_ConnectionBase_Reuse_PageEdge_Generic.md index 6164c0864a3..40f2e6918fb 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_Inherit_From_ConnectionBase_Reuse_PageEdge_Generic.md +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_Inherit_From_ConnectionBase_Reuse_PageEdge_Generic.md @@ -37,9 +37,9 @@ namespace TestNamespace .Type>>() .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionEdgesFieldFlags(); - c.Definition.Resolvers = r.Edges(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionEdgesFieldFlags(); + c.Configuration.Resolvers = r.Edges(); }, resolvers); @@ -47,9 +47,9 @@ namespace TestNamespace .Field(thisType.GetMember("Nodes", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionNodesFieldFlags(); - c.Definition.Resolvers = r.Nodes(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionNodesFieldFlags(); + c.Configuration.Resolvers = r.Nodes(); }, resolvers); @@ -57,8 +57,8 @@ namespace TestNamespace .Field(thisType.GetMember("PageInfo", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.PageInfo(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.PageInfo(); }, resolvers); @@ -66,9 +66,9 @@ namespace TestNamespace .Field(thisType.GetMember("TotalCount", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionTotalCountFieldFlags(); - c.Definition.Resolvers = r.TotalCount(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionTotalCountFieldFlags(); + c.Configuration.Resolvers = r.TotalCount(); }, resolvers); } @@ -153,8 +153,8 @@ namespace TestNamespace .Field(thisType.GetMember("Node", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.Node(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.Node(); }, resolvers); @@ -162,8 +162,8 @@ namespace TestNamespace .Field(thisType.GetMember("Cursor", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.Cursor(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.Cursor(); }, resolvers); } @@ -226,12 +226,12 @@ namespace TestNamespace.Types.Root .Type>() .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionFlags(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionFlags(); var pagingOptions = global::HotChocolate.Types.Pagination.PagingHelper.GetPagingOptions(c.Context, null); - c.Definition.State = c.Definition.State.SetItem(HotChocolate.WellKnownContextData.PagingOptions, pagingOptions); - c.Definition.ContextData[HotChocolate.WellKnownContextData.PagingOptions] = pagingOptions; - c.Definition.Resolvers = r.GetAuthorsAsync(); + c.Configuration.State = c.Configuration.State.SetItem(HotChocolate.WellKnownContextData.PagingOptions, pagingOptions); + c.Configuration.ContextData[HotChocolate.WellKnownContextData.PagingOptions] = pagingOptions; + c.Configuration.Resolvers = r.GetAuthorsAsync(); }, resolvers); diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_Inherit_From_PageConnection.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_Inherit_From_PageConnection.md index 0a79e62ae1b..c577ab0030a 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_Inherit_From_PageConnection.md +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_Inherit_From_PageConnection.md @@ -33,8 +33,8 @@ namespace TestNamespace .Field(thisType.GetMember("CustomResolver", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.CustomResolver(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.CustomResolver(); }, resolvers); @@ -43,9 +43,9 @@ namespace TestNamespace .Type>>() .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionEdgesFieldFlags(); - c.Definition.Resolvers = r.Edges(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionEdgesFieldFlags(); + c.Configuration.Resolvers = r.Edges(); }, resolvers); @@ -53,9 +53,9 @@ namespace TestNamespace .Field(thisType.GetMember("Nodes", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionNodesFieldFlags(); - c.Definition.Resolvers = r.Nodes(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionNodesFieldFlags(); + c.Configuration.Resolvers = r.Nodes(); }, resolvers); @@ -63,8 +63,8 @@ namespace TestNamespace .Field(thisType.GetMember("PageInfo", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.PageInfo(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.PageInfo(); }, resolvers); @@ -72,9 +72,9 @@ namespace TestNamespace .Field(thisType.GetMember("TotalCount", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionTotalCountFieldFlags(); - c.Definition.Resolvers = r.TotalCount(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionTotalCountFieldFlags(); + c.Configuration.Resolvers = r.TotalCount(); }, resolvers); } @@ -167,8 +167,8 @@ namespace TestNamespace .Field(thisType.GetMember("Node", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.Node(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.Node(); }, resolvers); @@ -176,8 +176,8 @@ namespace TestNamespace .Field(thisType.GetMember("Cursor", global::HotChocolate.Utilities.ReflectionUtils.InstanceMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.Cursor(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.Cursor(); }, resolvers); } @@ -240,12 +240,12 @@ namespace TestNamespace.Types.Root .Type>() .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.SetConnectionFlags(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.SetConnectionFlags(); var pagingOptions = global::HotChocolate.Types.Pagination.PagingHelper.GetPagingOptions(c.Context, null); - c.Definition.State = c.Definition.State.SetItem(HotChocolate.WellKnownContextData.PagingOptions, pagingOptions); - c.Definition.ContextData[HotChocolate.WellKnownContextData.PagingOptions] = pagingOptions; - c.Definition.Resolvers = r.GetAuthorsAsync(); + c.Configuration.State = c.Configuration.State.SetItem(HotChocolate.WellKnownContextData.PagingOptions, pagingOptions); + c.Configuration.ContextData[HotChocolate.WellKnownContextData.PagingOptions] = pagingOptions; + c.Configuration.Resolvers = r.GetAuthorsAsync(); }, resolvers); diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ResolverTests.Ensure_Entity_Becomes_Node.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ResolverTests.Ensure_Entity_Becomes_Node.md index 8dc51f55f3e..4ed2ca5382a 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ResolverTests.Ensure_Entity_Becomes_Node.md +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ResolverTests.Ensure_Entity_Becomes_Node.md @@ -70,8 +70,8 @@ namespace TestNamespace .Field(thisType.GetMember("GetTestById", global::HotChocolate.Utilities.ReflectionUtils.StaticMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.GetTestById(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.GetTestById(); }, resolvers); diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ResolverTests.Ensure_Entity_Becomes_Node_With_Query_Node_Resolver.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ResolverTests.Ensure_Entity_Becomes_Node_With_Query_Node_Resolver.md index 30dda49821d..553e720be81 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ResolverTests.Ensure_Entity_Becomes_Node_With_Query_Node_Resolver.md +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ResolverTests.Ensure_Entity_Becomes_Node_With_Query_Node_Resolver.md @@ -70,8 +70,8 @@ namespace TestNamespace .Field(thisType.GetMember("GetTestById", global::HotChocolate.Utilities.ReflectionUtils.StaticMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.GetTestById(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.GetTestById(); }, resolvers); @@ -148,8 +148,8 @@ namespace TestNamespace .Field(thisType.GetMember("GetTest", global::HotChocolate.Utilities.ReflectionUtils.StaticMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.GetTest(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.GetTest(); }, resolvers); diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ResolverTests.GenerateSource_ResolverWithGlobalStateArgument_MatchesSnapshot.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ResolverTests.GenerateSource_ResolverWithGlobalStateArgument_MatchesSnapshot.md index 71bdbc0ce5c..33cf6c3f9b2 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ResolverTests.GenerateSource_ResolverWithGlobalStateArgument_MatchesSnapshot.md +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ResolverTests.GenerateSource_ResolverWithGlobalStateArgument_MatchesSnapshot.md @@ -61,8 +61,8 @@ namespace TestNamespace .Field(thisType.GetMember("GetTest", global::HotChocolate.Utilities.ReflectionUtils.StaticMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.GetTest(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.GetTest(); }, resolvers); diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ResolverTests.GenerateSource_ResolverWithGlobalStateSetStateArgument_MatchesSnapshot.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ResolverTests.GenerateSource_ResolverWithGlobalStateSetStateArgument_MatchesSnapshot.md index 4a244df69c5..bd2c7ec75f2 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ResolverTests.GenerateSource_ResolverWithGlobalStateSetStateArgument_MatchesSnapshot.md +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ResolverTests.GenerateSource_ResolverWithGlobalStateSetStateArgument_MatchesSnapshot.md @@ -61,8 +61,8 @@ namespace TestNamespace .Field(thisType.GetMember("GetTest", global::HotChocolate.Utilities.ReflectionUtils.StaticMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.GetTest(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.GetTest(); }, resolvers); diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ResolverTests.GenerateSource_ResolverWithLocalStateArgument_MatchesSnapshot.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ResolverTests.GenerateSource_ResolverWithLocalStateArgument_MatchesSnapshot.md index 8cac0a5570f..b4a2c2bf655 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ResolverTests.GenerateSource_ResolverWithLocalStateArgument_MatchesSnapshot.md +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ResolverTests.GenerateSource_ResolverWithLocalStateArgument_MatchesSnapshot.md @@ -61,8 +61,8 @@ namespace TestNamespace .Field(thisType.GetMember("GetTest", global::HotChocolate.Utilities.ReflectionUtils.StaticMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.GetTest(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.GetTest(); }, resolvers); diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ResolverTests.GenerateSource_ResolverWithLocalStateSetStateArgument_MatchesSnapshot.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ResolverTests.GenerateSource_ResolverWithLocalStateSetStateArgument_MatchesSnapshot.md index 614ebda5e53..484ab7b559e 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ResolverTests.GenerateSource_ResolverWithLocalStateSetStateArgument_MatchesSnapshot.md +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ResolverTests.GenerateSource_ResolverWithLocalStateSetStateArgument_MatchesSnapshot.md @@ -61,8 +61,8 @@ namespace TestNamespace .Field(thisType.GetMember("GetTest", global::HotChocolate.Utilities.ReflectionUtils.StaticMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.GetTest(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.GetTest(); }, resolvers); diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ResolverTests.GenerateSource_ResolverWithScopedStateArgument_MatchesSnapshot.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ResolverTests.GenerateSource_ResolverWithScopedStateArgument_MatchesSnapshot.md index 5ab828ccebd..631db7e36f9 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ResolverTests.GenerateSource_ResolverWithScopedStateArgument_MatchesSnapshot.md +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ResolverTests.GenerateSource_ResolverWithScopedStateArgument_MatchesSnapshot.md @@ -61,8 +61,8 @@ namespace TestNamespace .Field(thisType.GetMember("GetTest", global::HotChocolate.Utilities.ReflectionUtils.StaticMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.GetTest(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.GetTest(); }, resolvers); diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ResolverTests.GenerateSource_ResolverWithScopedStateSetStateArgument_MatchesSnapshot.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ResolverTests.GenerateSource_ResolverWithScopedStateSetStateArgument_MatchesSnapshot.md index b1e72b6ddc2..16becdd5b59 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ResolverTests.GenerateSource_ResolverWithScopedStateSetStateArgument_MatchesSnapshot.md +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ResolverTests.GenerateSource_ResolverWithScopedStateSetStateArgument_MatchesSnapshot.md @@ -61,8 +61,8 @@ namespace TestNamespace .Field(thisType.GetMember("GetTest", global::HotChocolate.Utilities.ReflectionUtils.StaticMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.GetTest(); + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.GetTest(); }, resolvers); diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ResolverTests.Inject_QueryContext.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ResolverTests.Inject_QueryContext.md index 399ec60ffde..2332ec733d8 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ResolverTests.Inject_QueryContext.md +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ResolverTests.Inject_QueryContext.md @@ -61,9 +61,9 @@ namespace TestNamespace .Field(thisType.GetMember("GetTest", global::HotChocolate.Utilities.ReflectionUtils.StaticMemberFlags)[0]) .ExtendWith(static (c, r) => { - c.Definition.SetSourceGeneratorFlags(); - c.Definition.Resolvers = r.GetTest(); - c.Definition.ResultPostProcessor = global::HotChocolate.Execution.ListPostProcessor.Default; + c.Configuration.SetSourceGeneratorFlags(); + c.Configuration.Resolvers = r.GetTest(); + c.Configuration.ResultPostProcessor = global::HotChocolate.Execution.ListPostProcessor.Default; }, resolvers); 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 1f466318f9d..b340e68c97e 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 @@ -20,11 +20,11 @@ }, { "type": "HotChocolate.Types.Introspection.__EnumValue", - "runtimeType": "HotChocolate.Types.IEnumValue", + "runtimeType": "HotChocolate.Types.EnumValue", "references": [ "HotChocolate.Types.Introspection.__EnumValue (Output)", "__EnumValue (Output)", - "ObjectType (Output)" + "ObjectType (Output)" ] }, { @@ -151,7 +151,7 @@ "runtimeTypeRefs": { "DirectiveType (Output)": "HotChocolate.Types.Introspection.__Directive (Output)", "DirectiveLocation!": "HotChocolate.Types.Introspection.__DirectiveLocation", - "IEnumValue (Output)": "HotChocolate.Types.Introspection.__EnumValue (Output)", + "EnumValue (Output)": "HotChocolate.Types.Introspection.__EnumValue (Output)", "IOutputField (Output)": "HotChocolate.Types.Introspection.__Field (Output)", "IInputField (Output)": "HotChocolate.Types.Introspection.__InputValue (Output)", "ISchema (Output)": "HotChocolate.Types.Introspection.__Schema (Output)", 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 a3d8b6146c5..dd53da38c70 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 @@ -20,11 +20,11 @@ }, { "type": "HotChocolate.Types.Introspection.__EnumValue", - "runtimeType": "HotChocolate.Types.IEnumValue", + "runtimeType": "HotChocolate.Types.EnumValue", "references": [ "HotChocolate.Types.Introspection.__EnumValue (Output)", "__EnumValue (Output)", - "ObjectType (Output)" + "ObjectType (Output)" ] }, { @@ -153,7 +153,7 @@ "runtimeTypeRefs": { "DirectiveType (Output)": "HotChocolate.Types.Introspection.__Directive (Output)", "DirectiveLocation!": "HotChocolate.Types.Introspection.__DirectiveLocation", - "IEnumValue (Output)": "HotChocolate.Types.Introspection.__EnumValue (Output)", + "EnumValue (Output)": "HotChocolate.Types.Introspection.__EnumValue (Output)", "IOutputField (Output)": "HotChocolate.Types.Introspection.__Field (Output)", "IInputField (Output)": "HotChocolate.Types.Introspection.__InputValue (Output)", "ISchema (Output)": "HotChocolate.Types.Introspection.__Schema (Output)", 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 f002fca2653..d3df1cf59ad 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 @@ -20,11 +20,11 @@ }, { "type": "HotChocolate.Types.Introspection.__EnumValue", - "runtimeType": "HotChocolate.Types.IEnumValue", + "runtimeType": "HotChocolate.Types.EnumValue", "references": [ "HotChocolate.Types.Introspection.__EnumValue (Output)", "__EnumValue (Output)", - "ObjectType (Output)" + "ObjectType (Output)" ] }, { @@ -153,7 +153,7 @@ "runtimeTypeRefs": { "DirectiveType (Output)": "HotChocolate.Types.Introspection.__Directive (Output)", "DirectiveLocation!": "HotChocolate.Types.Introspection.__DirectiveLocation", - "IEnumValue (Output)": "HotChocolate.Types.Introspection.__EnumValue (Output)", + "EnumValue (Output)": "HotChocolate.Types.Introspection.__EnumValue (Output)", "IOutputField (Output)": "HotChocolate.Types.Introspection.__Field (Output)", "IInputField (Output)": "HotChocolate.Types.Introspection.__InputValue (Output)", "ISchema (Output)": "HotChocolate.Types.Introspection.__Schema (Output)", diff --git a/src/HotChocolate/Data/src/Data/Filters/FilterFieldDescriptor.cs b/src/HotChocolate/Data/src/Data/Filters/FilterFieldDescriptor.cs index ee8734d33bf..acf6c35e87e 100644 --- a/src/HotChocolate/Data/src/Data/Filters/FilterFieldDescriptor.cs +++ b/src/HotChocolate/Data/src/Data/Filters/FilterFieldDescriptor.cs @@ -17,8 +17,8 @@ protected FilterFieldDescriptor( string fieldName) : base(context) { - Definition.Name = fieldName; - Definition.Scope = scope; + Configuration.Name = fieldName; + Configuration.Scope = scope; } protected FilterFieldDescriptor( @@ -29,12 +29,12 @@ protected FilterFieldDescriptor( { var convention = context.GetFilterConvention(scope); - Definition.Member = member ?? throw new ArgumentNullException(nameof(member)); + Configuration.Member = member ?? throw new ArgumentNullException(nameof(member)); - Definition.Name = convention.GetFieldName(member); - Definition.Description = convention.GetFieldDescription(member); - Definition.Type = convention.GetFieldType(member); - Definition.Scope = scope; + Configuration.Name = convention.GetFieldName(member); + Configuration.Description = convention.GetFieldDescription(member); + Configuration.Type = convention.GetFieldType(member); + Configuration.Scope = scope; } protected FilterFieldDescriptor( @@ -45,13 +45,13 @@ protected FilterFieldDescriptor( { var convention = context.GetFilterConvention(scope); - Definition.Expression = expression; - Definition.Scope = scope; + Configuration.Expression = expression; + Configuration.Scope = scope; - if (Definition.Expression is LambdaExpression lambda) + if (Configuration.Expression is LambdaExpression lambda) { - Definition.Type = convention.GetFieldType(lambda.ReturnType); - Definition.RuntimeType = lambda.ReturnType; + Configuration.Type = convention.GetFieldType(lambda.ReturnType); + Configuration.RuntimeType = lambda.ReturnType; } } @@ -60,13 +60,13 @@ protected internal FilterFieldDescriptor( string? scope) : base(context) { - Definition.Scope = scope; + Configuration.Scope = scope; } - protected internal new FilterFieldDefinition Definition + protected internal new FilterFieldDefinition Configuration { - get => base.Definition; - protected set => base.Definition = value; + get => base.Configuration; + protected set => base.Configuration = value; } internal InputFieldConfiguration CreateFieldDefinition() => CreateConfiguration(); @@ -76,10 +76,10 @@ protected override void OnCreateDefinition( { Context.Descriptors.Push(this); - if (Definition is { AttributesAreApplied: false, Member: not null, }) + if (Configuration is { AttributesAreApplied: false, Member: not null, }) { - Context.TypeInspector.ApplyAttributes(Context, this, Definition.Member); - Definition.AttributesAreApplied = true; + Context.TypeInspector.ApplyAttributes(Context, this, Configuration.Member); + Configuration.AttributesAreApplied = true; } base.OnCreateDefinition(definition); @@ -89,13 +89,13 @@ protected override void OnCreateDefinition( public IFilterFieldDescriptor Name(string value) { - Definition.Name = value; + Configuration.Name = value; return this; } public IFilterFieldDescriptor Ignore(bool ignore = true) { - Definition.Ignore = ignore; + Configuration.Ignore = ignore; return this; } diff --git a/src/HotChocolate/Data/src/Data/Filters/FilterInputTypeDescriptor.cs b/src/HotChocolate/Data/src/Data/Filters/FilterInputTypeDescriptor.cs index c9c85ad6a1e..0bbc6dbb06a 100644 --- a/src/HotChocolate/Data/src/Data/Filters/FilterInputTypeDescriptor.cs +++ b/src/HotChocolate/Data/src/Data/Filters/FilterInputTypeDescriptor.cs @@ -18,14 +18,14 @@ protected FilterInputTypeDescriptor( : base(context) { Convention = context.GetFilterConvention(scope); - Definition.EntityType = entityType ?? throw new ArgumentNullException(nameof(entityType)); - Definition.RuntimeType = typeof(object); - Definition.Name = Convention.GetTypeName(entityType); - Definition.Description = Convention.GetTypeDescription(entityType); - Definition.Fields.BindingBehavior = context.Options.DefaultBindingBehavior; - Definition.Scope = scope; - Definition.UseAnd = Convention.IsAndAllowed(); - Definition.UseOr = Convention.IsOrAllowed(); + Configuration.EntityType = entityType ?? throw new ArgumentNullException(nameof(entityType)); + Configuration.RuntimeType = typeof(object); + Configuration.Name = Convention.GetTypeName(entityType); + Configuration.Description = Convention.GetTypeDescription(entityType); + Configuration.Fields.BindingBehavior = context.Options.DefaultBindingBehavior; + Configuration.Scope = scope; + Configuration.UseAnd = Convention.IsAndAllowed(); + Configuration.UseOr = Convention.IsOrAllowed(); } protected FilterInputTypeDescriptor( @@ -34,9 +34,9 @@ protected FilterInputTypeDescriptor( : base(context) { Convention = context.GetFilterConvention(scope); - Definition.RuntimeType = typeof(object); - Definition.EntityType = typeof(object); - Definition.Scope = scope; + Configuration.RuntimeType = typeof(object); + Configuration.EntityType = typeof(object); + Configuration.Scope = scope; } protected FilterInputTypeDescriptor( @@ -46,28 +46,28 @@ protected FilterInputTypeDescriptor( : base(context) { Convention = context.GetFilterConvention(scope); - Definition = definition ?? throw new ArgumentNullException(nameof(definition)); + Configuration = definition ?? throw new ArgumentNullException(nameof(definition)); } protected IFilterConvention Convention { get; } - protected internal override FilterInputTypeDefinition Definition { get; protected set; } = + protected internal override FilterInputTypeDefinition Configuration { get; protected set; } = new(); protected BindableList Fields { get; } = []; protected BindableList Operations { get; } = []; - Type IHasRuntimeType.RuntimeType => Definition.RuntimeType; + Type IHasRuntimeType.RuntimeType => Configuration.RuntimeType; protected override void OnCreateDefinition(FilterInputTypeDefinition definition) { Context.Descriptors.Push(this); - if (Definition is { AttributesAreApplied: false, EntityType: not null, }) + if (Configuration is { AttributesAreApplied: false, EntityType: not null, }) { - Context.TypeInspector.ApplyAttributes(Context, this, Definition.EntityType); - Definition.AttributesAreApplied = true; + Context.TypeInspector.ApplyAttributes(Context, this, Configuration.EntityType); + Configuration.AttributesAreApplied = true; } var fields = new Dictionary(StringComparer.Ordinal); @@ -82,7 +82,7 @@ protected override void OnCreateDefinition(FilterInputTypeDefinition definition) OnCompleteFields(fields, handledProperties); - Definition.Fields.AddRange(fields.Values); + Configuration.Fields.AddRange(fields.Values); Context.Descriptors.Pop(); } @@ -96,21 +96,21 @@ protected virtual void OnCompleteFields( /// public IFilterInputTypeDescriptor Name(string value) { - Definition.Name = value; - Definition.IsNamed = true; + Configuration.Name = value; + Configuration.IsNamed = true; return this; } /// public IFilterInputTypeDescriptor Description(string? value) { - Definition.Description = value; + Configuration.Description = value; return this; } protected IFilterInputTypeDescriptor BindFields(BindingBehavior bindingBehavior) { - Definition.Fields.BindingBehavior = bindingBehavior; + Configuration.Fields.BindingBehavior = bindingBehavior; return this; } @@ -124,14 +124,14 @@ protected IFilterInputTypeDescriptor BindFieldsImplicitly() => public IFilterOperationFieldDescriptor Operation(int operationId) { var fieldDescriptor = - Operations.FirstOrDefault(t => t.Definition.Id == operationId); + Operations.FirstOrDefault(t => t.Configuration.Id == operationId); if (fieldDescriptor is null) { fieldDescriptor = FilterOperationFieldDescriptor.New( Context, operationId, - Definition.Scope); + Configuration.Scope); Operations.Add(fieldDescriptor); } @@ -142,11 +142,11 @@ public IFilterOperationFieldDescriptor Operation(int operationId) public IFilterFieldDescriptor Field(string name) { var fieldDescriptor = - Fields.FirstOrDefault(t => t.Definition.Name == name); + Fields.FirstOrDefault(t => t.Configuration.Name == name); if (fieldDescriptor is null) { - fieldDescriptor = FilterFieldDescriptor.New(Context, name, Definition.Scope); + fieldDescriptor = FilterFieldDescriptor.New(Context, name, Configuration.Scope); Fields.Add(fieldDescriptor); } @@ -157,14 +157,14 @@ public IFilterFieldDescriptor Field(string name) public IFilterInputTypeDescriptor Ignore(int operationId) { var fieldDescriptor = - Operations.FirstOrDefault(t => t.Definition.Id == operationId); + Operations.FirstOrDefault(t => t.Configuration.Id == operationId); if (fieldDescriptor is null) { fieldDescriptor = FilterOperationFieldDescriptor.New( Context, operationId, - Definition.Scope); + Configuration.Scope); Operations.Add(fieldDescriptor); } @@ -176,14 +176,14 @@ public IFilterInputTypeDescriptor Ignore(int operationId) public IFilterInputTypeDescriptor Ignore(string name) { var fieldDescriptor = - Fields.FirstOrDefault(t => t.Definition.Name == name); + Fields.FirstOrDefault(t => t.Configuration.Name == name); if (fieldDescriptor is null) { fieldDescriptor = FilterFieldDescriptor.New( Context, name, - Definition.Scope); + Configuration.Scope); Fields.Add(fieldDescriptor); } @@ -194,14 +194,14 @@ public IFilterInputTypeDescriptor Ignore(string name) /// public IFilterInputTypeDescriptor AllowOr(bool allow = true) { - Definition.UseOr = allow; + Configuration.UseOr = allow; return this; } /// public IFilterInputTypeDescriptor AllowAnd(bool allow = true) { - Definition.UseAnd = allow; + Configuration.UseAnd = allow; return this; } @@ -209,7 +209,7 @@ public IFilterInputTypeDescriptor AllowAnd(bool allow = true) public IFilterInputTypeDescriptor Directive(TDirective directive) where TDirective : class { - Definition.AddDirective(directive, Context.TypeInspector); + Configuration.AddDirective(directive, Context.TypeInspector); return this; } @@ -217,7 +217,7 @@ public IFilterInputTypeDescriptor Directive(TDirective directive) public IFilterInputTypeDescriptor Directive() where TDirective : class, new() { - Definition.AddDirective(new TDirective(), Context.TypeInspector); + Configuration.AddDirective(new TDirective(), Context.TypeInspector); return this; } @@ -226,7 +226,7 @@ public IFilterInputTypeDescriptor Directive( string name, params ArgumentNode[] arguments) { - Definition.AddDirective(name, arguments); + Configuration.AddDirective(name, arguments); return this; } @@ -248,7 +248,7 @@ public static FilterInputTypeDescriptor FromSchemaType( string? scope = null) { var descriptor = New(context, schemaType, scope); - descriptor.Definition.RuntimeType = typeof(object); + descriptor.Configuration.RuntimeType = typeof(object); return descriptor; } @@ -267,5 +267,5 @@ public static FilterInputTypeDescriptor From( public static FilterInputTypeDescriptor From( FilterInputTypeDescriptor descriptor, string? scope = null) - => From(descriptor.Context, descriptor.Definition, scope); + => From(descriptor.Context, descriptor.Configuration, scope); } diff --git a/src/HotChocolate/Data/src/Data/Filters/FilterInputTypeDescriptor`1.cs b/src/HotChocolate/Data/src/Data/Filters/FilterInputTypeDescriptor`1.cs index 1bbb3a0c42f..11459159b12 100644 --- a/src/HotChocolate/Data/src/Data/Filters/FilterInputTypeDescriptor`1.cs +++ b/src/HotChocolate/Data/src/Data/Filters/FilterInputTypeDescriptor`1.cs @@ -41,13 +41,13 @@ protected override void OnCompleteFields( IDictionary fields, ISet handledProperties) { - if (Definition.Fields.IsImplicitBinding()) + if (Configuration.Fields.IsImplicitBinding()) { FieldDescriptorUtilities.AddImplicitFields( this, - Definition.EntityType!, + Configuration.EntityType!, p => FilterFieldDescriptor - .New(Context, Definition.Scope, p) + .New(Context, Configuration.Scope, p) .CreateConfiguration(), fields, handledProperties, @@ -100,11 +100,11 @@ public IFilterFieldDescriptor Field(Expression> property { case PropertyInfo m: var fieldDescriptor = - Fields.FirstOrDefault(t => t.Definition.Member == m); + Fields.FirstOrDefault(t => t.Configuration.Member == m); if (fieldDescriptor is null) { - fieldDescriptor = FilterFieldDescriptor.New(Context, Definition.Scope, m); + fieldDescriptor = FilterFieldDescriptor.New(Context, Configuration.Scope, m); Fields.Add(fieldDescriptor); } @@ -117,7 +117,7 @@ public IFilterFieldDescriptor Field(Expression> property default: fieldDescriptor = FilterFieldDescriptor - .New(Context, Definition.Scope, propertyOrMember); + .New(Context, Configuration.Scope, propertyOrMember); Fields.Add(fieldDescriptor); return fieldDescriptor; } @@ -143,12 +143,12 @@ public IFilterInputTypeDescriptor Ignore(Expression> propert if (propertyOrMember.ExtractMember() is PropertyInfo p) { var fieldDescriptor = - Fields.FirstOrDefault(t => t.Definition.Member == p); + Fields.FirstOrDefault(t => t.Configuration.Member == p); if (fieldDescriptor is null) { fieldDescriptor = - IgnoreFilterFieldDescriptor.New(Context, Definition.Scope, p); + IgnoreFilterFieldDescriptor.New(Context, Configuration.Scope, p); Fields.Add(fieldDescriptor); } diff --git a/src/HotChocolate/Data/src/Data/Filters/FilterOperationFieldDescriptor.cs b/src/HotChocolate/Data/src/Data/Filters/FilterOperationFieldDescriptor.cs index 2795e56bc92..8cc029852da 100644 --- a/src/HotChocolate/Data/src/Data/Filters/FilterOperationFieldDescriptor.cs +++ b/src/HotChocolate/Data/src/Data/Filters/FilterOperationFieldDescriptor.cs @@ -16,24 +16,25 @@ protected FilterOperationFieldDescriptor( : base(context) { var convention = context.GetFilterConvention(scope); - Definition.Id = operationId; - Definition.Name = convention.GetOperationName(operationId); - Definition.Description = convention.GetOperationDescription(operationId); - Definition.Scope = scope; - Definition.Flags = FieldFlags.FilterOperationField; + Configuration.Id = operationId; + Configuration.Name = convention.GetOperationName(operationId); + Configuration.Description = convention.GetOperationDescription(operationId); + Configuration.Scope = scope; + Configuration.Flags = FieldFlags.FilterOperationField; } - protected internal new FilterOperationFieldDefinition Definition => base.Definition; + protected internal new FilterOperationFieldDefinition Configuration + => base.Configuration; protected override void OnCreateDefinition( FilterOperationFieldDefinition definition) { Context.Descriptors.Push(this); - if (Definition is { AttributesAreApplied: false, Property: not null }) + if (Configuration is { AttributesAreApplied: false, Property: not null }) { - Context.TypeInspector.ApplyAttributes(Context, this, Definition.Property); - Definition.AttributesAreApplied = true; + Context.TypeInspector.ApplyAttributes(Context, this, Configuration.Property); + Configuration.AttributesAreApplied = true; } base.OnCreateDefinition(definition); @@ -43,13 +44,13 @@ protected override void OnCreateDefinition( public IFilterOperationFieldDescriptor Name(string value) { - Definition.Name = value; + Configuration.Name = value; return this; } public IFilterOperationFieldDescriptor Ignore(bool ignore = true) { - Definition.Ignore = ignore; + Configuration.Ignore = ignore; return this; } @@ -88,7 +89,7 @@ public IFilterOperationFieldDescriptor Ignore(bool ignore = true) public IFilterOperationFieldDescriptor Operation(int operation) { - Definition.Id = operation; + Configuration.Id = operation; return this; } diff --git a/src/HotChocolate/Data/src/Data/Filters/IgnoreFilterFieldDescriptor.cs b/src/HotChocolate/Data/src/Data/Filters/IgnoreFilterFieldDescriptor.cs index f117860165c..73c0e385db1 100644 --- a/src/HotChocolate/Data/src/Data/Filters/IgnoreFilterFieldDescriptor.cs +++ b/src/HotChocolate/Data/src/Data/Filters/IgnoreFilterFieldDescriptor.cs @@ -12,8 +12,8 @@ protected IgnoreFilterFieldDescriptor( MemberInfo member) : base(context, scope) { - Definition.Member = member; - Definition.Ignore = true; + Configuration.Member = member; + Configuration.Ignore = true; } public static new FilterFieldDescriptor New( diff --git a/src/HotChocolate/Data/src/Data/Sorting/IgnoreSortFieldDescriptor.cs b/src/HotChocolate/Data/src/Data/Sorting/IgnoreSortFieldDescriptor.cs index 3a4939fb4c4..ff1ba96eb8c 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/IgnoreSortFieldDescriptor.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/IgnoreSortFieldDescriptor.cs @@ -12,8 +12,8 @@ protected IgnoreSortFieldDescriptor( MemberInfo member) : base(context, scope) { - Definition.Member = member; - Definition.Ignore = true; + Configuration.Member = member; + Configuration.Ignore = true; } public static new IgnoreSortFieldDescriptor New( diff --git a/src/HotChocolate/Data/src/Data/Sorting/SortEnumTypeDescriptor.cs b/src/HotChocolate/Data/src/Data/Sorting/SortEnumTypeDescriptor.cs index ba27a97ee45..1ef3f7e5043 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/SortEnumTypeDescriptor.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/SortEnumTypeDescriptor.cs @@ -15,12 +15,12 @@ protected SortEnumTypeDescriptor( string? scope) : base(context) { - Definition.Name = context.Naming.GetTypeName(clrType, TypeKind.Enum); - Definition.Description = context.Naming.GetTypeDescription(clrType, TypeKind.Enum); - Definition.EntityType = clrType; - Definition.RuntimeType = typeof(object); - Definition.Values.BindingBehavior = context.Options.DefaultBindingBehavior; - Definition.Scope = scope; + Configuration.Name = context.Naming.GetTypeName(clrType, TypeKind.Enum); + Configuration.Description = context.Naming.GetTypeDescription(clrType, TypeKind.Enum); + Configuration.EntityType = clrType; + Configuration.RuntimeType = typeof(object); + Configuration.Values.BindingBehavior = context.Options.DefaultBindingBehavior; + Configuration.Scope = scope; } protected SortEnumTypeDescriptor( @@ -28,10 +28,10 @@ protected SortEnumTypeDescriptor( SortEnumTypeDefinition definition) : base(context) { - Definition = definition ?? throw new ArgumentNullException(nameof(definition)); + Configuration = definition ?? throw new ArgumentNullException(nameof(definition)); } - protected internal override SortEnumTypeDefinition Definition { get; protected set; } = new(); + protected internal override SortEnumTypeDefinition Configuration { get; protected set; } = new(); protected ICollection Values { get; } = new List(); @@ -41,13 +41,13 @@ protected override void OnCreateDefinition( { Context.Descriptors.Push(this); - if (!Definition.AttributesAreApplied && Definition.RuntimeType != typeof(object)) + if (!Configuration.AttributesAreApplied && Configuration.RuntimeType != typeof(object)) { Context.TypeInspector.ApplyAttributes( Context, this, - Definition.RuntimeType); - Definition.AttributesAreApplied = true; + Configuration.RuntimeType); + Configuration.AttributesAreApplied = true; } var values = Values.Select(t => t.CreateConfiguration()) @@ -68,13 +68,13 @@ protected override void OnCreateDefinition( public ISortEnumTypeDescriptor Name(string value) { - Definition.Name = value; + Configuration.Name = value; return this; } public ISortEnumTypeDescriptor Description(string value) { - Definition.Description = value; + Configuration.Description = value; return this; } @@ -83,15 +83,15 @@ public ISortEnumValueDescriptor Operation(int operation) var descriptor = Values .FirstOrDefault( t => - t.Definition.RuntimeValue is not null && - t.Definition.RuntimeValue.Equals(operation)); + t.Configuration.RuntimeValue is not null && + t.Configuration.RuntimeValue.Equals(operation)); if (descriptor is not null) { return descriptor; } - descriptor = SortEnumValueDescriptor.New(Context, Definition.Scope, operation); + descriptor = SortEnumValueDescriptor.New(Context, Configuration.Scope, operation); Values.Add(descriptor); return descriptor; } @@ -99,20 +99,20 @@ t.Definition.RuntimeValue is not null && public ISortEnumTypeDescriptor Directive(T directiveInstance) where T : class { - Definition.AddDirective(directiveInstance, Context.TypeInspector); + Configuration.AddDirective(directiveInstance, Context.TypeInspector); return this; } public ISortEnumTypeDescriptor Directive() where T : class, new() { - Definition.AddDirective(new T(), Context.TypeInspector); + Configuration.AddDirective(new T(), Context.TypeInspector); return this; } public ISortEnumTypeDescriptor Directive(string name, params ArgumentNode[] arguments) { - Definition.AddDirective(name, arguments); + Configuration.AddDirective(name, arguments); return this; } diff --git a/src/HotChocolate/Data/src/Data/Sorting/SortEnumValueDescriptor.cs b/src/HotChocolate/Data/src/Data/Sorting/SortEnumValueDescriptor.cs index cf891766d31..fe3a83c14df 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/SortEnumValueDescriptor.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/SortEnumValueDescriptor.cs @@ -15,9 +15,9 @@ protected SortEnumValueDescriptor( : base(context, new SortEnumValueConfiguration { Operation = value, }) { var convention = context.GetSortConvention(scope); - Definition.Name = convention.GetOperationName(value); - Definition.Description = convention.GetOperationDescription(value); - Definition.RuntimeValue = Definition.Name; + Configuration.Name = convention.GetOperationName(value); + Configuration.Description = convention.GetOperationDescription(value); + Configuration.RuntimeValue = Configuration.Name; } protected SortEnumValueDescriptor( @@ -27,10 +27,10 @@ protected SortEnumValueDescriptor( { } - protected internal new EnumValueConfiguration Definition + protected internal new EnumValueConfiguration Configuration { - get { return base.Definition; } - set { base.Definition = value; } + get { return base.Configuration; } + set { base.Configuration = value; } } public new ISortEnumValueDescriptor Name(string value) diff --git a/src/HotChocolate/Data/src/Data/Sorting/SortFieldDescriptor.cs b/src/HotChocolate/Data/src/Data/Sorting/SortFieldDescriptor.cs index 94f4151b817..07006f208a5 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/SortFieldDescriptor.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/SortFieldDescriptor.cs @@ -17,9 +17,9 @@ protected SortFieldDescriptor( string fieldName) : base(context) { - Definition.Name = fieldName; - Definition.Scope = scope; - Definition.Flags = FieldFlags.SortOperationField; + Configuration.Name = fieldName; + Configuration.Scope = scope; + Configuration.Flags = FieldFlags.SortOperationField; } protected SortFieldDescriptor( @@ -30,13 +30,13 @@ protected SortFieldDescriptor( { var convention = context.GetSortConvention(scope); - Definition.Expression = expression; - Definition.Scope = scope; - Definition.Flags = FieldFlags.SortOperationField; - if (Definition.Expression is LambdaExpression lambda) + Configuration.Expression = expression; + Configuration.Scope = scope; + Configuration.Flags = FieldFlags.SortOperationField; + if (Configuration.Expression is LambdaExpression lambda) { - Definition.Type = convention.GetFieldType(lambda.ReturnType); - Definition.RuntimeType = lambda.ReturnType; + Configuration.Type = convention.GetFieldType(lambda.ReturnType); + Configuration.RuntimeType = lambda.ReturnType; } } @@ -48,14 +48,14 @@ protected SortFieldDescriptor( { var convention = context.GetSortConvention(scope); - Definition.Member = member ?? + Configuration.Member = member ?? throw new ArgumentNullException(nameof(member)); - Definition.Name = convention.GetFieldName(member); - Definition.Description = convention.GetFieldDescription(member); - Definition.Type = convention.GetFieldType(member); - Definition.Scope = scope; - Definition.Flags = FieldFlags.SortOperationField; + Configuration.Name = convention.GetFieldName(member); + Configuration.Description = convention.GetFieldDescription(member); + Configuration.Type = convention.GetFieldType(member); + Configuration.Scope = scope; + Configuration.Flags = FieldFlags.SortOperationField; } protected internal SortFieldDescriptor( @@ -63,14 +63,14 @@ protected internal SortFieldDescriptor( string? scope) : base(context) { - Definition.Scope = scope; - Definition.Flags = FieldFlags.SortOperationField; + Configuration.Scope = scope; + Configuration.Flags = FieldFlags.SortOperationField; } - protected internal new SortFieldDefinition Definition + protected internal new SortFieldDefinition Configuration { - get => base.Definition; - protected set => base.Definition = value; + get => base.Configuration; + protected set => base.Configuration = value; } internal InputFieldConfiguration CreateFieldDefinition() => CreateConfiguration(); @@ -80,10 +80,10 @@ protected override void OnCreateDefinition( { Context.Descriptors.Push(this); - if (Definition is { AttributesAreApplied: false, Member: not null, }) + if (Configuration is { AttributesAreApplied: false, Member: not null, }) { - Context.TypeInspector.ApplyAttributes(Context, this, Definition.Member); - Definition.AttributesAreApplied = true; + Context.TypeInspector.ApplyAttributes(Context, this, Configuration.Member); + Configuration.AttributesAreApplied = true; } base.OnCreateDefinition(definition); @@ -93,13 +93,13 @@ protected override void OnCreateDefinition( public ISortFieldDescriptor Name(string value) { - Definition.Name = value; + Configuration.Name = value; return this; } public ISortFieldDescriptor Ignore(bool ignore = true) { - Definition.Ignore = ignore; + Configuration.Ignore = ignore; return this; } diff --git a/src/HotChocolate/Data/src/Data/Sorting/SortInputTypeDescriptor.cs b/src/HotChocolate/Data/src/Data/Sorting/SortInputTypeDescriptor.cs index c357afa26e7..9e9e3075b7f 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/SortInputTypeDescriptor.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/SortInputTypeDescriptor.cs @@ -18,12 +18,12 @@ protected SortInputTypeDescriptor( : base(context) { Convention = context.GetSortConvention(scope); - Definition.EntityType = entityType ?? throw new ArgumentNullException(nameof(entityType)); - Definition.RuntimeType = typeof(object); - Definition.Name = Convention.GetTypeName(entityType); - Definition.Description = Convention.GetTypeDescription(entityType); - Definition.Fields.BindingBehavior = context.Options.DefaultBindingBehavior; - Definition.Scope = scope; + Configuration.EntityType = entityType ?? throw new ArgumentNullException(nameof(entityType)); + Configuration.RuntimeType = typeof(object); + Configuration.Name = Convention.GetTypeName(entityType); + Configuration.Description = Convention.GetTypeDescription(entityType); + Configuration.Fields.BindingBehavior = context.Options.DefaultBindingBehavior; + Configuration.Scope = scope; } protected SortInputTypeDescriptor( @@ -32,9 +32,9 @@ protected SortInputTypeDescriptor( : base(context) { Convention = context.GetSortConvention(scope); - Definition.RuntimeType = typeof(object); - Definition.EntityType = typeof(object); - Definition.Scope = scope; + Configuration.RuntimeType = typeof(object); + Configuration.EntityType = typeof(object); + Configuration.Scope = scope; } protected SortInputTypeDescriptor( @@ -44,28 +44,28 @@ protected SortInputTypeDescriptor( : base(context) { Convention = context.GetSortConvention(scope); - Definition = definition ?? throw new ArgumentNullException(nameof(definition)); + Configuration = definition ?? throw new ArgumentNullException(nameof(definition)); } protected ISortConvention Convention { get; } - protected internal override SortInputTypeDefinition Definition { get; protected set; } = + protected internal override SortInputTypeDefinition Configuration { get; protected set; } = new SortInputTypeDefinition(); protected BindableList Fields { get; } = []; - Type IHasRuntimeType.RuntimeType => Definition.RuntimeType; + Type IHasRuntimeType.RuntimeType => Configuration.RuntimeType; protected override void OnCreateDefinition( SortInputTypeDefinition definition) { Context.Descriptors.Push(this); - if (Definition is { AttributesAreApplied: false, EntityType: not null, }) + if (Configuration is { AttributesAreApplied: false, EntityType: not null, }) { - Context.TypeInspector.ApplyAttributes(Context, this, Definition.EntityType); - Definition.AttributesAreApplied = true; + Context.TypeInspector.ApplyAttributes(Context, this, Configuration.EntityType); + Configuration.AttributesAreApplied = true; } var fields = new Dictionary(StringComparer.Ordinal); @@ -79,7 +79,7 @@ protected override void OnCreateDefinition( OnCompleteFields(fields, handledProperties); - Definition.Fields.AddRange(fields.Values); + Configuration.Fields.AddRange(fields.Values); Context.Descriptors.Pop(); } @@ -93,8 +93,8 @@ protected virtual void OnCompleteFields( /// public ISortInputTypeDescriptor Name(string value) { - Definition.Name = value; - Definition.IsNamed = true; + Configuration.Name = value; + Configuration.IsNamed = true; return this; } @@ -102,14 +102,14 @@ public ISortInputTypeDescriptor Name(string value) public ISortInputTypeDescriptor Description( string? value) { - Definition.Description = value; + Configuration.Description = value; return this; } protected ISortInputTypeDescriptor BindFields( BindingBehavior bindingBehavior) { - Definition.Fields.BindingBehavior = bindingBehavior; + Configuration.Fields.BindingBehavior = bindingBehavior; return this; } @@ -123,11 +123,11 @@ protected ISortInputTypeDescriptor BindFieldsImplicitly() public ISortFieldDescriptor Field(string name) { var fieldDescriptor = - Fields.FirstOrDefault(t => t.Definition.Name == name); + Fields.FirstOrDefault(t => t.Configuration.Name == name); if (fieldDescriptor is null) { - fieldDescriptor = SortFieldDescriptor.New(Context, name, Definition.Scope); + fieldDescriptor = SortFieldDescriptor.New(Context, name, Configuration.Scope); Fields.Add(fieldDescriptor); } @@ -138,14 +138,14 @@ public ISortFieldDescriptor Field(string name) public ISortInputTypeDescriptor Ignore(string name) { var fieldDescriptor = - Fields.FirstOrDefault(t => t.Definition.Name == name); + Fields.FirstOrDefault(t => t.Configuration.Name == name); if (fieldDescriptor is null) { fieldDescriptor = SortFieldDescriptor.New( Context, name, - Definition.Scope); + Configuration.Scope); Fields.Add(fieldDescriptor); } @@ -158,7 +158,7 @@ public ISortInputTypeDescriptor Directive( TDirective directive) where TDirective : class { - Definition.AddDirective(directive, Context.TypeInspector); + Configuration.AddDirective(directive, Context.TypeInspector); return this; } @@ -166,7 +166,7 @@ public ISortInputTypeDescriptor Directive( public ISortInputTypeDescriptor Directive() where TDirective : class, new() { - Definition.AddDirective(new TDirective(), Context.TypeInspector); + Configuration.AddDirective(new TDirective(), Context.TypeInspector); return this; } @@ -175,7 +175,7 @@ public ISortInputTypeDescriptor Directive( string name, params ArgumentNode[] arguments) { - Definition.AddDirective(name, arguments); + Configuration.AddDirective(name, arguments); return this; } @@ -197,7 +197,7 @@ public static SortInputTypeDescriptor FromSchemaType( string? scope = null) { var descriptor = New(context, schemaType, scope); - descriptor.Definition.RuntimeType = typeof(object); + descriptor.Configuration.RuntimeType = typeof(object); return descriptor; } @@ -216,5 +216,5 @@ public static SortInputTypeDescriptor From( public static SortInputTypeDescriptor From( SortInputTypeDescriptor descriptor, string? scope = null) - => From(descriptor.Context, descriptor.Definition, scope); + => From(descriptor.Context, descriptor.Configuration, scope); } diff --git a/src/HotChocolate/Data/src/Data/Sorting/SortInputTypeDescriptor`1.cs b/src/HotChocolate/Data/src/Data/Sorting/SortInputTypeDescriptor`1.cs index 2dab21a8b28..689bbaae97d 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/SortInputTypeDescriptor`1.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/SortInputTypeDescriptor`1.cs @@ -41,14 +41,14 @@ protected override void OnCompleteFields( IDictionary fields, ISet handledProperties) { - if (Definition.Fields.IsImplicitBinding() && - Definition.EntityType is { }) + if (Configuration.Fields.IsImplicitBinding() && + Configuration.EntityType is { }) { FieldDescriptorUtilities.AddImplicitFields( this, - Definition.EntityType, + Configuration.EntityType, p => SortFieldDescriptor - .New(Context, Definition.Scope, p) + .New(Context, Configuration.Scope, p) .CreateConfiguration(), fields, handledProperties, @@ -102,11 +102,11 @@ public ISortFieldDescriptor Field(Expression> propertyOr { case PropertyInfo m: var fieldDescriptor = - Fields.FirstOrDefault(t => t.Definition.Member == m); + Fields.FirstOrDefault(t => t.Configuration.Member == m); if (fieldDescriptor is null) { - fieldDescriptor = SortFieldDescriptor.New(Context, Definition.Scope, m); + fieldDescriptor = SortFieldDescriptor.New(Context, Configuration.Scope, m); Fields.Add(fieldDescriptor); } @@ -119,7 +119,7 @@ public ISortFieldDescriptor Field(Expression> propertyOr default: fieldDescriptor = SortFieldDescriptor - .New(Context, Definition.Scope, propertyOrMember); + .New(Context, Configuration.Scope, propertyOrMember); Fields.Add(fieldDescriptor); return fieldDescriptor; } @@ -138,11 +138,11 @@ public ISortInputTypeDescriptor Ignore(Expression> propertyO if (propertyOrMember.ExtractMember() is PropertyInfo p) { var fieldDescriptor = - Fields.FirstOrDefault(t => t.Definition.Member == p); + Fields.FirstOrDefault(t => t.Configuration.Member == p); if (fieldDescriptor is null) { - fieldDescriptor = IgnoreSortFieldDescriptor.New(Context, Definition.Scope, p); + fieldDescriptor = IgnoreSortFieldDescriptor.New(Context, Configuration.Scope, p); Fields.Add(fieldDescriptor); } From de350dc168d8f034cfcc078e69ecabe96173072c Mon Sep 17 00:00:00 2001 From: Michael Staib Date: Thu, 17 Apr 2025 23:14:59 +0200 Subject: [PATCH 9/9] edits --- .../UseListPostProcessorAttribute.cs | 3 +- .../InterfaceFieldConfiguration.cs | 11 ----- .../Definitions/ObjectFieldConfiguration.cs | 11 ----- .../Definitions/OutputFieldConfiguration.cs | 14 +++++- .../Core/src/Types/Types/ObjectField.cs | 22 +++++----- .../Core/src/Types/Types/OutputFieldBase.cs | 13 ++++-- .../QueryableTakeHandlerInterceptor.cs | 2 +- .../MongoDbAscendingSortOperationHandler.cs | 9 +--- .../MongoDbDescendingSortOperationHandler.cs | 9 +--- .../MongoDbSortOperationHandlerBase.cs | 19 +++----- .../MongoDbAggregateFluentTests.cs | 23 ++++------ .../MongoDbCollectionTests.cs | 8 ++-- .../MongoDbFindFluentTests.cs | 14 +++--- .../MongoDbSortVisitorBooleanTests.cs | 10 ++--- .../MongoDbSortVisitorComparableTests.cs | 14 +++--- .../MongoDbSortVisitorEnumTests.cs | 20 ++++----- .../MongoDbSortVisitorObjectTests.cs | 44 +++++++++---------- .../MongoDbSortVisitorStringTests.cs | 10 ++--- 18 files changed, 114 insertions(+), 142 deletions(-) diff --git a/src/HotChocolate/Core/src/Types/Types/Attributes/UseListPostProcessorAttribute.cs b/src/HotChocolate/Core/src/Types/Types/Attributes/UseListPostProcessorAttribute.cs index 410c3dc9e37..f705cb41354 100644 --- a/src/HotChocolate/Core/src/Types/Types/Attributes/UseListPostProcessorAttribute.cs +++ b/src/HotChocolate/Core/src/Types/Types/Attributes/UseListPostProcessorAttribute.cs @@ -11,6 +11,5 @@ protected override void OnConfigure( IDescriptorContext context, IObjectFieldDescriptor descriptor, MemberInfo member) - => descriptor.ExtendWith( - c => c.Configuration.ResultPostProcessor = ListPostProcessor.Default); + => descriptor.ExtendWith(c => c.Configuration.ResultPostProcessor = ListPostProcessor.Default); } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InterfaceFieldConfiguration.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InterfaceFieldConfiguration.cs index 8599ebf7bca..a1c5c774679 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InterfaceFieldConfiguration.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InterfaceFieldConfiguration.cs @@ -68,11 +68,6 @@ public InterfaceFieldConfiguration( /// public MemberInfo? ResolverMember { get; set; } - /// - /// The result type of the resolver. - /// - public Type? ResultType { get; set; } - /// /// The delegate that represents the resolver. /// @@ -298,7 +293,6 @@ internal void CopyTo(ObjectFieldConfiguration target) target.Member = Member; target.BindToField = BindToField; target.ResolverMember = ResolverMember; - target.ResultType = ResultType; target.Resolver = Resolver; target.PureResolver = PureResolver; target.IsParallelExecutable = IsParallelExecutable; @@ -361,11 +355,6 @@ internal void MergeInto(InterfaceFieldConfiguration target) target.ResolverMember = ResolverMember; } - if (ResultType is not null) - { - target.ResultType = ResultType; - } - if (Resolver is not null) { target.Resolver = Resolver; diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ObjectFieldConfiguration.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ObjectFieldConfiguration.cs index b4a399884ff..a2c9cf2b778 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ObjectFieldConfiguration.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ObjectFieldConfiguration.cs @@ -78,11 +78,6 @@ public ObjectFieldConfiguration( /// public Expression? Expression { get; set; } - /// - /// The result type of the resolver. - /// - public Type? ResultType { get; set; } - /// /// The member name that represents the event stream factory. /// @@ -295,7 +290,6 @@ internal void CopyTo(ObjectFieldConfiguration target) target.BindToField = BindToField; target.ResolverMember = ResolverMember; target.Expression = Expression; - target.ResultType = ResultType; target.Resolver = Resolver; target.PureResolver = PureResolver; target.SubscribeResolver = SubscribeResolver; @@ -366,11 +360,6 @@ internal void MergeInto(ObjectFieldConfiguration target) target.Expression = Expression; } - if (ResultType is not null) - { - target.ResultType = ResultType; - } - if (Resolver is not null) { target.Resolver = Resolver; diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/OutputFieldConfiguration.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/OutputFieldConfiguration.cs index 9697a63fd9c..43e6b905d08 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/OutputFieldConfiguration.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/OutputFieldConfiguration.cs @@ -8,6 +8,11 @@ public class OutputFieldConfiguration : FieldConfiguration, IDeprecationConfigur { private List? _arguments; + /// + /// The result type of the resolver. + /// + public Type? ResultType { get; set; } + public IList Arguments => _arguments ??= []; @@ -20,7 +25,7 @@ public IReadOnlyList GetArguments() { if (_arguments is null) { - return Array.Empty(); + return []; } return _arguments; @@ -30,6 +35,8 @@ protected void CopyTo(OutputFieldConfiguration target) { base.CopyTo(target); + target.ResultType = ResultType; + if (_arguments?.Count > 0) { target._arguments = []; @@ -49,6 +56,11 @@ protected void MergeInto(OutputFieldConfiguration target) { base.MergeInto(target); + if (ResultType is not null) + { + target.ResultType = ResultType; + } + if (_arguments is { Count: > 0, }) { target._arguments ??= []; diff --git a/src/HotChocolate/Core/src/Types/Types/ObjectField.cs b/src/HotChocolate/Core/src/Types/Types/ObjectField.cs index bc1abee9bdc..1e6b56634a8 100644 --- a/src/HotChocolate/Core/src/Types/Types/ObjectField.cs +++ b/src/HotChocolate/Core/src/Types/Types/ObjectField.cs @@ -162,7 +162,8 @@ private void CompleteResolver( } var skipMiddleware = - options.FieldMiddleware is not FieldMiddlewareApplication.AllFields && isIntrospectionField; + options.FieldMiddleware is not FieldMiddlewareApplication.AllFields + && isIntrospectionField; var resolvers = definition.Resolvers; Resolver = resolvers.Resolver; @@ -220,9 +221,9 @@ private void CompleteResolver( } bool IsPureContext() - { - return skipMiddleware || (context.GlobalComponents.Count == 0 && fieldMiddlewareDefinitions.Count == 0); - } + => skipMiddleware + || (context.GlobalComponents.Count == 0 + && fieldMiddlewareDefinitions.Count == 0); static Type GetResultType(ObjectFieldConfiguration definition, Type runtimeType) { @@ -239,7 +240,7 @@ static Type GetResultType(ObjectFieldConfiguration definition, Type runtimeType) file static class ResolverHelpers { - private static readonly ConcurrentDictionary _methodCache = new(); + private static readonly ConcurrentDictionary _methodCache = new(); private static readonly MethodInfo _createListPostProcessor = typeof(ResolverHelpers).GetMethod( @@ -253,16 +254,17 @@ file static class ResolverHelpers if (extendedType.IsArrayOrList) { var elementType = extendedType.ElementType!.Type; - var generic = GetFactoryMethod(elementType); - return (IResolverResultPostProcessor?)generic.Invoke(null, []); + return GetFactoryMethod(elementType); } return null; } - private static MethodInfo GetFactoryMethod(Type elementType) - => _methodCache.GetOrAdd(elementType, static type => _createListPostProcessor.MakeGenericMethod(type)); + private static IResolverResultPostProcessor GetFactoryMethod(Type elementType) + => _methodCache.GetOrAdd( + elementType, + static t => (IResolverResultPostProcessor)_createListPostProcessor.MakeGenericMethod(t).Invoke(null, [])!); private static IResolverResultPostProcessor CreateListPostProcessor() - => new ListPostProcessor(); + => ListPostProcessor.Default; } diff --git a/src/HotChocolate/Core/src/Types/Types/OutputFieldBase.cs b/src/HotChocolate/Core/src/Types/Types/OutputFieldBase.cs index b77dddfdc04..9412eae5470 100644 --- a/src/HotChocolate/Core/src/Types/Types/OutputFieldBase.cs +++ b/src/HotChocolate/Core/src/Types/Types/OutputFieldBase.cs @@ -62,11 +62,18 @@ protected virtual void OnCompleteField( Type = context.GetType(definition.Type!).EnsureOutputType(); _runtimeType = CompleteRuntimeType(Type, null); - Arguments = OnCompleteFields(context, definition); + + if (_runtimeType == typeof(object) + && definition is ObjectFieldConfiguration { ResultType: not null } objectFieldCfg + && objectFieldCfg.ResultType != typeof(object)) + { + _runtimeType = CompleteRuntimeType(Type, objectFieldCfg.ResultType); + } + + Arguments = OnCompleteArguments(context, definition); } - // TODO: V15: should be renamed to OnCompleteArguments - protected virtual FieldCollection OnCompleteFields( + protected virtual FieldCollection OnCompleteArguments( ITypeCompletionContext context, OutputFieldConfiguration definition) { diff --git a/src/HotChocolate/Data/src/Data/Projections/Expressions/Interceptor/QueryableTakeHandlerInterceptor.cs b/src/HotChocolate/Data/src/Data/Projections/Expressions/Interceptor/QueryableTakeHandlerInterceptor.cs index 3d1fd1f873e..42ad62ce3a9 100644 --- a/src/HotChocolate/Data/src/Data/Projections/Expressions/Interceptor/QueryableTakeHandlerInterceptor.cs +++ b/src/HotChocolate/Data/src/Data/Projections/Expressions/Interceptor/QueryableTakeHandlerInterceptor.cs @@ -37,7 +37,7 @@ public void BeforeProjection( Expression.Call( typeof(Enumerable), nameof(Enumerable.Take), - [selection.Type.ToRuntimeType(),], + [selection.Type.ToRuntimeType()], instance, Expression.Constant(_take))); } diff --git a/src/HotChocolate/MongoDb/src/Data/Sorting/Handlers/MongoDbAscendingSortOperationHandler.cs b/src/HotChocolate/MongoDb/src/Data/Sorting/Handlers/MongoDbAscendingSortOperationHandler.cs index f3a8e829097..8772f2e424f 100644 --- a/src/HotChocolate/MongoDb/src/Data/Sorting/Handlers/MongoDbAscendingSortOperationHandler.cs +++ b/src/HotChocolate/MongoDb/src/Data/Sorting/Handlers/MongoDbAscendingSortOperationHandler.cs @@ -3,10 +3,5 @@ namespace HotChocolate.Data.MongoDb.Sorting; -public class MongoDbAscendingSortOperationHandler : MongoDbSortOperationHandlerBase -{ - public MongoDbAscendingSortOperationHandler() - : base(DefaultSortOperations.Ascending, SortDirection.Ascending) - { - } -} +public class MongoDbAscendingSortOperationHandler() + : MongoDbSortOperationHandlerBase(DefaultSortOperations.Ascending, SortDirection.Ascending); diff --git a/src/HotChocolate/MongoDb/src/Data/Sorting/Handlers/MongoDbDescendingSortOperationHandler.cs b/src/HotChocolate/MongoDb/src/Data/Sorting/Handlers/MongoDbDescendingSortOperationHandler.cs index 544110befb3..87248b797c7 100644 --- a/src/HotChocolate/MongoDb/src/Data/Sorting/Handlers/MongoDbDescendingSortOperationHandler.cs +++ b/src/HotChocolate/MongoDb/src/Data/Sorting/Handlers/MongoDbDescendingSortOperationHandler.cs @@ -3,10 +3,5 @@ namespace HotChocolate.Data.MongoDb.Sorting; -public class MongoDbDescendingSortOperationHandler : MongoDbSortOperationHandlerBase -{ - public MongoDbDescendingSortOperationHandler() - : base(DefaultSortOperations.Descending, SortDirection.Descending) - { - } -} +public class MongoDbDescendingSortOperationHandler() + : MongoDbSortOperationHandlerBase(DefaultSortOperations.Descending, SortDirection.Descending); diff --git a/src/HotChocolate/MongoDb/src/Data/Sorting/Handlers/MongoDbSortOperationHandlerBase.cs b/src/HotChocolate/MongoDb/src/Data/Sorting/Handlers/MongoDbSortOperationHandlerBase.cs index a21341da813..4f8f6e2c246 100644 --- a/src/HotChocolate/MongoDb/src/Data/Sorting/Handlers/MongoDbSortOperationHandlerBase.cs +++ b/src/HotChocolate/MongoDb/src/Data/Sorting/Handlers/MongoDbSortOperationHandlerBase.cs @@ -12,27 +12,18 @@ namespace HotChocolate.Data.MongoDb.Sorting; /// Represents a mongodb handler that can be bound to a . The handler is /// executed during the visitation of a input object. /// -public abstract class MongoDbSortOperationHandlerBase +public abstract class MongoDbSortOperationHandlerBase( + int operation, + SortDirection sortDirection) : SortOperationHandler { - private readonly SortDirection _sortDirection; - private readonly int _operation; - - protected MongoDbSortOperationHandlerBase( - int operation, - SortDirection sortDirection) - { - _sortDirection = sortDirection; - _operation = operation; - } - /// public override bool CanHandle( ITypeCompletionContext context, EnumTypeConfiguration typeDefinition, SortEnumValueConfiguration valueConfiguration) { - return valueConfiguration.Operation == _operation; + return valueConfiguration.Operation == operation; } /// @@ -53,7 +44,7 @@ public override bool TryHandleEnter( } context.Operations.Enqueue( - new MongoDbDirectionalSortOperation(context.GetPath(), _sortDirection)); + new MongoDbDirectionalSortOperation(context.GetPath(), sortDirection)); action = SyntaxVisitor.Continue; return true; diff --git a/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbAggregateFluentTests.cs b/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbAggregateFluentTests.cs index e7405c31d05..2d9144aaa70 100644 --- a/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbAggregateFluentTests.cs +++ b/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbAggregateFluentTests.cs @@ -11,26 +11,20 @@ namespace HotChocolate.Data.MongoDb.Sorting; -public class MongoDbAggregateFluentTests : IClassFixture +public class MongoDbAggregateFluentTests(MongoResource resource) : IClassFixture { private static readonly Foo[] _fooEntities = [ - new Foo { Bar = true, }, new Foo { Bar = false, }, + new() { Bar = true }, + new() { Bar = false } ]; private static readonly Bar[] _barEntities = [ - new Bar { Baz = new DateTimeOffset(2020, 1, 12, 0, 0, 0, TimeSpan.Zero), }, - new Bar { Baz = new DateTimeOffset(2020, 1, 11, 0, 0, 0, TimeSpan.Zero), }, + new() { Baz = new DateTimeOffset(2020, 1, 12, 0, 0, 0, TimeSpan.Zero) }, + new() { Baz = new DateTimeOffset(2020, 1, 11, 0, 0, 0, TimeSpan.Zero) } ]; - private readonly MongoResource _resource; - - public MongoDbAggregateFluentTests(MongoResource resource) - { - _resource = resource; - } - [Fact] public async Task BsonElement_Rename() { @@ -38,7 +32,7 @@ public async Task BsonElement_Rename() var tester = CreateSchema( () => { - var collection = _resource.CreateCollection("data_" + Guid.NewGuid().ToString("N")); + var collection = resource.CreateCollection("data_" + Guid.NewGuid().ToString("N")); collection.InsertMany(_fooEntities); return collection.Aggregate().AsExecutable(); }); @@ -75,7 +69,7 @@ public async Task Collection_Configuration() () => { var collection = - _resource.CreateCollection("data_" + Guid.NewGuid().ToString("N")); + resource.CreateCollection("data_" + Guid.NewGuid().ToString("N")); collection.InsertMany(_barEntities); return collection.Aggregate().AsExecutable(); @@ -131,8 +125,7 @@ private static IRequestExecutor CreateSchema( .Name("Query") .Field("root") .Type>>() - .Resolve( - async ctx => await new ValueTask>(resolver())) + .Resolve(async _ => await new ValueTask>(resolver())) .Use( next => async context => { diff --git a/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbCollectionTests.cs b/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbCollectionTests.cs index 72b7c1bd296..934311241a6 100644 --- a/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbCollectionTests.cs +++ b/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbCollectionTests.cs @@ -14,14 +14,14 @@ public class MongoDbSortCollectionTests : IClassFixture { private static readonly Foo[] _fooEntities = [ - new() { Bar = true, }, - new() { Bar = false, }, + new() { Bar = true }, + new() { Bar = false } ]; private static readonly Bar[] _barEntities = [ - new() { Baz = new DateTimeOffset(2020, 1, 12, 0, 0, 0, TimeSpan.Zero), }, - new() { Baz = new DateTimeOffset(2020, 1, 11, 0, 0, 0, TimeSpan.Zero), }, + new() { Baz = new DateTimeOffset(2020, 1, 12, 0, 0, 0, TimeSpan.Zero) }, + new() { Baz = new DateTimeOffset(2020, 1, 11, 0, 0, 0, TimeSpan.Zero) } ]; private readonly MongoResource _resource; diff --git a/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbFindFluentTests.cs b/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbFindFluentTests.cs index 243419ed6a6..354d1d1b081 100644 --- a/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbFindFluentTests.cs +++ b/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbFindFluentTests.cs @@ -15,21 +15,21 @@ public class MongoDbFindFluentTests : IClassFixture { private static readonly Foo[] _fooEntities = [ - new() { Bar = true, }, - new() { Bar = false, }, + new() { Bar = true }, + new() { Bar = false } ]; private static readonly Bar[] _barEntities = [ - new() { Baz = new DateTimeOffset(2020, 1, 12, 0, 0, 0, TimeSpan.Zero), }, - new() { Baz = new DateTimeOffset(2020, 1, 11, 0, 0, 0, TimeSpan.Zero), }, + new() { Baz = new DateTimeOffset(2020, 1, 12, 0, 0, 0, TimeSpan.Zero) }, + new() { Baz = new DateTimeOffset(2020, 1, 11, 0, 0, 0, TimeSpan.Zero) } ]; private static readonly Baz[] _bazEntities = [ - new() { Bar = new DateTimeOffset(2020, 1, 12, 0, 0, 0, TimeSpan.Zero), Qux = 1, }, - new() { Bar = new DateTimeOffset(2020, 1, 11, 0, 0, 0, TimeSpan.Zero), Qux = 0, }, - new() { Bar = new DateTimeOffset(1996, 1, 11, 0, 0, 0, TimeSpan.Zero), Qux = -1, }, + new() { Bar = new DateTimeOffset(2020, 1, 12, 0, 0, 0, TimeSpan.Zero), Qux = 1 }, + new() { Bar = new DateTimeOffset(2020, 1, 11, 0, 0, 0, TimeSpan.Zero), Qux = 0 }, + new() { Bar = new DateTimeOffset(1996, 1, 11, 0, 0, 0, TimeSpan.Zero), Qux = -1 } ]; private readonly MongoResource _resource; diff --git a/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbSortVisitorBooleanTests.cs b/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbSortVisitorBooleanTests.cs index cb2ae0a4402..6fa7ddd052f 100644 --- a/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbSortVisitorBooleanTests.cs +++ b/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbSortVisitorBooleanTests.cs @@ -12,15 +12,15 @@ public class MongoDbSortVisitorBooleanTests { private static readonly Foo[] _fooEntities = [ - new() { Bar = true, }, - new() { Bar = false, }, + new() { Bar = true }, + new() { Bar = false } ]; private static readonly FooNullable[] _fooNullableEntities = [ - new() { Bar = true, }, - new() { Bar = null, }, - new() { Bar = false, }, + new() { Bar = true }, + new() { Bar = null }, + new() { Bar = false } ]; public MongoDbSortVisitorBooleanTests(MongoResource resource) diff --git a/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbSortVisitorComparableTests.cs b/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbSortVisitorComparableTests.cs index f56907c26a2..3073138c81e 100644 --- a/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbSortVisitorComparableTests.cs +++ b/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbSortVisitorComparableTests.cs @@ -12,17 +12,17 @@ public class MongoDbSortVisitorComparableTests { private static readonly Foo[] _fooEntities = [ - new() { BarShort = 12, }, - new() { BarShort = 14, }, - new() { BarShort = 13, }, + new() { BarShort = 12 }, + new() { BarShort = 14 }, + new() { BarShort = 13 } ]; private static readonly FooNullable[] _fooNullableEntities = [ - new() { BarShort = 12, }, - new() { BarShort = null, }, - new() { BarShort = 14, }, - new() { BarShort = 13, }, + new() { BarShort = 12 }, + new() { BarShort = null }, + new() { BarShort = 14 }, + new() { BarShort = 13 } ]; public MongoDbSortVisitorComparableTests(MongoResource resource) diff --git a/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbSortVisitorEnumTests.cs b/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbSortVisitorEnumTests.cs index 4f0650ec77f..f7a4822103a 100644 --- a/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbSortVisitorEnumTests.cs +++ b/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbSortVisitorEnumTests.cs @@ -12,19 +12,19 @@ public class MongoDbSortVisitorEnumTests { private static readonly Foo[] _fooEntities = [ - new() { BarEnum = FooEnum.BAR, }, - new() { BarEnum = FooEnum.BAZ, }, - new() { BarEnum = FooEnum.FOO, }, - new() { BarEnum = FooEnum.QUX, }, + new() { BarEnum = FooEnum.BAR }, + new() { BarEnum = FooEnum.BAZ }, + new() { BarEnum = FooEnum.FOO }, + new() { BarEnum = FooEnum.QUX } ]; private static readonly FooNullable[] _fooNullableEntities = [ - new() { BarEnum = FooEnum.BAR, }, - new() { BarEnum = FooEnum.BAZ, }, - new() { BarEnum = FooEnum.FOO, }, - new() { BarEnum = null, }, - new() { BarEnum = FooEnum.QUX, }, + new() { BarEnum = FooEnum.BAR }, + new() { BarEnum = FooEnum.BAZ }, + new() { BarEnum = FooEnum.FOO }, + new() { BarEnum = null }, + new() { BarEnum = FooEnum.QUX } ]; public MongoDbSortVisitorEnumTests(MongoResource resource) @@ -106,7 +106,7 @@ public enum FooEnum FOO, BAR, BAZ, - QUX, + QUX } public class FooSortType : SortInputType diff --git a/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbSortVisitorObjectTests.cs b/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbSortVisitorObjectTests.cs index bda04ddfc39..cf4d4fedb33 100644 --- a/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbSortVisitorObjectTests.cs +++ b/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbSortVisitorObjectTests.cs @@ -22,9 +22,9 @@ public class MongoDbSortVisitorObjectTests BarString = "testatest", ObjectArray = [ - new() { Foo = new Foo { BarShort = 12, BarString = "a", }, }, - ], - }, + new() { Foo = new Foo { BarShort = 12, BarString = "a" } } + ] + } }, new() { @@ -36,9 +36,9 @@ public class MongoDbSortVisitorObjectTests BarString = "testbtest", ObjectArray = [ - new() { Foo = new Foo { BarShort = 14, BarString = "d", }, }, - ], - }, + new() { Foo = new Foo { BarShort = 14, BarString = "d" } } + ] + } }, new() { @@ -48,9 +48,9 @@ public class MongoDbSortVisitorObjectTests BarBool = false, BarEnum = BarEnum.FOO, BarString = "testctest", - ObjectArray = null!, - }, - }, + ObjectArray = null! + } + } ]; private static readonly BarNullable?[] _barNullableEntities = @@ -65,9 +65,9 @@ public class MongoDbSortVisitorObjectTests BarString = "testatest", ObjectArray = new List { - new() { Foo = new FooNullable { BarShort = 12, }, }, - }, - }, + new() { Foo = new FooNullable { BarShort = 12 } } + } + } }, new() { @@ -79,9 +79,9 @@ public class MongoDbSortVisitorObjectTests BarString = "testbtest", ObjectArray = new List { - new() { Foo = new FooNullable { BarShort = null, }, }, - }, - }, + new() { Foo = new FooNullable { BarShort = null } } + } + } }, new() { @@ -93,9 +93,9 @@ public class MongoDbSortVisitorObjectTests BarString = "testctest", ObjectArray = new List { - new() { Foo = new FooNullable { BarShort = 14, }, }, - }, - }, + new() { Foo = new FooNullable { BarShort = 14 } } + } + } }, new() { @@ -105,10 +105,10 @@ public class MongoDbSortVisitorObjectTests BarBool = false, BarEnum = BarEnum.FOO, BarString = "testdtest", - ObjectArray = null, - }, + ObjectArray = null + } }, - new() { Foo = null, }, + new() { Foo = null } ]; public MongoDbSortVisitorObjectTests(MongoResource resource) @@ -423,6 +423,6 @@ public enum BarEnum FOO, BAR, BAZ, - QUX, + QUX } } diff --git a/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbSortVisitorStringTests.cs b/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbSortVisitorStringTests.cs index 78ac7362fdd..32b4b8866af 100644 --- a/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbSortVisitorStringTests.cs +++ b/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/MongoDbSortVisitorStringTests.cs @@ -12,15 +12,15 @@ public class MongoDbSortVisitorStringTests { private static readonly Foo[] _fooEntities = [ - new() { Bar = "testatest", }, - new() { Bar = "testbtest", }, + new() { Bar = "testatest" }, + new() { Bar = "testbtest" } ]; private static readonly FooNullable[] _fooNullableEntities = [ - new() { Bar = "testatest", }, - new() { Bar = "testbtest", }, - new() { Bar = null, }, + new() { Bar = "testatest" }, + new() { Bar = "testbtest" }, + new() { Bar = null } ]; public MongoDbSortVisitorStringTests(MongoResource resource)