From 802c9b85e768e47c3499d9bcc97d4c929eae80c1 Mon Sep 17 00:00:00 2001 From: Michael Staib Date: Thu, 19 Jan 2023 15:57:33 +0100 Subject: [PATCH] Removed TypeReference Interface (#5696) --- ...orizationTypeInterceptor.ObjectTypeInfo.cs | 2 +- .../AuthorizationTypeInterceptor.State.cs | 10 +++---- .../AuthorizationTypeInterceptor.cs | 14 +++++----- .../Generators/DataLoaderGenerator.cs | 2 -- .../Types.CursorPagination/ConnectionType.cs | 6 ++--- .../src/Types.CursorPagination/EdgeType.cs | 6 ++--- .../PagingObjectFieldDescriptorExtensions.cs | 14 +++++----- .../MutationConventionTypeInterceptor.cs | 16 +++++------ .../MutationResultTypeDiscoveryHandler.cs | 6 ++--- .../CollectionSegmentType~1.cs | 2 +- ...etPagingObjectFieldDescriptorExtensions.cs | 8 +++--- .../Configuration/AggregateTypeInterceptor.cs | 4 +-- .../Contracts/ITypeCompletionContext.cs | 8 +++--- .../Contracts/ITypeSystemObjectContext.cs | 4 +-- .../Handlers/DefaultTypeDiscoveryHandler.cs | 8 +++--- .../DependantFactoryTypeReferenceHandler.cs | 2 +- .../ExtendedTypeDirectiveReferenceHandler.cs | 2 +- .../Handlers/ExtendedTypeReferenceHandler.cs | 2 +- .../Handlers/FactoryTypeReferenceHandler.cs | 2 +- .../Handlers/ITypeRegistrarHandler.cs | 2 +- .../Handlers/ScalarTypeDiscoveryHandler.cs | 8 +++--- .../Handlers/SchemaTypeReferenceHandler.cs | 2 +- .../Handlers/SyntaxTypeReferenceHandler.cs | 2 +- .../Configuration/Handlers/TypeRefHelper.cs | 4 +-- .../src/Types/Configuration/ITypeRegistrar.cs | 10 +++---- .../RegisteredType.CompletionContext.cs | 10 +++---- .../RegisteredType.DiscoveryContext.cs | 2 +- .../src/Types/Configuration/RegisteredType.cs | 2 +- .../src/Types/Configuration/TypeDiscoverer.cs | 8 +++--- ...ypeDiscoveryDescriptorContextExtensions.cs | 4 +-- .../Types/Configuration/TypeInitializer.cs | 24 ++++++++--------- .../Types/Configuration/TypeInterceptor.cs | 4 +-- .../src/Types/Configuration/TypeLookup.cs | 8 +++--- .../Configuration/TypeReferenceResolver.cs | 12 ++++----- .../src/Types/Configuration/TypeRegistrar.cs | 16 +++++------ .../src/Types/Configuration/TypeRegistry.cs | 24 ++++++++--------- .../Types/Internal/TypeDiscoveryHandler.cs | 6 ++--- .../src/Types/Internal/TypeDiscoveryInfo.cs | 2 +- .../src/Types/Internal/TypeExtensionHelper.cs | 6 ++--- .../Core/src/Types/SchemaBuilder.Setup.cs | 18 ++++++------- .../Core/src/Types/SchemaBuilder.cs | 2 +- .../Descriptors/ArgumentDescriptorBase~1.cs | 4 +-- .../Conventions/DefaultTypeInspector.cs | 8 +++--- .../Descriptors/Conventions/ITypeInspector.cs | 4 +-- .../Conventions/TypeInspectorExtensions.cs | 8 +++--- .../Definitions/ArgumentDefinition.cs | 2 +- .../Definitions/CompleteConfiguration.cs | 4 +-- .../DirectiveArgumentDefinition.cs | 2 +- .../Definitions/DirectiveDefinition.cs | 2 +- .../Definitions/FieldDefinitionBase.cs | 2 +- .../IComplexOutputTypeDefinition.cs | 2 +- .../Definitions/InputFieldDefinition.cs | 2 +- .../Definitions/InterfaceFieldDefinition.cs | 2 +- .../Definitions/InterfaceTypeDefinition.cs | 8 +++--- .../Definitions/ObjectFieldDefinition.cs | 2 +- .../Definitions/ObjectTypeDefinition.cs | 14 +++++----- .../Descriptors/Definitions/TypeDependency.cs | 6 ++--- .../Definitions/UnionTypeDefinition.cs | 2 +- .../DependantFactoryTypeReference.cs | 8 +++--- .../ExtendedTypeDirectiveReference.cs | 2 +- .../TypeReferences/ExtendedTypeReference.cs | 2 +- .../TypeReferences/ITypeReference.cs | 27 ------------------- .../TypeReferences/NameDirectiveReference.cs | 2 +- .../TypeReferences/SchemaTypeReference.cs | 2 +- .../TypeReferences/SyntaxTypeReference.cs | 2 +- .../TypeReferences/TypeReference.cs | 10 +++---- .../TypeReferences/TypeReferenceExtensions.cs | 4 +-- .../src/Types/Types/Directives/Directives.cs | 4 +-- .../Factories/SchemaSyntaxVisitorContext.cs | 2 +- .../Types/Helpers/CompleteInterfacesHelper.cs | 2 +- .../Types/Types/Helpers/DescriptorHelpers.cs | 4 +-- .../Interceptors/FlagEnumTypeInterceptor.cs | 4 +-- .../Interceptors/ResolverTypeInterceptor.cs | 4 +-- .../Types/Introspection/IntrospectionTypes.cs | 4 +-- .../Types/Relay/QueryFieldTypeInterceptor.cs | 2 +- .../Core/src/Types/Utilities/ThrowHelper.cs | 2 +- .../Configuration/TypeModuleTests.cs | 1 - ...orBuilderExtensions_TypeDiscovery.Tests.cs | 4 +-- .../Core/test/Types.Analyzers.Tests/Log.txt | 6 +++++ .../Configuration/TypeDiscovererTests.cs | 12 ++++----- .../Configuration/TypeInitializerTests.cs | 12 ++++----- .../TypeReferences/ClrTypeReferenceTests.cs | 26 +++++++++--------- .../SchemaTypeReferenceTests.cs | 16 +++++------ .../SyntaxTypeReferenceTests.cs | 26 +++++++++--------- .../Filters/Convention/FilterConvention.cs | 4 +-- .../Convention/FilterConventionDefinition.cs | 4 +-- .../Convention/FilterConventionDescriptor.cs | 2 +- .../Filters/Convention/IFilterConvention.cs | 2 +- .../Convention/TypeReferenceComparer.cs | 8 +++--- .../FilterFieldDescriptorExtensions.cs | 2 +- .../FilterObjectFieldDescriptorExtensions.cs | 4 +-- .../Sorting/Convention/ISortConvention.cs | 4 +-- .../Data/Sorting/Convention/SortConvention.cs | 8 +++--- .../Convention/SortConventionDefinition.cs | 8 +++--- .../Convention/SortConventionDescriptor.cs | 2 +- .../Convention/TypeReferenceComparer.cs | 8 +++--- .../SortObjectFieldDescriptorExtensions.cs | 2 +- .../ArrayBooleanFilterOperationDescriptor.cs | 4 +-- .../Array/ArrayFilterOperationDescriptor.cs | 4 +-- .../Array/ArrayFilterOperationDescriptor~1.cs | 4 +-- .../BooleanFilterOperationDescriptor.cs | 4 +-- .../BooleanFilterOperationDescriptorBase.cs | 2 +- .../ComparableFilterOperationDescriptor.cs | 4 +-- .../FilterObjectFieldDescriptorExtensions.cs | 4 +-- .../FilterFieldDescriptorBase.cs | 10 +++---- .../Object/ObjectFilterOperationDescriptor.cs | 4 +-- .../ObjectFilterOperationDescriptor~1.cs | 4 +-- .../String/StringFilterOperationDescriptor.cs | 4 +-- .../SortObjectFieldDescriptorExtensions.cs | 4 +-- .../IgnoredSortingFieldDescriptor.cs | 4 +-- .../SortObjectOperationDescriptor.cs | 4 +-- .../SortObjectOperationDescriptor~1.cs | 4 +-- .../Types.Sorting/SortOperationDescriptor.cs | 4 +-- .../SortOperationDescriptorBase.cs | 2 +- .../RedisQueryStorageTests.cs | 2 +- .../SpatialCompletionContextExtensions.cs | 2 +- 116 files changed, 333 insertions(+), 357 deletions(-) delete mode 100644 src/HotChocolate/Core/src/Types/Types/Descriptors/TypeReferences/ITypeReference.cs create mode 100644 src/HotChocolate/Core/test/Types.Analyzers.Tests/Log.txt diff --git a/src/HotChocolate/Core/src/Authorization/AuthorizationTypeInterceptor.ObjectTypeInfo.cs b/src/HotChocolate/Core/src/Authorization/AuthorizationTypeInterceptor.ObjectTypeInfo.cs index e20ecfa6018..efa5cae2008 100644 --- a/src/HotChocolate/Core/src/Authorization/AuthorizationTypeInterceptor.ObjectTypeInfo.cs +++ b/src/HotChocolate/Core/src/Authorization/AuthorizationTypeInterceptor.ObjectTypeInfo.cs @@ -16,6 +16,6 @@ public ObjectTypeInfo(ITypeCompletionContext context, ObjectTypeDefinition typeD TypeRef = TypeReg.TypeReference; } - public ITypeReference TypeRef { get; } + public TypeReference TypeRef { get; } } } diff --git a/src/HotChocolate/Core/src/Authorization/AuthorizationTypeInterceptor.State.cs b/src/HotChocolate/Core/src/Authorization/AuthorizationTypeInterceptor.State.cs index b3f66e3b09d..3192b7b3357 100644 --- a/src/HotChocolate/Core/src/Authorization/AuthorizationTypeInterceptor.State.cs +++ b/src/HotChocolate/Core/src/Authorization/AuthorizationTypeInterceptor.State.cs @@ -22,26 +22,26 @@ public State(AuthorizationOptions options) /// /// Gets the types to which authorization middleware need to be applied. /// - public HashSet NeedsAuth { get; } = new(); + public HashSet NeedsAuth { get; } = new(); /// /// Gets the types to which are annotated with the @authorize directive. /// - public HashSet AuthTypes { get; } = new(); + public HashSet AuthTypes { get; } = new(); /// /// Gets a lookup table from abstract types to concrete types that need authorization. /// - public Dictionary> AbstractToConcrete { get; } = new(); + public Dictionary> AbstractToConcrete { get; } = new(); /// /// Gets a helper queue for processing types. /// - public List Queue { get; } = new(); + public List Queue { get; } = new(); /// /// Gets a helper set for tracking process completion. /// - public HashSet Completed { get; } = new(); + public HashSet Completed { get; } = new(); } } diff --git a/src/HotChocolate/Core/src/Authorization/AuthorizationTypeInterceptor.cs b/src/HotChocolate/Core/src/Authorization/AuthorizationTypeInterceptor.cs index 3f9770caf2a..c5c5022b806 100644 --- a/src/HotChocolate/Core/src/Authorization/AuthorizationTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Authorization/AuthorizationTypeInterceptor.cs @@ -22,7 +22,7 @@ internal sealed partial class AuthorizationTypeInterceptor : TypeInterceptor private readonly List _objectTypes = new(); private readonly List _unionTypes = new(); private readonly Dictionary _directives = new(); - private readonly HashSet _completedTypeRefs = new(); + private readonly HashSet _completedTypeRefs = new(); private readonly HashSet _completedTypes = new(); private State? _state; @@ -137,7 +137,7 @@ private void InspectObjectTypesForAuthDirective(State state) interfaceTypeRef, out var authTypeRefs)) { - authTypeRefs = new List(); + authTypeRefs = new List(); state.AbstractToConcrete.Add(interfaceTypeRef, authTypeRefs); } @@ -157,7 +157,7 @@ private void FindUnionTypesThatContainAuthTypes(State state) { var unionTypeReg = type.TypeReg; var unionTypeRef = unionTypeReg.TypeReference; - List? authTypeRefs = null; + List? authTypeRefs = null; foreach (var memberTypeRef in type.TypeDef.Types) { @@ -171,7 +171,7 @@ private void FindUnionTypesThatContainAuthTypes(State state) if (authTypeRefs is null && !state.AbstractToConcrete.TryGetValue(unionTypeRef, out authTypeRefs)) { - authTypeRefs = new List(); + authTypeRefs = new List(); state.AbstractToConcrete.Add(unionTypeRef, authTypeRefs); } @@ -441,8 +441,8 @@ private void CompleteDirectiveType(DirectiveDefinition directive) } private void CollectInterfaces( - IReadOnlyList interfaces, - Action register, + IReadOnlyList interfaces, + Action register, State state) { state.Queue.AddRange(interfaces); @@ -466,7 +466,7 @@ private void CompleteDirectiveType(DirectiveDefinition directive) } } - private RegisteredType GetTypeRegistration(ITypeReference typeReference) + private RegisteredType GetTypeRegistration(TypeReference typeReference) { if (_typeLookup.TryNormalizeReference(typeReference, out var normalizedTypeRef) && _typeRegistry.TryGetType(normalizedTypeRef, out var registration)) diff --git a/src/HotChocolate/Core/src/Types.Analyzers/Generators/DataLoaderGenerator.cs b/src/HotChocolate/Core/src/Types.Analyzers/Generators/DataLoaderGenerator.cs index 661fcfe3249..1525f336489 100644 --- a/src/HotChocolate/Core/src/Types.Analyzers/Generators/DataLoaderGenerator.cs +++ b/src/HotChocolate/Core/src/Types.Analyzers/Generators/DataLoaderGenerator.cs @@ -373,7 +373,6 @@ public bool Consume(ISyntaxInfo syntaxInfo) sourceText.Append($" var p{item.Key} = "); sourceText.Append("scope.ServiceProvider.GetRequiredService<"); sourceText.Append(item.Value); - TestLog.Log("scoped: " + item.Value); sourceText.AppendLine(">();"); } } @@ -383,7 +382,6 @@ public bool Consume(ISyntaxInfo syntaxInfo) { sourceText.Append($" var p{item.Key} = _services.GetRequiredService<"); sourceText.Append(item.Value); - TestLog.Log("non scoped: " + item.Value); sourceText.AppendLine(">();"); } } diff --git a/src/HotChocolate/Core/src/Types.CursorPagination/ConnectionType.cs b/src/HotChocolate/Core/src/Types.CursorPagination/ConnectionType.cs index 5af9c1e7715..b72fd5297cb 100644 --- a/src/HotChocolate/Core/src/Types.CursorPagination/ConnectionType.cs +++ b/src/HotChocolate/Core/src/Types.CursorPagination/ConnectionType.cs @@ -22,7 +22,7 @@ internal class ConnectionType { internal ConnectionType( string connectionName, - ITypeReference nodeType, + TypeReference nodeType, bool withTotalCount) { if (nodeType is null) @@ -68,7 +68,7 @@ internal class ConnectionType ApplyConfigurationOn.BeforeCompletion)); } - internal ConnectionType(ITypeReference nodeType, bool withTotalCount) + internal ConnectionType(TypeReference nodeType, bool withTotalCount) { if (nodeType is null) { @@ -147,7 +147,7 @@ internal ConnectionType(ITypeReference nodeType, bool withTotalCount) private static ObjectTypeDefinition CreateTypeDefinition( bool withTotalCount, - ITypeReference? edgesType = null) + TypeReference? edgesType = null) { var definition = new ObjectTypeDefinition { diff --git a/src/HotChocolate/Core/src/Types.CursorPagination/EdgeType.cs b/src/HotChocolate/Core/src/Types.CursorPagination/EdgeType.cs index 7a4b3d3475f..5c226f395c6 100644 --- a/src/HotChocolate/Core/src/Types.CursorPagination/EdgeType.cs +++ b/src/HotChocolate/Core/src/Types.CursorPagination/EdgeType.cs @@ -13,7 +13,7 @@ internal sealed class EdgeType : ObjectType, IEdgeType { internal EdgeType( string connectionName, - ITypeReference nodeType) + TypeReference nodeType) { if (nodeType is null) { @@ -35,7 +35,7 @@ internal sealed class EdgeType : ObjectType, IEdgeType ApplyConfigurationOn.BeforeCompletion)); } - internal EdgeType(ITypeReference nodeType) + internal EdgeType(TypeReference nodeType) { if (nodeType is null) { @@ -100,7 +100,7 @@ public override bool IsInstanceOfType(IResolverContext context, object resolverR return false; } - private static ObjectTypeDefinition CreateTypeDefinition(ITypeReference nodeType) + private static ObjectTypeDefinition 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 2b547cdd138..9856b9cc381 100644 --- a/src/HotChocolate/Core/src/Types.CursorPagination/Extensions/PagingObjectFieldDescriptorExtensions.cs +++ b/src/HotChocolate/Core/src/Types.CursorPagination/Extensions/PagingObjectFieldDescriptorExtensions.cs @@ -145,7 +145,7 @@ public static class PagingObjectFieldDescriptorExtensions : null; } - ITypeReference? typeRef = nodeType is not null + TypeReference? typeRef = nodeType is not null ? c.TypeInspector.GetTypeRef(nodeType) : null; @@ -200,7 +200,7 @@ public static class PagingObjectFieldDescriptorExtensions : null; } - ITypeReference? typeRef = nodeType is not null + TypeReference? typeRef = nodeType is not null ? c.TypeInspector.GetTypeRef(nodeType) : null; @@ -298,7 +298,7 @@ public static class PagingObjectFieldDescriptorExtensions this IList arguments, string name, string description, - ITypeReference type) + TypeReference type) { var argument = arguments.FirstOrDefault(t => t.Name.EqualsOrdinal(name)); @@ -312,11 +312,11 @@ public static class PagingObjectFieldDescriptorExtensions argument.Type = type; } - private static ITypeReference CreateConnectionTypeRef( + private static TypeReference CreateConnectionTypeRef( IDescriptorContext context, MemberInfo? resolverMember, string? connectionName, - ITypeReference? nodeType, + TypeReference? nodeType, PagingOptions options) { var typeInspector = context.TypeInspector; @@ -390,9 +390,9 @@ public static class PagingObjectFieldDescriptorExtensions return new QueryableCursorPagingProvider(); } - private static ITypeReference CreateConnectionType( + private static TypeReference CreateConnectionType( string? connectionName, - ITypeReference nodeType, + TypeReference nodeType, bool withTotalCount) { return connectionName is null diff --git a/src/HotChocolate/Core/src/Types.Mutations/MutationConventionTypeInterceptor.cs b/src/HotChocolate/Core/src/Types.Mutations/MutationConventionTypeInterceptor.cs index cbc626fdc3f..685b90f455f 100644 --- a/src/HotChocolate/Core/src/Types.Mutations/MutationConventionTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types.Mutations/MutationConventionTypeInterceptor.cs @@ -21,7 +21,7 @@ internal sealed class MutationConventionTypeInterceptor : TypeInterceptor private IDescriptorContext _context = default!; private List _mutations = default!; private ITypeCompletionContext _completionContext = default!; - private ITypeReference? _errorInterfaceTypeRef; + private TypeReference? _errorInterfaceTypeRef; private ObjectTypeDefinition? _mutationTypeDef; private FieldMiddlewareDefinition? _errorNullMiddleware; @@ -452,10 +452,10 @@ argument.Formatters.Count switch return UnionType.CreateUnsafe(unionDef); } - private static ITypeReference CreateErrorTypeRef(ITypeDiscoveryContext context) + private static TypeReference CreateErrorTypeRef(ITypeDiscoveryContext context) => CreateErrorTypeRef(context.DescriptorContext); - private static ITypeReference CreateErrorTypeRef(IDescriptorContext context) + private static TypeReference CreateErrorTypeRef(IDescriptorContext context) { var errorInterfaceType = context.ContextData.TryGetValue(ErrorType, out var value) && @@ -473,7 +473,7 @@ private static ITypeReference CreateErrorTypeRef(IDescriptorContext context) private static void TryAddErrorInterface( ObjectTypeDefinition objectTypeDef, - ITypeReference errorInterfaceTypeRef) + TypeReference errorInterfaceTypeRef) { if (objectTypeDef.ContextData.IsError()) { @@ -660,7 +660,7 @@ private void RegisterType(TypeSystemObjectBase type) } } - private ITypeReference EnsureNullable(ITypeReference typeRef) + private TypeReference EnsureNullable(TypeReference typeRef) { var type = _completionContext.GetType(typeRef); @@ -672,7 +672,7 @@ private ITypeReference EnsureNullable(ITypeReference typeRef) return Create(CreateTypeNode(nt.Type)); } - private ITypeReference EnsureNonNull(ITypeReference typeRef) + private TypeReference EnsureNonNull(TypeReference typeRef) { var type = _completionContext.GetType(typeRef); @@ -747,7 +747,7 @@ public string FormatErrorTypeName(string mutationName) private readonly struct FieldDef { - public FieldDef(string name, ITypeReference type) + public FieldDef(string name, TypeReference type) { Name = name; Type = type; @@ -755,6 +755,6 @@ public FieldDef(string name, ITypeReference type) public string Name { get; } - public ITypeReference Type { get; } + public TypeReference Type { get; } } } diff --git a/src/HotChocolate/Core/src/Types.Mutations/MutationResultTypeDiscoveryHandler.cs b/src/HotChocolate/Core/src/Types.Mutations/MutationResultTypeDiscoveryHandler.cs index 22e2226df0e..a2ae437e2da 100644 --- a/src/HotChocolate/Core/src/Types.Mutations/MutationResultTypeDiscoveryHandler.cs +++ b/src/HotChocolate/Core/src/Types.Mutations/MutationResultTypeDiscoveryHandler.cs @@ -12,9 +12,9 @@ public MutationResultTypeDiscoveryHandler(ITypeInspector typeInspector) } public override bool TryInferType( - ITypeReference typeReference, + TypeReference typeReference, TypeDiscoveryInfo typeInfo, - [NotNullWhen(true)] out ITypeReference[]? schemaTypeRefs) + [NotNullWhen(true)] out TypeReference[]? schemaTypeRefs) { var runtimeType = typeInfo.RuntimeType; @@ -23,7 +23,7 @@ public MutationResultTypeDiscoveryHandler(ITypeInspector typeInspector) typeReference is ExtendedTypeReference typeRef) { var type = _typeInspector.GetType(runtimeType.GenericTypeArguments[0]); - schemaTypeRefs = new ITypeReference[runtimeType.GenericTypeArguments.Length]; + schemaTypeRefs = new TypeReference[runtimeType.GenericTypeArguments.Length]; schemaTypeRefs[0] = typeRef.WithType(type); for (var i = 1; i < runtimeType.GenericTypeArguments.Length; i++) diff --git a/src/HotChocolate/Core/src/Types.OffsetPagination/CollectionSegmentType~1.cs b/src/HotChocolate/Core/src/Types.OffsetPagination/CollectionSegmentType~1.cs index b116039b723..f445e088335 100644 --- a/src/HotChocolate/Core/src/Types.OffsetPagination/CollectionSegmentType~1.cs +++ b/src/HotChocolate/Core/src/Types.OffsetPagination/CollectionSegmentType~1.cs @@ -16,7 +16,7 @@ internal class CollectionSegmentType { internal CollectionSegmentType( string? collectionSegmentName, - ITypeReference nodeType, + TypeReference nodeType, bool withTotalCount) { if (nodeType is null) diff --git a/src/HotChocolate/Core/src/Types.OffsetPagination/Extensions/OffsetPagingObjectFieldDescriptorExtensions.cs b/src/HotChocolate/Core/src/Types.OffsetPagination/Extensions/OffsetPagingObjectFieldDescriptorExtensions.cs index 6c43473cf67..ae363ee818c 100644 --- a/src/HotChocolate/Core/src/Types.OffsetPagination/Extensions/OffsetPagingObjectFieldDescriptorExtensions.cs +++ b/src/HotChocolate/Core/src/Types.OffsetPagination/Extensions/OffsetPagingObjectFieldDescriptorExtensions.cs @@ -116,7 +116,7 @@ public static class OffsetPagingObjectFieldDescriptorExtensions : null; } - ITypeReference? typeRef = itemType is not null + TypeReference? typeRef = itemType is not null ? c.TypeInspector.GetTypeRef(itemType) : null; @@ -205,7 +205,7 @@ public static class OffsetPagingObjectFieldDescriptorExtensions : null; } - ITypeReference? typeRef = itemType is not null + TypeReference? typeRef = itemType is not null ? c.TypeInspector.GetTypeRef(itemType) : null; @@ -255,11 +255,11 @@ public static class OffsetPagingObjectFieldDescriptorExtensions .Argument(OffsetPagingArgumentNames.Take, a => a.Type()); } - private static ITypeReference CreateTypeRef( + private static TypeReference CreateTypeRef( IDescriptorContext context, MemberInfo? resolverMember, string? collectionSegmentName, - ITypeReference? itemsType, + TypeReference? itemsType, PagingOptions options) { var typeInspector = context.TypeInspector; diff --git a/src/HotChocolate/Core/src/Types/Configuration/AggregateTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/Configuration/AggregateTypeInterceptor.cs index b2ddca4003b..a03db528339 100644 --- a/src/HotChocolate/Core/src/Types/Configuration/AggregateTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/Configuration/AggregateTypeInterceptor.cs @@ -14,7 +14,7 @@ namespace HotChocolate.Configuration; internal sealed class AggregateTypeInterceptor : TypeInterceptor { - private readonly List _typeReferences = new(); + private readonly List _typeReferences = new(); private TypeInterceptor[] _typeInterceptors; public AggregateTypeInterceptor() @@ -125,7 +125,7 @@ public override void OnTypeRegistered(ITypeDiscoveryContext discoveryContext) } } - public override IEnumerable RegisterMoreTypes( + public override IEnumerable RegisterMoreTypes( IReadOnlyCollection discoveryContexts) { _typeReferences.Clear(); diff --git a/src/HotChocolate/Core/src/Types/Configuration/Contracts/ITypeCompletionContext.cs b/src/HotChocolate/Core/src/Types/Configuration/Contracts/ITypeCompletionContext.cs index 7c999d094cb..81d70293d74 100644 --- a/src/HotChocolate/Core/src/Types/Configuration/Contracts/ITypeCompletionContext.cs +++ b/src/HotChocolate/Core/src/Types/Configuration/Contracts/ITypeCompletionContext.cs @@ -54,7 +54,7 @@ public interface ITypeCompletionContext : ITypeSystemObjectContext /// /// true if the type has been resolved; otherwise, false. /// - bool TryGetType(ITypeReference typeRef, [NotNullWhen(true)] out T? type) where T : IType; + bool TryGetType(TypeReference typeRef, [NotNullWhen(true)] out T? type) where T : IType; /// /// Gets a type by it's type reference. @@ -71,7 +71,7 @@ public interface ITypeCompletionContext : ITypeSystemObjectContext /// /// The type could not be resolved for the given . /// - T GetType(ITypeReference typeRef) where T : IType; + T GetType(TypeReference typeRef) where T : IType; /// /// Rewrites a type reference to a named type reference. @@ -82,7 +82,7 @@ public interface ITypeCompletionContext : ITypeSystemObjectContext /// /// Returns a direct reference to a named type. /// - ITypeReference GetNamedTypeReference(ITypeReference typeRef); + TypeReference GetNamedTypeReference(TypeReference typeRef); /// /// Gets all registered types of . @@ -90,6 +90,6 @@ public interface ITypeCompletionContext : ITypeSystemObjectContext IEnumerable GetTypes() where T : IType; bool TryGetDirectiveType( - ITypeReference directiveRef, + TypeReference directiveRef, [NotNullWhen(true)] out DirectiveType? directiveType); } diff --git a/src/HotChocolate/Core/src/Types/Configuration/Contracts/ITypeSystemObjectContext.cs b/src/HotChocolate/Core/src/Types/Configuration/Contracts/ITypeSystemObjectContext.cs index 143f5bb8f8e..23b2b1bc514 100644 --- a/src/HotChocolate/Core/src/Types/Configuration/Contracts/ITypeSystemObjectContext.cs +++ b/src/HotChocolate/Core/src/Types/Configuration/Contracts/ITypeSystemObjectContext.cs @@ -20,7 +20,7 @@ public interface ITypeSystemObjectContext : IHasScope, IHasContextData /// A type reference that points to . /// /// - ITypeReference TypeReference { get; } + TypeReference TypeReference { get; } /// /// Defines if is a type like the object type or interface type. @@ -85,5 +85,5 @@ public interface ITypeSystemObjectContext : IHasScope, IHasContextData /// /// /// - bool TryPredictTypeKind(ITypeReference typeRef, out TypeKind kind); + bool TryPredictTypeKind(TypeReference typeRef, out TypeKind kind); } diff --git a/src/HotChocolate/Core/src/Types/Configuration/Handlers/DefaultTypeDiscoveryHandler.cs b/src/HotChocolate/Core/src/Types/Configuration/Handlers/DefaultTypeDiscoveryHandler.cs index 07b99bc8810..a38e4e70fa0 100644 --- a/src/HotChocolate/Core/src/Types/Configuration/Handlers/DefaultTypeDiscoveryHandler.cs +++ b/src/HotChocolate/Core/src/Types/Configuration/Handlers/DefaultTypeDiscoveryHandler.cs @@ -19,11 +19,11 @@ public DefaultTypeDiscoveryHandler(ITypeInspector typeInspector) private ITypeInspector TypeInspector { get; } public override bool TryInferType( - ITypeReference typeReference, + TypeReference typeReference, TypeDiscoveryInfo typeInfo, - [NotNullWhen(true)] out ITypeReference[]? schemaTypeRefs) + [NotNullWhen(true)] out TypeReference[]? schemaTypeRefs) { - ITypeReference? schemaType; + TypeReference? schemaType; if (typeInfo.IsStatic) { @@ -108,7 +108,7 @@ public DefaultTypeDiscoveryHandler(ITypeInspector typeInspector) } public override bool TryInferKind( - ITypeReference typeReference, + TypeReference typeReference, TypeDiscoveryInfo typeInfo, out TypeKind typeKind) { diff --git a/src/HotChocolate/Core/src/Types/Configuration/Handlers/DependantFactoryTypeReferenceHandler.cs b/src/HotChocolate/Core/src/Types/Configuration/Handlers/DependantFactoryTypeReferenceHandler.cs index 000078e0b1a..84888ac4f2a 100644 --- a/src/HotChocolate/Core/src/Types/Configuration/Handlers/DependantFactoryTypeReferenceHandler.cs +++ b/src/HotChocolate/Core/src/Types/Configuration/Handlers/DependantFactoryTypeReferenceHandler.cs @@ -16,7 +16,7 @@ public DependantFactoryTypeReferenceHandler(IDescriptorContext context) public TypeReferenceKind Kind => TypeReferenceKind.DependantFactory; - public void Handle(ITypeRegistrar typeRegistrar, ITypeReference typeReference) + public void Handle(ITypeRegistrar typeRegistrar, TypeReference typeReference) { var typeRef = (DependantFactoryTypeReference)typeReference; diff --git a/src/HotChocolate/Core/src/Types/Configuration/Handlers/ExtendedTypeDirectiveReferenceHandler.cs b/src/HotChocolate/Core/src/Types/Configuration/Handlers/ExtendedTypeDirectiveReferenceHandler.cs index af44f7b8eb5..2862ed6bd5a 100644 --- a/src/HotChocolate/Core/src/Types/Configuration/Handlers/ExtendedTypeDirectiveReferenceHandler.cs +++ b/src/HotChocolate/Core/src/Types/Configuration/Handlers/ExtendedTypeDirectiveReferenceHandler.cs @@ -13,7 +13,7 @@ public ExtendedTypeDirectiveReferenceHandler(ITypeInspector typeInspector) public TypeReferenceKind Kind => TypeReferenceKind.DirectiveExtendedType; - public void Handle(ITypeRegistrar typeRegistrar, ITypeReference typeReference) + public void Handle(ITypeRegistrar typeRegistrar, TypeReference typeReference) { var typeRef = (ExtendedTypeDirectiveReference)typeReference; diff --git a/src/HotChocolate/Core/src/Types/Configuration/Handlers/ExtendedTypeReferenceHandler.cs b/src/HotChocolate/Core/src/Types/Configuration/Handlers/ExtendedTypeReferenceHandler.cs index 2bc2ff6f143..e1cba59b55d 100644 --- a/src/HotChocolate/Core/src/Types/Configuration/Handlers/ExtendedTypeReferenceHandler.cs +++ b/src/HotChocolate/Core/src/Types/Configuration/Handlers/ExtendedTypeReferenceHandler.cs @@ -20,7 +20,7 @@ public ExtendedTypeReferenceHandler(ITypeInspector typeInspector) public TypeReferenceKind Kind => TypeReferenceKind.ExtendedType; - public void Handle(ITypeRegistrar typeRegistrar, ITypeReference typeReference) + public void Handle(ITypeRegistrar typeRegistrar, TypeReference typeReference) { var typeRef = (ExtendedTypeReference)typeReference; diff --git a/src/HotChocolate/Core/src/Types/Configuration/Handlers/FactoryTypeReferenceHandler.cs b/src/HotChocolate/Core/src/Types/Configuration/Handlers/FactoryTypeReferenceHandler.cs index 48e53ca3fc3..f1283e6b258 100644 --- a/src/HotChocolate/Core/src/Types/Configuration/Handlers/FactoryTypeReferenceHandler.cs +++ b/src/HotChocolate/Core/src/Types/Configuration/Handlers/FactoryTypeReferenceHandler.cs @@ -16,7 +16,7 @@ public FactoryTypeReferenceHandler(IDescriptorContext context) public TypeReferenceKind Kind => TypeReferenceKind.Factory; - public void Handle(ITypeRegistrar typeRegistrar, ITypeReference typeReference) + public void Handle(ITypeRegistrar typeRegistrar, TypeReference typeReference) { var typeRef = (SyntaxTypeReference)typeReference; diff --git a/src/HotChocolate/Core/src/Types/Configuration/Handlers/ITypeRegistrarHandler.cs b/src/HotChocolate/Core/src/Types/Configuration/Handlers/ITypeRegistrarHandler.cs index 98e0be25b9d..8d85a347f18 100644 --- a/src/HotChocolate/Core/src/Types/Configuration/Handlers/ITypeRegistrarHandler.cs +++ b/src/HotChocolate/Core/src/Types/Configuration/Handlers/ITypeRegistrarHandler.cs @@ -25,5 +25,5 @@ internal interface ITypeRegistrarHandler /// /// The type reference. /// - void Handle(ITypeRegistrar typeRegistrar, ITypeReference typeReference); + void Handle(ITypeRegistrar typeRegistrar, TypeReference typeReference); } diff --git a/src/HotChocolate/Core/src/Types/Configuration/Handlers/ScalarTypeDiscoveryHandler.cs b/src/HotChocolate/Core/src/Types/Configuration/Handlers/ScalarTypeDiscoveryHandler.cs index 030966c70b6..8e649b468fd 100644 --- a/src/HotChocolate/Core/src/Types/Configuration/Handlers/ScalarTypeDiscoveryHandler.cs +++ b/src/HotChocolate/Core/src/Types/Configuration/Handlers/ScalarTypeDiscoveryHandler.cs @@ -18,14 +18,14 @@ public ScalarTypeDiscoveryHandler(ITypeInspector typeInspector) private ITypeInspector TypeInspector { get; } public override bool TryInferType( - ITypeReference typeReference, + TypeReference typeReference, TypeDiscoveryInfo typeInfo, - [NotNullWhen(true)] out ITypeReference[]? schemaTypeRefs) + [NotNullWhen(true)] out TypeReference[]? schemaTypeRefs) { if (Scalars.TryGetScalar(typeInfo.RuntimeType, out var scalarType)) { var schemaTypeRef = TypeInspector.GetTypeRef(scalarType); - schemaTypeRefs = new ITypeReference[] { schemaTypeRef }; + schemaTypeRefs = new TypeReference[] { schemaTypeRef }; return true; } @@ -34,7 +34,7 @@ public ScalarTypeDiscoveryHandler(ITypeInspector typeInspector) } public override bool TryInferKind( - ITypeReference typeReference, + TypeReference typeReference, TypeDiscoveryInfo typeInfo, out TypeKind typeKind) { diff --git a/src/HotChocolate/Core/src/Types/Configuration/Handlers/SchemaTypeReferenceHandler.cs b/src/HotChocolate/Core/src/Types/Configuration/Handlers/SchemaTypeReferenceHandler.cs index b6c68bed691..15919ec15f3 100644 --- a/src/HotChocolate/Core/src/Types/Configuration/Handlers/SchemaTypeReferenceHandler.cs +++ b/src/HotChocolate/Core/src/Types/Configuration/Handlers/SchemaTypeReferenceHandler.cs @@ -9,7 +9,7 @@ internal sealed class SchemaTypeReferenceHandler : ITypeRegistrarHandler { public TypeReferenceKind Kind => TypeReferenceKind.SchemaType; - public void Handle(ITypeRegistrar typeRegistrar, ITypeReference typeReference) + public void Handle(ITypeRegistrar typeRegistrar, TypeReference typeReference) { var typeRef = (SchemaTypeReference)typeReference; diff --git a/src/HotChocolate/Core/src/Types/Configuration/Handlers/SyntaxTypeReferenceHandler.cs b/src/HotChocolate/Core/src/Types/Configuration/Handlers/SyntaxTypeReferenceHandler.cs index 7b22022e880..e4b6770677b 100644 --- a/src/HotChocolate/Core/src/Types/Configuration/Handlers/SyntaxTypeReferenceHandler.cs +++ b/src/HotChocolate/Core/src/Types/Configuration/Handlers/SyntaxTypeReferenceHandler.cs @@ -20,7 +20,7 @@ public SyntaxTypeReferenceHandler(ITypeInspector typeInspector) public TypeReferenceKind Kind => TypeReferenceKind.Syntax; - public void Handle(ITypeRegistrar typeRegistrar, ITypeReference typeReference) + public void Handle(ITypeRegistrar typeRegistrar, TypeReference typeReference) { var typeRef = (SyntaxTypeReference)typeReference; diff --git a/src/HotChocolate/Core/src/Types/Configuration/Handlers/TypeRefHelper.cs b/src/HotChocolate/Core/src/Types/Configuration/Handlers/TypeRefHelper.cs index 21c78a53f72..fd22156499d 100644 --- a/src/HotChocolate/Core/src/Types/Configuration/Handlers/TypeRefHelper.cs +++ b/src/HotChocolate/Core/src/Types/Configuration/Handlers/TypeRefHelper.cs @@ -7,11 +7,11 @@ namespace HotChocolate.Configuration; internal static class TypeRefHelper { - public static ITypeReference CreateTypeRef( + public static TypeReference CreateTypeRef( this ITypeInspector typeInspector, Type schemaType, TypeDiscoveryInfo typeInfo, - ITypeReference originalTypeRef) + TypeReference originalTypeRef) => typeInspector.GetTypeRef( schemaType.MakeGenericType(typeInfo.RuntimeType), originalTypeRef.Context, diff --git a/src/HotChocolate/Core/src/Types/Configuration/ITypeRegistrar.cs b/src/HotChocolate/Core/src/Types/Configuration/ITypeRegistrar.cs index a5885409074..7b0c24f0e69 100644 --- a/src/HotChocolate/Core/src/Types/Configuration/ITypeRegistrar.cs +++ b/src/HotChocolate/Core/src/Types/Configuration/ITypeRegistrar.cs @@ -15,15 +15,15 @@ internal interface ITypeRegistrar bool inferred = false, Action? configure = null); - void MarkUnresolved(ITypeReference typeReference); + void MarkUnresolved(TypeReference typeReference); - void MarkResolved(ITypeReference typeReference); + void MarkResolved(TypeReference typeReference); - bool IsResolved(ITypeReference typeReference); + bool IsResolved(TypeReference typeReference); TypeSystemObjectBase CreateInstance(Type namedSchemaType); - IReadOnlyCollection Unresolved { get; } + IReadOnlyCollection Unresolved { get; } - IReadOnlyCollection GetUnhandled(); + IReadOnlyCollection GetUnhandled(); } diff --git a/src/HotChocolate/Core/src/Types/Configuration/RegisteredType.CompletionContext.cs b/src/HotChocolate/Core/src/Types/Configuration/RegisteredType.CompletionContext.cs index 1b641115701..63da537e5da 100644 --- a/src/HotChocolate/Core/src/Types/Configuration/RegisteredType.CompletionContext.cs +++ b/src/HotChocolate/Core/src/Types/Configuration/RegisteredType.CompletionContext.cs @@ -38,7 +38,7 @@ IReadOnlyList ITypeCompletionContext.GlobalComponents /// public IsOfTypeFallback? IsOfType { get; private set; } - public ITypeReference TypeReference => References[0]; + public TypeReference TypeReference => References[0]; public void PrepareForCompletion( TypeReferenceResolver typeReferenceResolver, @@ -52,7 +52,7 @@ IReadOnlyList ITypeCompletionContext.GlobalComponents /// public bool TryGetType( - ITypeReference typeRef, + TypeReference typeRef, [NotNullWhen(true)] out T? type) where T : IType { @@ -73,7 +73,7 @@ IReadOnlyList ITypeCompletionContext.GlobalComponents } /// - public T GetType(ITypeReference typeRef) where T : IType + public T GetType(TypeReference typeRef) where T : IType { if (typeRef is null) { @@ -89,7 +89,7 @@ IReadOnlyList ITypeCompletionContext.GlobalComponents } /// - public ITypeReference GetNamedTypeReference(ITypeReference typeRef) + public TypeReference GetNamedTypeReference(TypeReference typeRef) { if (_typeReferenceResolver is null) { @@ -116,7 +116,7 @@ public ITypeReference GetNamedTypeReference(ITypeReference typeRef) } /// - public bool TryGetDirectiveType(ITypeReference directiveRef, + public bool TryGetDirectiveType(TypeReference directiveRef, [NotNullWhen(true)] out DirectiveType? directiveType) { if (_typeReferenceResolver is null) diff --git a/src/HotChocolate/Core/src/Types/Configuration/RegisteredType.DiscoveryContext.cs b/src/HotChocolate/Core/src/Types/Configuration/RegisteredType.DiscoveryContext.cs index aacdf66bf81..798cadbd0de 100644 --- a/src/HotChocolate/Core/src/Types/Configuration/RegisteredType.DiscoveryContext.cs +++ b/src/HotChocolate/Core/src/Types/Configuration/RegisteredType.DiscoveryContext.cs @@ -39,7 +39,7 @@ public void ReportError(ISchemaError error) Errors.Add(error); } - public bool TryPredictTypeKind(ITypeReference typeRef, out TypeKind kind) + public bool TryPredictTypeKind(TypeReference typeRef, out TypeKind kind) { if (_typeLookup.TryNormalizeReference(typeRef, out var namedTypeRef) && _typeRegistry.TryGetType(namedTypeRef, out var registeredType)) diff --git a/src/HotChocolate/Core/src/Types/Configuration/RegisteredType.cs b/src/HotChocolate/Core/src/Types/Configuration/RegisteredType.cs index 5dbb5af3eef..479630f797b 100644 --- a/src/HotChocolate/Core/src/Types/Configuration/RegisteredType.cs +++ b/src/HotChocolate/Core/src/Types/Configuration/RegisteredType.cs @@ -55,7 +55,7 @@ public Type RuntimeType ? hasClrType.RuntimeType : typeof(object); - public List References { get; } = new(); + public List References { get; } = new(); public List Dependencies { get; } = new(); diff --git a/src/HotChocolate/Core/src/Types/Configuration/TypeDiscoverer.cs b/src/HotChocolate/Core/src/Types/Configuration/TypeDiscoverer.cs index a52296ba67d..de5a8b79c73 100644 --- a/src/HotChocolate/Core/src/Types/Configuration/TypeDiscoverer.cs +++ b/src/HotChocolate/Core/src/Types/Configuration/TypeDiscoverer.cs @@ -12,9 +12,9 @@ namespace HotChocolate.Configuration; internal sealed class TypeDiscoverer { - private readonly List _unregistered = new(); + private readonly List _unregistered = new(); private readonly List _errors = new(); - private readonly List _resolved = new(); + private readonly List _resolved = new(); private readonly IDescriptorContext _context; private readonly TypeRegistry _typeRegistry; private readonly TypeRegistrar _typeRegistrar; @@ -25,7 +25,7 @@ internal sealed class TypeDiscoverer IDescriptorContext context, TypeRegistry typeRegistry, TypeLookup typeLookup, - IEnumerable initialTypes, + IEnumerable initialTypes, TypeInterceptor interceptor, bool includeSystemTypes = true) { @@ -84,7 +84,7 @@ internal sealed class TypeDiscoverer public IReadOnlyList DiscoverTypes() { const int max = 1000; - var processed = new HashSet(); + var processed = new HashSet(); DISCOVER: var tries = 0; diff --git a/src/HotChocolate/Core/src/Types/Configuration/TypeDiscoveryDescriptorContextExtensions.cs b/src/HotChocolate/Core/src/Types/Configuration/TypeDiscoveryDescriptorContextExtensions.cs index 3b6735e9711..c07c5334b20 100644 --- a/src/HotChocolate/Core/src/Types/Configuration/TypeDiscoveryDescriptorContextExtensions.cs +++ b/src/HotChocolate/Core/src/Types/Configuration/TypeDiscoveryDescriptorContextExtensions.cs @@ -11,8 +11,8 @@ internal static class TypeDiscoveryDescriptorContextExtensions { public static bool TryInferSchemaType( this IDescriptorContext context, - ITypeReference unresolvedTypeRef, - [NotNullWhen(true)] out ITypeReference[]? schemaTypeRefs) + TypeReference unresolvedTypeRef, + [NotNullWhen(true)] out TypeReference[]? schemaTypeRefs) { var info = new TypeDiscoveryInfo(unresolvedTypeRef); diff --git a/src/HotChocolate/Core/src/Types/Configuration/TypeInitializer.cs b/src/HotChocolate/Core/src/Types/Configuration/TypeInitializer.cs index a1ec22e5951..266b1624525 100644 --- a/src/HotChocolate/Core/src/Types/Configuration/TypeInitializer.cs +++ b/src/HotChocolate/Core/src/Types/Configuration/TypeInitializer.cs @@ -22,7 +22,7 @@ internal sealed class TypeInitializer private readonly List _globalComps = new(); private readonly List _errors = new(); private readonly IDescriptorContext _context; - private readonly IReadOnlyList _initialTypes; + private readonly IReadOnlyList _initialTypes; private readonly TypeInterceptor _interceptor; private readonly IsOfTypeFallback? _isOfType; private readonly Func _getTypeKind; @@ -32,14 +32,14 @@ internal sealed class TypeInitializer private readonly TypeReferenceResolver _typeReferenceResolver; private readonly List _next = new(); private readonly List _temp = new(); - private readonly List _typeRefs = new(); - private readonly HashSet _typeRefSet = new(); + private readonly List _typeRefs = new(); + private readonly HashSet _typeRefSet = new(); private readonly List _rootTypes = new(); public TypeInitializer( IDescriptorContext descriptorContext, TypeRegistry typeRegistry, - IReadOnlyList initialTypes, + IReadOnlyList initialTypes, IsOfTypeFallback? isOfType, Func getTypeKind, IReadOnlySchemaOptions options) @@ -453,7 +453,7 @@ private void FinalizeTypes() TypeDependencyFulfilled fulfilled, Func action) { - var processed = new HashSet(); + var processed = new HashSet(); var batch = new List(GetInitialBatch(fulfilled)); var failed = false; @@ -490,7 +490,7 @@ private void FinalizeTypes() ? type.References[0].ToString()! : type.Type.Name; - IReadOnlyList needed = + IReadOnlyList needed = TryNormalizeDependencies( type.Conditionals, out var normalized, @@ -556,7 +556,7 @@ private void FinalizeTypes() } private IEnumerable GetNextBatch( - ISet processed) + ISet processed) { foreach (var type in _next) { @@ -582,9 +582,9 @@ private void FinalizeTypes() _temp.Clear(); } - List GetTypeRefsExceptSelfRefs( + List GetTypeRefsExceptSelfRefs( RegisteredType type, - IReadOnlyList normalizedTypeReferences) + IReadOnlyList normalizedTypeReferences) { _typeRefs.Clear(); _typeRefSet.Clear(); @@ -604,10 +604,10 @@ private void FinalizeTypes() private bool TryNormalizeDependencies( List dependencies, - [NotNullWhen(true)] out IReadOnlyList? normalized, - [NotNullWhen(false)] out IReadOnlyList? notFound) + [NotNullWhen(true)] out IReadOnlyList? normalized, + [NotNullWhen(false)] out IReadOnlyList? notFound) { - var n = new List(); + var n = new List(); foreach (var dependency in dependencies) { diff --git a/src/HotChocolate/Core/src/Types/Configuration/TypeInterceptor.cs b/src/HotChocolate/Core/src/Types/Configuration/TypeInterceptor.cs index d0824a40253..3641e7acf17 100644 --- a/src/HotChocolate/Core/src/Types/Configuration/TypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/Configuration/TypeInterceptor.cs @@ -92,9 +92,9 @@ public abstract class TypeInterceptor /// /// Returns types that shall be included into the schema. /// - public virtual IEnumerable RegisterMoreTypes( + public virtual IEnumerable RegisterMoreTypes( IReadOnlyCollection discoveryContexts) - => Enumerable.Empty(); + => Enumerable.Empty(); public virtual void OnTypeRegistered( ITypeDiscoveryContext discoveryContext) { } diff --git a/src/HotChocolate/Core/src/Types/Configuration/TypeLookup.cs b/src/HotChocolate/Core/src/Types/Configuration/TypeLookup.cs index a318ea2abb0..4faa0d6a786 100644 --- a/src/HotChocolate/Core/src/Types/Configuration/TypeLookup.cs +++ b/src/HotChocolate/Core/src/Types/Configuration/TypeLookup.cs @@ -11,7 +11,7 @@ namespace HotChocolate.Configuration; internal sealed class TypeLookup { - private readonly Dictionary _refs = new(); + private readonly Dictionary _refs = new(); private readonly ITypeInspector _typeInspector; private readonly TypeRegistry _typeRegistry; @@ -26,8 +26,8 @@ internal sealed class TypeLookup } public bool TryNormalizeReference( - ITypeReference typeRef, - [NotNullWhen(true)] out ITypeReference? namedTypeRef) + TypeReference typeRef, + [NotNullWhen(true)] out TypeReference? namedTypeRef) { if (typeRef is null) { @@ -93,7 +93,7 @@ internal sealed class TypeLookup private bool TryNormalizeExtendedTypeReference( ExtendedTypeReference typeRef, - [NotNullWhen(true)] out ITypeReference? namedTypeRef) + [NotNullWhen(true)] out TypeReference? namedTypeRef) { if (typeRef is null) { diff --git a/src/HotChocolate/Core/src/Types/Configuration/TypeReferenceResolver.cs b/src/HotChocolate/Core/src/Types/Configuration/TypeReferenceResolver.cs index ded89313b11..722344c083f 100644 --- a/src/HotChocolate/Core/src/Types/Configuration/TypeReferenceResolver.cs +++ b/src/HotChocolate/Core/src/Types/Configuration/TypeReferenceResolver.cs @@ -37,7 +37,7 @@ internal sealed class TypeReferenceResolver .OfType() .Distinct(); - public ITypeReference GetNamedTypeReference(ITypeReference typeRef) + public TypeReference GetNamedTypeReference(TypeReference typeRef) { if (typeRef is null) { @@ -52,7 +52,7 @@ public ITypeReference GetNamedTypeReference(ITypeReference typeRef) throw new NotSupportedException(); } - public bool TryGetType(ITypeReference typeRef, [NotNullWhen(true)] out IType? type) + public bool TryGetType(TypeReference typeRef, [NotNullWhen(true)] out IType? type) { if (typeRef is null) { @@ -108,7 +108,7 @@ public bool TryGetType(ITypeReference typeRef, [NotNullWhen(true)] out IType? ty } public bool TryGetDirectiveType( - ITypeReference typeRef, + TypeReference typeRef, [NotNullWhen(true)] out DirectiveType? directiveType) { if (typeRef is null) @@ -150,7 +150,7 @@ public bool TryGetType(ITypeReference typeRef, [NotNullWhen(true)] out IType? ty return namedType; } - private TypeId CreateId(ITypeReference typeRef, ITypeReference namedTypeRef) + private TypeId CreateId(TypeReference typeRef, TypeReference namedTypeRef) { switch (typeRef) { @@ -221,13 +221,13 @@ private static int CreateFlags(ITypeNode type) private readonly struct TypeId : IEquatable { - public TypeId(ITypeReference typeRef, int flags) + public TypeId(TypeReference typeRef, int flags) { TypeRef = typeRef; Flags = flags; } - public ITypeReference TypeRef { get; } + public TypeReference TypeRef { get; } public int Flags { get; } diff --git a/src/HotChocolate/Core/src/Types/Configuration/TypeRegistrar.cs b/src/HotChocolate/Core/src/Types/Configuration/TypeRegistrar.cs index 145c996bf50..193e63d5cf4 100644 --- a/src/HotChocolate/Core/src/Types/Configuration/TypeRegistrar.cs +++ b/src/HotChocolate/Core/src/Types/Configuration/TypeRegistrar.cs @@ -13,7 +13,7 @@ namespace HotChocolate.Configuration; internal sealed class TypeRegistrar : ITypeRegistrar { private readonly ServiceFactory _serviceFactory = new(); - private readonly HashSet _unresolved = new(); + private readonly HashSet _unresolved = new(); private readonly HashSet _handled = new(); private readonly TypeRegistry _typeRegistry; private readonly TypeLookup _typeLookup; @@ -86,7 +86,7 @@ private void RegisterTypeAndResolveReferences(RegisteredType registeredType) } } - public void MarkUnresolved(ITypeReference typeReference) + public void MarkUnresolved(TypeReference typeReference) { if (typeReference is null) { @@ -96,7 +96,7 @@ public void MarkUnresolved(ITypeReference typeReference) _unresolved.Add(typeReference); } - public void MarkResolved(ITypeReference typeReference) + public void MarkResolved(TypeReference typeReference) { if (typeReference is null) { @@ -106,7 +106,7 @@ public void MarkResolved(ITypeReference typeReference) _unresolved.Remove(typeReference); } - public bool IsResolved(ITypeReference typeReference) + public bool IsResolved(TypeReference typeReference) { if (typeReference is null) { @@ -128,13 +128,13 @@ public TypeSystemObjectBase CreateInstance(Type namedSchemaType) } } - public IReadOnlyCollection Unresolved => _unresolved; + public IReadOnlyCollection Unresolved => _unresolved; - public IReadOnlyCollection GetUnhandled() + public IReadOnlyCollection GetUnhandled() { // we are having a list and the hashset here to keep the order. - var unhandled = new List(); - var registered = new HashSet(); + var unhandled = new List(); + var registered = new HashSet(); foreach (var type in _typeRegistry.Types) { diff --git a/src/HotChocolate/Core/src/Types/Configuration/TypeRegistry.cs b/src/HotChocolate/Core/src/Types/Configuration/TypeRegistry.cs index f0b261ce870..92f4b5879b5 100644 --- a/src/HotChocolate/Core/src/Types/Configuration/TypeRegistry.cs +++ b/src/HotChocolate/Core/src/Types/Configuration/TypeRegistry.cs @@ -13,10 +13,10 @@ namespace HotChocolate.Configuration; internal sealed class TypeRegistry { - private readonly Dictionary _typeRegister = new(); - private readonly Dictionary _runtimeTypeRefs = + private readonly Dictionary _typeRegister = new(); + private readonly Dictionary _runtimeTypeRefs = new(new ExtendedTypeReferenceEqualityComparer()); - private readonly Dictionary _nameRefs = new(StringComparer.Ordinal); + private readonly Dictionary _nameRefs = new(StringComparer.Ordinal); private readonly List _types = new(); private readonly TypeInterceptor _typeRegistryInterceptor; @@ -30,12 +30,12 @@ public TypeRegistry(TypeInterceptor typeRegistryInterceptor) public IReadOnlyList Types => _types; - public IReadOnlyDictionary RuntimeTypeRefs => + public IReadOnlyDictionary RuntimeTypeRefs => _runtimeTypeRefs; - public IReadOnlyDictionary NameRefs => _nameRefs; + public IReadOnlyDictionary NameRefs => _nameRefs; - public bool IsRegistered(ITypeReference typeReference) + public bool IsRegistered(TypeReference typeReference) { if (typeReference is null) { @@ -56,7 +56,7 @@ public bool IsRegistered(ITypeReference typeReference) } public bool TryGetType( - ITypeReference typeRef, + TypeReference typeRef, [NotNullWhen(true)] out RegisteredType? registeredType) { if (typeRef is null) @@ -75,7 +75,7 @@ public bool IsRegistered(ITypeReference typeReference) public bool TryGetTypeRef( ExtendedTypeReference runtimeTypeRef, - [NotNullWhen(true)] out ITypeReference? typeRef) + [NotNullWhen(true)] out TypeReference? typeRef) { if (runtimeTypeRef is null) { @@ -87,7 +87,7 @@ public bool IsRegistered(ITypeReference typeReference) public bool TryGetTypeRef( string typeName, - [NotNullWhen(true)] out ITypeReference? typeRef) + [NotNullWhen(true)] out TypeReference? typeRef) { typeName.EnsureGraphQLName(); @@ -100,9 +100,9 @@ public bool IsRegistered(ITypeReference typeReference) return typeRef is not null; } - public IEnumerable GetTypeRefs() => _runtimeTypeRefs.Values; + public IEnumerable GetTypeRefs() => _runtimeTypeRefs.Values; - public void TryRegister(ExtendedTypeReference runtimeTypeRef, ITypeReference typeRef) + public void TryRegister(ExtendedTypeReference runtimeTypeRef, TypeReference typeRef) { if (runtimeTypeRef is null) { @@ -225,7 +225,7 @@ public void CompleteDiscovery() { foreach (var registeredType in _types) { - ITypeReference reference = TypeReference.Create(registeredType.Type); + TypeReference reference = TypeReference.Create(registeredType.Type); registeredType.References.TryAdd(reference); _typeRegister[reference] = registeredType; diff --git a/src/HotChocolate/Core/src/Types/Internal/TypeDiscoveryHandler.cs b/src/HotChocolate/Core/src/Types/Internal/TypeDiscoveryHandler.cs index 2f830c4f96e..d28b2a8302f 100644 --- a/src/HotChocolate/Core/src/Types/Internal/TypeDiscoveryHandler.cs +++ b/src/HotChocolate/Core/src/Types/Internal/TypeDiscoveryHandler.cs @@ -29,9 +29,9 @@ public abstract class TypeDiscoveryHandler /// otherwise, false. /// public abstract bool TryInferType( - ITypeReference typeReference, + TypeReference typeReference, TypeDiscoveryInfo typeInfo, - [NotNullWhen(true)] out ITypeReference[]? schemaTypeRefs); + [NotNullWhen(true)] out TypeReference[]? schemaTypeRefs); /// /// Tries to infer the from a runtime reference. @@ -51,7 +51,7 @@ public abstract class TypeDiscoveryHandler /// otherwise, false. /// public virtual bool TryInferKind( - ITypeReference typeReference, + TypeReference typeReference, TypeDiscoveryInfo typeInfo, out TypeKind typeKind) { diff --git a/src/HotChocolate/Core/src/Types/Internal/TypeDiscoveryInfo.cs b/src/HotChocolate/Core/src/Types/Internal/TypeDiscoveryInfo.cs index dd300dbc5a9..3b7df574797 100644 --- a/src/HotChocolate/Core/src/Types/Internal/TypeDiscoveryInfo.cs +++ b/src/HotChocolate/Core/src/Types/Internal/TypeDiscoveryInfo.cs @@ -18,7 +18,7 @@ namespace HotChocolate.Internal; /// /// Initializes a new instance of . /// - public TypeDiscoveryInfo(ITypeReference typeReference) + public TypeDiscoveryInfo(TypeReference typeReference) { if (typeReference is null) { diff --git a/src/HotChocolate/Core/src/Types/Internal/TypeExtensionHelper.cs b/src/HotChocolate/Core/src/Types/Internal/TypeExtensionHelper.cs index 4fe01d52bf9..1473a381be7 100644 --- a/src/HotChocolate/Core/src/Types/Internal/TypeExtensionHelper.cs +++ b/src/HotChocolate/Core/src/Types/Internal/TypeExtensionHelper.cs @@ -182,10 +182,10 @@ public static class TypeExtensionHelper } public static void MergeTypes( - ICollection extensionTypes, - ICollection typeTypes) + ICollection extensionTypes, + ICollection typeTypes) { - var set = new HashSet(typeTypes); + var set = new HashSet(typeTypes); foreach (var reference in extensionTypes) { diff --git a/src/HotChocolate/Core/src/Types/SchemaBuilder.Setup.cs b/src/HotChocolate/Core/src/Types/SchemaBuilder.Setup.cs index 94dd886ca65..02bdc9a6531 100644 --- a/src/HotChocolate/Core/src/Types/SchemaBuilder.Setup.cs +++ b/src/HotChocolate/Core/src/Types/SchemaBuilder.Setup.cs @@ -94,11 +94,11 @@ public static Schema Create(SchemaBuilder builder) return context; } - private static IReadOnlyList CreateTypeReferences( + private static IReadOnlyList CreateTypeReferences( SchemaBuilder builder, IDescriptorContext context) { - var types = new List(); + var types = new List(); foreach (var typeRef in builder._types) { @@ -117,11 +117,11 @@ public static Schema Create(SchemaBuilder builder) return types; } - private static IEnumerable ParseDocuments( + private static IEnumerable ParseDocuments( SchemaBuilder builder, IDescriptorContext context) { - var types = new List(); + var types = new List(); var documents = new List(); context.ContextData[WellKnownContextData.SchemaDocuments] = documents; @@ -190,7 +190,7 @@ public static Schema Create(SchemaBuilder builder) private static TypeRegistry InitializeTypes( SchemaBuilder builder, IDescriptorContext context, - IReadOnlyList types) + IReadOnlyList types) { var typeRegistry = new TypeRegistry(context.TypeInterceptor); var initializer = @@ -202,7 +202,7 @@ public static Schema Create(SchemaBuilder builder) private static TypeInitializer CreateTypeInitializer( SchemaBuilder builder, IDescriptorContext context, - IReadOnlyList typeReferences, + IReadOnlyList typeReferences, TypeRegistry typeRegistry) { var operations = @@ -270,7 +270,7 @@ public static Schema Create(SchemaBuilder builder) private static RootTypeKind GetOperationKind( TypeSystemObjectBase type, ITypeInspector typeInspector, - Dictionary operations) + Dictionary operations) { if (type is ObjectType objectType) { @@ -309,7 +309,7 @@ public static Schema Create(SchemaBuilder builder) ObjectType objectType, OperationType operationType, ITypeInspector typeInspector, - Dictionary operations) + Dictionary operations) { if (operations.TryGetValue(operationType, out var typeRef)) { @@ -407,7 +407,7 @@ public static Schema Create(SchemaBuilder builder) private static void ResolveOperations( SchemaTypesDefinition schemaDef, - Dictionary operations, + Dictionary operations, TypeRegistry typeRegistry) { if (operations.Count == 0) diff --git a/src/HotChocolate/Core/src/Types/SchemaBuilder.cs b/src/HotChocolate/Core/src/Types/SchemaBuilder.cs index 14bad83dc39..41b93fd3ead 100644 --- a/src/HotChocolate/Core/src/Types/SchemaBuilder.cs +++ b/src/HotChocolate/Core/src/Types/SchemaBuilder.cs @@ -20,7 +20,7 @@ namespace HotChocolate; /// public partial class SchemaBuilder : ISchemaBuilder { - private delegate ITypeReference CreateRef(ITypeInspector typeInspector); + private delegate TypeReference CreateRef(ITypeInspector typeInspector); private readonly Dictionary _contextData = new(); private readonly List _globalComponents = new(); 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 7a5ef1efad8..39c921a347d 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/ArgumentDescriptorBase~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/ArgumentDescriptorBase~1.cs @@ -116,7 +116,7 @@ public void Type(TInputType inputType) /// ITypeInspector inspector; /// ParameterInfo parameter; /// // get reference - /// ITypeReference reference = inspector.GetArgumentType(parameter) + /// TypeReference reference = inspector.GetArgumentType(parameter) /// descriptor.Type(reference); /// ///

@@ -129,7 +129,7 @@ public void Type(TInputType inputType) /// /// ///

- public void Type(ITypeReference typeReference) + public void Type(TypeReference typeReference) { if (typeReference is null) { diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Conventions/DefaultTypeInspector.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Conventions/DefaultTypeInspector.cs index 22306d92ad8..1d100b0eb21 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Conventions/DefaultTypeInspector.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Conventions/DefaultTypeInspector.cs @@ -98,7 +98,7 @@ public virtual bool IsMemberIgnored(MemberInfo member) } /// - public virtual ITypeReference GetReturnTypeRef( + public virtual TypeReference GetReturnTypeRef( MemberInfo member, TypeContext context = TypeContext.None, string? scope = null, @@ -109,7 +109,7 @@ public virtual bool IsMemberIgnored(MemberInfo member) throw new ArgumentNullException(nameof(member)); } - ITypeReference typeRef = TypeReference.Create(GetReturnType(member), context, scope); + TypeReference typeRef = TypeReference.Create(GetReturnType(member), context, scope); if (!ignoreAttributes && TryGetAttribute(member, out GraphQLTypeAttribute? attribute) && @@ -139,7 +139,7 @@ public virtual bool IsMemberIgnored(MemberInfo member) } /// - public ITypeReference GetArgumentTypeRef( + public TypeReference GetArgumentTypeRef( ParameterInfo parameter, string? scope = null, bool ignoreAttributes = false) @@ -149,7 +149,7 @@ public virtual bool IsMemberIgnored(MemberInfo member) throw new ArgumentNullException(nameof(parameter)); } - ITypeReference typeRef = TypeReference.Create( + TypeReference typeRef = TypeReference.Create( GetArgumentType( parameter, ignoreAttributes), diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Conventions/ITypeInspector.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Conventions/ITypeInspector.cs index 185958c0567..45acccb56da 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Conventions/ITypeInspector.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Conventions/ITypeInspector.cs @@ -64,7 +64,7 @@ public interface ITypeInspector : IConvention /// /// Returns a type reference describing the type of the field. /// - ITypeReference GetReturnTypeRef( + TypeReference GetReturnTypeRef( MemberInfo member, TypeContext context = TypeContext.None, string? scope = null, @@ -99,7 +99,7 @@ public interface ITypeInspector : IConvention /// /// Returns a type reference describing the type of the argument. /// - ITypeReference GetArgumentTypeRef( + TypeReference GetArgumentTypeRef( ParameterInfo parameter, string? scope = null, bool ignoreAttributes = false); diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Conventions/TypeInspectorExtensions.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Conventions/TypeInspectorExtensions.cs index 547d59b65ba..e3750998e4e 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Conventions/TypeInspectorExtensions.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Conventions/TypeInspectorExtensions.cs @@ -5,28 +5,28 @@ namespace HotChocolate.Types.Descriptors; public static class TypeInspectorExtensions { - public static ITypeReference GetInputReturnTypeRef( + public static TypeReference GetInputReturnTypeRef( this ITypeInspector typeInspector, MemberInfo member) { return typeInspector.GetReturnTypeRef(member, TypeContext.Input); } - public static ITypeReference GetInputTypeRef( + public static TypeReference GetInputTypeRef( this ITypeInspector typeInspector, Type type) { return typeInspector.GetReturnTypeRef(type, TypeContext.Input); } - public static ITypeReference GetOutputReturnTypeRef( + public static TypeReference GetOutputReturnTypeRef( this ITypeInspector typeInspector, MemberInfo member) { return typeInspector.GetReturnTypeRef(member, TypeContext.Output); } - public static ITypeReference GetOutputTypeRef( + public static TypeReference GetOutputTypeRef( this ITypeInspector typeInspector, Type type) { diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ArgumentDefinition.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ArgumentDefinition.cs index 0ccd07a5b35..ba3195abcca 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ArgumentDefinition.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ArgumentDefinition.cs @@ -24,7 +24,7 @@ public class ArgumentDefinition : FieldDefinitionBase public ArgumentDefinition( string name, string? description = null, - ITypeReference? type = null, + TypeReference? type = null, IValueNode? defaultValue = null, object? runtimeDefaultValue = null) { 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 7452df99ac0..2f60b6760b8 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/CompleteConfiguration.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/CompleteConfiguration.cs @@ -14,7 +14,7 @@ public sealed class CompleteConfiguration Action configure, TDefinition owner, ApplyConfigurationOn on, - ITypeReference? typeReference = null, + TypeReference? typeReference = null, TypeDependencyFulfilled fulfilled = TypeDependencyFulfilled.Default) : base((c, d) => configure(c, (TDefinition)d), owner, on, typeReference, fulfilled) { @@ -39,7 +39,7 @@ public class CompleteConfiguration : ITypeSystemMemberConfiguration Action configure, IDefinition owner, ApplyConfigurationOn on, - ITypeReference? typeReference = null, + TypeReference? typeReference = null, TypeDependencyFulfilled fulfilled = TypeDependencyFulfilled.Default) { if (on is ApplyConfigurationOn.Create) diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/DirectiveArgumentDefinition.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/DirectiveArgumentDefinition.cs index e97f37818b5..5add37e6681 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/DirectiveArgumentDefinition.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/DirectiveArgumentDefinition.cs @@ -22,7 +22,7 @@ public class DirectiveArgumentDefinition : ArgumentDefinition public DirectiveArgumentDefinition( string name, string? description = null, - ITypeReference? type = null, + TypeReference? type = null, IValueNode? defaultValue = null, object? runtimeDefaultValue = null) { diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/DirectiveDefinition.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/DirectiveDefinition.cs index ab046d3f04a..605fe098e88 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/DirectiveDefinition.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/DirectiveDefinition.cs @@ -46,7 +46,7 @@ public DirectiveDefinition(object directive, ExtendedTypeDirectiveReference exte /// /// The directive type. /// - public ITypeReference Type { get; } + public TypeReference Type { get; } /// /// The directive value. diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/FieldDefinitionBase.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/FieldDefinitionBase.cs index d9b8c69491f..32c3e92094a 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/FieldDefinitionBase.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/FieldDefinitionBase.cs @@ -50,7 +50,7 @@ public abstract class FieldDefinitionBase /// /// Gets the field type. /// - public ITypeReference? Type { get; set; } + public TypeReference? Type { get; set; } /// /// Defines if this field is ignored and will diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IComplexOutputTypeDefinition.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IComplexOutputTypeDefinition.cs index 0dbbeac5390..c255bc92d26 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IComplexOutputTypeDefinition.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/IComplexOutputTypeDefinition.cs @@ -13,5 +13,5 @@ public interface IComplexOutputTypeDefinition IList KnownRuntimeTypes { get; } - IList Interfaces { get; } + IList Interfaces { get; } } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InputFieldDefinition.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InputFieldDefinition.cs index 7c0bd10b137..4c843c862b1 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InputFieldDefinition.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InputFieldDefinition.cs @@ -22,7 +22,7 @@ public class InputFieldDefinition : ArgumentDefinition public InputFieldDefinition( string name, string? description = null, - ITypeReference? type = null, + TypeReference? type = null, IValueNode? defaultValue = null, object? runtimeDefaultValue = null) : base(name, description, type, defaultValue, runtimeDefaultValue) diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InterfaceFieldDefinition.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InterfaceFieldDefinition.cs index 719884bc667..0f1e63cf096 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InterfaceFieldDefinition.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InterfaceFieldDefinition.cs @@ -27,7 +27,7 @@ public class InterfaceFieldDefinition : OutputFieldDefinitionBase public InterfaceFieldDefinition( string name, string? description = null, - ITypeReference? type = null) + TypeReference? type = null) { Name = name.EnsureGraphQLName(); Description = description; diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InterfaceTypeDefinition.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InterfaceTypeDefinition.cs index 3abc32a454a..e92af320da2 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InterfaceTypeDefinition.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/InterfaceTypeDefinition.cs @@ -13,7 +13,7 @@ public class InterfaceTypeDefinition , IComplexOutputTypeDefinition { private List? _knownClrTypes; - private List? _interfaces; + private List? _interfaces; /// /// Initializes a new instance of . @@ -37,7 +37,7 @@ public class InterfaceTypeDefinition public ResolveAbstractType? ResolveAbstractType { get; set; } - public IList Interfaces => _interfaces ??= new List(); + public IList Interfaces => _interfaces ??= new List(); /// /// Specifies if this definition has interfaces. @@ -91,11 +91,11 @@ internal IReadOnlyList GetKnownClrTypes() return _knownClrTypes; } - internal IReadOnlyList GetInterfaces() + internal IReadOnlyList GetInterfaces() { if (_interfaces is null) { - return Array.Empty(); + return Array.Empty(); } return _interfaces; diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ObjectFieldDefinition.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ObjectFieldDefinition.cs index a6fed761e44..2063e14a889 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ObjectFieldDefinition.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ObjectFieldDefinition.cs @@ -38,7 +38,7 @@ public ObjectFieldDefinition() public ObjectFieldDefinition( string name, string? description = null, - ITypeReference? type = null, + TypeReference? type = null, FieldResolverDelegate? resolver = null, PureFieldDelegate? pureResolver = 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 e4ea3ffa260..35baaf4a854 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ObjectTypeDefinition.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/ObjectTypeDefinition.cs @@ -17,7 +17,7 @@ public class ObjectTypeDefinition , IComplexOutputTypeDefinition { private List? _knownClrTypes; - private List? _interfaces; + private List? _interfaces; private List? _fieldIgnores; private FieldBindingFlags _fieldBindingFlags = FieldBindingFlags.Instance; @@ -83,8 +83,8 @@ public override Type RuntimeType /// /// Gets the interfaces that this object type implements. /// - public IList Interfaces => - _interfaces ??= new List(); + public IList Interfaces => + _interfaces ??= new List(); /// /// Specifies if this definition has interfaces. @@ -163,11 +163,11 @@ internal IReadOnlyList GetKnownClrTypes() return _knownClrTypes; } - internal IReadOnlyList GetInterfaces() + internal IReadOnlyList GetInterfaces() { if (_interfaces is null) { - return Array.Empty(); + return Array.Empty(); } return _interfaces; @@ -194,7 +194,7 @@ protected internal void CopyTo(ObjectTypeDefinition target) if (_interfaces is { Count: > 0 }) { - target._interfaces = new List(_interfaces); + target._interfaces = new List(_interfaces); } if (_fieldIgnores is { Count: > 0 }) @@ -229,7 +229,7 @@ protected internal void MergeInto(ObjectTypeDefinition target) if (_interfaces is { Count: > 0 }) { - target._interfaces ??= new List(); + target._interfaces ??= new List(); target._interfaces.AddRange(_interfaces); } 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 d0445a63e78..4e07a6685a1 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/TypeDependency.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/TypeDependency.cs @@ -9,7 +9,7 @@ namespace HotChocolate.Types.Descriptors.Definitions; public sealed class TypeDependency { public TypeDependency( - ITypeReference type, + TypeReference type, TypeDependencyFulfilled fulfilled = TypeDependencyFulfilled.Default) { Type = type ?? throw new ArgumentNullException(nameof(type)); @@ -18,10 +18,10 @@ public sealed class TypeDependency public TypeDependencyFulfilled Fulfilled { get; } - public ITypeReference Type { get; } + public TypeReference Type { get; } public TypeDependency With( - ITypeReference? typeReference = null, + TypeReference? typeReference = null, TypeDependencyFulfilled? kind = null) => new(typeReference ?? Type, kind ?? Fulfilled); 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 b25a7c3a1fd..4667d866b4a 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/UnionTypeDefinition.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/UnionTypeDefinition.cs @@ -38,5 +38,5 @@ public class UnionTypeDefinition : TypeDefinitionBase /// /// The types that make up the union type set. /// - public IList Types { get; } = new List(); + public IList Types { get; } = new List(); } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/TypeReferences/DependantFactoryTypeReference.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/TypeReferences/DependantFactoryTypeReference.cs index bc491be354a..026db648495 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/TypeReferences/DependantFactoryTypeReference.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/TypeReferences/DependantFactoryTypeReference.cs @@ -15,7 +15,7 @@ public sealed class DependantFactoryTypeReference { internal DependantFactoryTypeReference( string name, - ITypeReference dependency, + TypeReference dependency, Func factory, TypeContext context, string? scope = null) @@ -37,7 +37,7 @@ public sealed class DependantFactoryTypeReference /// /// Gets the reference to the type this type is dependant on. /// - public ITypeReference Dependency { get; } + public TypeReference Dependency { get; } /// /// Gets a factory to create this type. @@ -45,7 +45,7 @@ public sealed class DependantFactoryTypeReference public Func Factory { get; } /// - public override bool Equals(ITypeReference? other) + public override bool Equals(TypeReference? other) { if (other is null) { @@ -124,7 +124,7 @@ public override string ToString() public DependantFactoryTypeReference With( Optional name = default, - Optional dependency = default, + Optional dependency = default, Optional> factory = default, Optional context = default, Optional scope = default) diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/TypeReferences/ExtendedTypeDirectiveReference.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/TypeReferences/ExtendedTypeDirectiveReference.cs index 8a522b43a0b..2e02cb27914 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/TypeReferences/ExtendedTypeDirectiveReference.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/TypeReferences/ExtendedTypeDirectiveReference.cs @@ -45,7 +45,7 @@ public bool Equals(ExtendedTypeDirectiveReference? other) } /// - public override bool Equals(ITypeReference? other) + public override bool Equals(TypeReference? other) { if (other is null) { diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/TypeReferences/ExtendedTypeReference.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/TypeReferences/ExtendedTypeReference.cs index 527517a753c..00d6bf94ce1 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/TypeReferences/ExtendedTypeReference.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/TypeReferences/ExtendedTypeReference.cs @@ -48,7 +48,7 @@ public bool Equals(ExtendedTypeReference? other) } /// - public override bool Equals(ITypeReference? other) + public override bool Equals(TypeReference? other) { if (other is null) { diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/TypeReferences/ITypeReference.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/TypeReferences/ITypeReference.cs deleted file mode 100644 index 6a75c07e372..00000000000 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/TypeReferences/ITypeReference.cs +++ /dev/null @@ -1,27 +0,0 @@ -#nullable enable - -using System; - -namespace HotChocolate.Types.Descriptors; - -/// -/// A type reference is used to refer to a type in the type system. -/// This allows us to loosely couple types during schema creation. -/// -public interface ITypeReference : IEquatable -{ - /// - /// Gets the kind of type reference. - /// - TypeReferenceKind Kind { get; } - - /// - /// Gets the context in which the type reference was created. - /// - TypeContext Context { get; } - - /// - /// Gets the scope in which the type reference was created. - /// - string? Scope { get; } -} diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/TypeReferences/NameDirectiveReference.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/TypeReferences/NameDirectiveReference.cs index 56a63c4672c..9409dc87aab 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/TypeReferences/NameDirectiveReference.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/TypeReferences/NameDirectiveReference.cs @@ -42,7 +42,7 @@ public bool Equals(NameDirectiveReference? other) } /// - public override bool Equals(ITypeReference? other) + public override bool Equals(TypeReference? other) { if (other is null) { diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/TypeReferences/SchemaTypeReference.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/TypeReferences/SchemaTypeReference.cs index e992ad5effe..4984fa261df 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/TypeReferences/SchemaTypeReference.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/TypeReferences/SchemaTypeReference.cs @@ -48,7 +48,7 @@ public bool Equals(SchemaTypeReference? other) } /// - public override bool Equals(ITypeReference? other) + public override bool Equals(TypeReference? other) { if (other is null) { diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/TypeReferences/SyntaxTypeReference.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/TypeReferences/SyntaxTypeReference.cs index 82d701d6272..e47a4db5a6f 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/TypeReferences/SyntaxTypeReference.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/TypeReferences/SyntaxTypeReference.cs @@ -64,7 +64,7 @@ public bool Equals(SyntaxTypeReference? other) } /// - public override bool Equals(ITypeReference? other) + public override bool Equals(TypeReference? other) { if (other is null) { diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/TypeReferences/TypeReference.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/TypeReferences/TypeReference.cs index 5b9d29c96ce..28bd7a42465 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/TypeReferences/TypeReference.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/TypeReferences/TypeReference.cs @@ -12,7 +12,7 @@ namespace HotChocolate.Types.Descriptors; /// A type reference is used to refer to a type in the type system. /// This allows us to loosely couple types during schema creation. /// -public abstract class TypeReference : ITypeReference +public abstract class TypeReference : IEquatable { protected TypeReference( TypeReferenceKind kind, @@ -33,7 +33,7 @@ public abstract class TypeReference : ITypeReference /// public string? Scope { get; } - protected bool IsEqual(ITypeReference other) + protected bool IsEqual(TypeReference other) { if (Context != other.Context && Context != TypeContext.None @@ -50,7 +50,7 @@ protected bool IsEqual(ITypeReference other) return true; } - public abstract bool Equals(ITypeReference? other); + public abstract bool Equals(TypeReference? other); public override bool Equals(object? obj) { @@ -64,7 +64,7 @@ public override bool Equals(object? obj) return true; } - return Equals(obj as ITypeReference); + return Equals(obj as TypeReference); } public override int GetHashCode() @@ -77,7 +77,7 @@ protected string ToString(object name) public static DependantFactoryTypeReference Create( string name, - ITypeReference dependency, + TypeReference dependency, Func factory, TypeContext context = TypeContext.None, string? scope = null) diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/TypeReferences/TypeReferenceExtensions.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/TypeReferences/TypeReferenceExtensions.cs index 3d789c89d52..66f4d427f41 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/TypeReferences/TypeReferenceExtensions.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/TypeReferences/TypeReferenceExtensions.cs @@ -6,8 +6,8 @@ namespace HotChocolate.Types.Descriptors; public static class TypeReferenceExtensions { - public static ITypeReference With( - this ITypeReference typeReference, + public static TypeReference With( + this TypeReference typeReference, Optional context = default, Optional scope = default) => typeReference switch { diff --git a/src/HotChocolate/Core/src/Types/Types/Directives/Directives.cs b/src/HotChocolate/Core/src/Types/Types/Directives/Directives.cs index b91e80288e5..4741348b0c5 100644 --- a/src/HotChocolate/Core/src/Types/Types/Directives/Directives.cs +++ b/src/HotChocolate/Core/src/Types/Types/Directives/Directives.cs @@ -20,11 +20,11 @@ public static class Directives WellKnownDirectives.OneOf }; - internal static IReadOnlyList CreateReferences( + internal static IReadOnlyList CreateReferences( IDescriptorContext descriptorContext) { var typeInspector = descriptorContext.TypeInspector; - var directiveTypes = new List(); + var directiveTypes = new List(); if (descriptorContext.Options.EnableOneOf) { diff --git a/src/HotChocolate/Core/src/Types/Types/Factories/SchemaSyntaxVisitorContext.cs b/src/HotChocolate/Core/src/Types/Types/Factories/SchemaSyntaxVisitorContext.cs index cf74ff6c71c..8cb659dea2a 100644 --- a/src/HotChocolate/Core/src/Types/Types/Factories/SchemaSyntaxVisitorContext.cs +++ b/src/HotChocolate/Core/src/Types/Types/Factories/SchemaSyntaxVisitorContext.cs @@ -14,7 +14,7 @@ public SchemaSyntaxVisitorContext(IDescriptorContext directiveContext) DirectiveContext = directiveContext; } - public List Types { get; } = new(); + public List Types { get; } = new(); public IReadOnlyCollection? Directives { get; set; } diff --git a/src/HotChocolate/Core/src/Types/Types/Helpers/CompleteInterfacesHelper.cs b/src/HotChocolate/Core/src/Types/Types/Helpers/CompleteInterfacesHelper.cs index 5b9bdaf5ad6..f910c3da602 100644 --- a/src/HotChocolate/Core/src/Types/Types/Helpers/CompleteInterfacesHelper.cs +++ b/src/HotChocolate/Core/src/Types/Types/Helpers/CompleteInterfacesHelper.cs @@ -12,7 +12,7 @@ internal static class CompleteInterfacesHelper { public static InterfaceType[] CompleteInterfaces( ITypeCompletionContext context, - IReadOnlyList interfaceReferences, + IReadOnlyList interfaceReferences, TInterfaceOrObject interfaceOrObject) where TInterfaceOrObject : ITypeSystemObject, IHasSyntaxNode diff --git a/src/HotChocolate/Core/src/Types/Types/Helpers/DescriptorHelpers.cs b/src/HotChocolate/Core/src/Types/Types/Helpers/DescriptorHelpers.cs index a69b474d109..11ceae09e90 100644 --- a/src/HotChocolate/Core/src/Types/Types/Helpers/DescriptorHelpers.cs +++ b/src/HotChocolate/Core/src/Types/Types/Helpers/DescriptorHelpers.cs @@ -34,7 +34,7 @@ internal static class DescriptorHelpers } private static bool IsTypeMoreSpecific( - ITypeReference typeReference, + TypeReference typeReference, IExtendedType type) { if (typeReference is SchemaTypeReference) @@ -52,7 +52,7 @@ internal static class DescriptorHelpers } private static bool IsTypeMoreSpecific( - ITypeReference typeReference, + TypeReference typeReference, ITypeNode typeNode) { if (typeReference is SchemaTypeReference) diff --git a/src/HotChocolate/Core/src/Types/Types/Interceptors/FlagEnumTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/Types/Interceptors/FlagEnumTypeInterceptor.cs index b657daeef8f..46719ec7e73 100644 --- a/src/HotChocolate/Core/src/Types/Types/Interceptors/FlagEnumTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Interceptors/FlagEnumTypeInterceptor.cs @@ -175,7 +175,7 @@ private RegisteredInputType CreateInputObjectType(Type type) return result; } - private static bool IsFlagsEnum(ITypeReference? reference, [NotNullWhen(true)] out Type? type) + private static bool IsFlagsEnum(TypeReference? reference, [NotNullWhen(true)] out Type? type) { if (reference is not ExtendedTypeReference extReference) { @@ -207,7 +207,7 @@ private static string GetFlagFieldName(Type type, object value) return $"is{char.ToUpper(valueName[0])}{valueName.Substring(1)}"; } - private static ITypeReference? CreateTypeReference(ITypeReference? reference, string typeName) + private static TypeReference? CreateTypeReference(TypeReference? reference, string typeName) { if (reference is not ExtendedTypeReference extReference) { diff --git a/src/HotChocolate/Core/src/Types/Types/Interceptors/ResolverTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/Types/Interceptors/ResolverTypeInterceptor.cs index bf61a47f0dc..6e17111e1ec 100644 --- a/src/HotChocolate/Core/src/Types/Types/Interceptors/ResolverTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Interceptors/ResolverTypeInterceptor.cs @@ -71,7 +71,7 @@ internal sealed class ResolverTypeInterceptor : TypeInterceptor } } - public override IEnumerable RegisterMoreTypes( + public override IEnumerable RegisterMoreTypes( IReadOnlyCollection discoveryContexts) { var context = new CompletionContext(_typeDefs); @@ -408,7 +408,7 @@ private void CollectSourceMembers(CompletionContext context, Type runtimeType) private IReadOnlyCollection? TrySetRuntimeTypeFromMember( CompletionContext context, - ITypeReference? typeRef, + TypeReference? typeRef, MemberInfo member) { if (typeRef is not null && _typeReferenceResolver.TryGetType(typeRef, out var type)) diff --git a/src/HotChocolate/Core/src/Types/Types/Introspection/IntrospectionTypes.cs b/src/HotChocolate/Core/src/Types/Types/Introspection/IntrospectionTypes.cs index 92cd313e890..cc30f80df5a 100644 --- a/src/HotChocolate/Core/src/Types/Types/Introspection/IntrospectionTypes.cs +++ b/src/HotChocolate/Core/src/Types/Types/Introspection/IntrospectionTypes.cs @@ -23,10 +23,10 @@ public static class IntrospectionTypes __DirectiveArgument.Names.__DirectiveArgument }; - internal static IReadOnlyList CreateReferences( + internal static IReadOnlyList CreateReferences( IDescriptorContext context) { - var types = new List + var types = new List { context.TypeInspector.GetTypeRef(typeof(__Directive)), context.TypeInspector.GetTypeRef(typeof(__DirectiveLocation)), diff --git a/src/HotChocolate/Core/src/Types/Types/Relay/QueryFieldTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/Types/Relay/QueryFieldTypeInterceptor.cs index 52cf1548893..9fd2adce9ce 100644 --- a/src/HotChocolate/Core/src/Types/Types/Relay/QueryFieldTypeInterceptor.cs +++ b/src/HotChocolate/Core/src/Types/Types/Relay/QueryFieldTypeInterceptor.cs @@ -46,7 +46,7 @@ public override void OnBeforeCompleteTypes() { var options = _context.DescriptorContext.GetMutationPayloadOptions(); - ITypeReference queryType = TypeReference.Parse($"{_queryType.Name}!"); + TypeReference queryType = TypeReference.Parse($"{_queryType.Name}!"); _queryField= new ObjectFieldDefinition( options.QueryFieldName ?? _defaultFieldName, diff --git a/src/HotChocolate/Core/src/Types/Utilities/ThrowHelper.cs b/src/HotChocolate/Core/src/Types/Utilities/ThrowHelper.cs index 70fefa1f9c7..09b9d849d2b 100644 --- a/src/HotChocolate/Core/src/Types/Utilities/ThrowHelper.cs +++ b/src/HotChocolate/Core/src/Types/Utilities/ThrowHelper.cs @@ -100,7 +100,7 @@ internal static class ThrowHelper public static SchemaException TypeCompletionContext_UnableToResolveType( ITypeSystemObject type, - ITypeReference typeRef) => + TypeReference typeRef) => new SchemaException( SchemaErrorBuilder.New() .SetMessage( diff --git a/src/HotChocolate/Core/test/Execution.Tests/Configuration/TypeModuleTests.cs b/src/HotChocolate/Core/test/Execution.Tests/Configuration/TypeModuleTests.cs index 77b762ab3e6..5654ffb0212 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/Configuration/TypeModuleTests.cs +++ b/src/HotChocolate/Core/test/Execution.Tests/Configuration/TypeModuleTests.cs @@ -7,7 +7,6 @@ using HotChocolate.Types.Descriptors; using HotChocolate.Types.Descriptors.Definitions; using Microsoft.Extensions.DependencyInjection; -using Xunit; namespace HotChocolate.Execution.Configuration; diff --git a/src/HotChocolate/Core/test/Execution.Tests/DependencyInjection/RequestExecutorBuilderExtensions_TypeDiscovery.Tests.cs b/src/HotChocolate/Core/test/Execution.Tests/DependencyInjection/RequestExecutorBuilderExtensions_TypeDiscovery.Tests.cs index bedcb0f887f..51e4a577945 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/DependencyInjection/RequestExecutorBuilderExtensions_TypeDiscovery.Tests.cs +++ b/src/HotChocolate/Core/test/Execution.Tests/DependencyInjection/RequestExecutorBuilderExtensions_TypeDiscovery.Tests.cs @@ -31,9 +31,9 @@ public void AddTypeDiscoveryHandler_1_Factory_Is_Null() public sealed class MockHandler : TypeDiscoveryHandler { public override bool TryInferType( - ITypeReference typeReference, + TypeReference typeReference, TypeDiscoveryInfo typeReferenceInfo, - out ITypeReference[] schemaTypeRefs) + out TypeReference[] schemaTypeRefs) { schemaTypeRefs = null; return true; diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/Log.txt b/src/HotChocolate/Core/test/Types.Analyzers.Tests/Log.txt new file mode 100644 index 00000000000..f36e1340770 --- /dev/null +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/Log.txt @@ -0,0 +1,6 @@ +scoped: global::HotChocolate.Types.GenericService> +non scoped: global::HotChocolate.Types.SomeService +scoped: global::HotChocolate.Types.SomeService +scoped: global::HotChocolate.Types.SomeService +scoped: global::HotChocolate.Types.SomeService +scoped: global::HotChocolate.Types.SomeService diff --git a/src/HotChocolate/Core/test/Types.Tests/Configuration/TypeDiscovererTests.cs b/src/HotChocolate/Core/test/Types.Tests/Configuration/TypeDiscovererTests.cs index 7aa49f3f00f..05bd5f6f379 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Configuration/TypeDiscovererTests.cs +++ b/src/HotChocolate/Core/test/Types.Tests/Configuration/TypeDiscovererTests.cs @@ -24,7 +24,7 @@ public void Register_SchemaType_ClrTypeExists_NoSystemTypes() context, typeRegistry, typeLookup, - new HashSet + new HashSet { _typeInspector.GetTypeRef(typeof(FooType), TypeContext.Output) }, @@ -68,7 +68,7 @@ public void Register_SchemaType_ClrTypeExists() context, typeRegistry, typeLookup, - new HashSet + new HashSet { _typeInspector.GetTypeRef(typeof(FooType), TypeContext.Output) }, @@ -112,7 +112,7 @@ public void Register_ClrType_InferSchemaTypes() context, typeRegistry, typeLookup, - new HashSet + new HashSet { _typeInspector.GetTypeRef(typeof(Foo), TypeContext.Output) }, @@ -156,7 +156,7 @@ public void Upgrade_Type_From_GenericType() context, typeRegistry, typeLookup, - new HashSet + new HashSet { _typeInspector.GetTypeRef(typeof(ObjectType), TypeContext.Output), _typeInspector.GetTypeRef(typeof(FooType), TypeContext.Output) @@ -200,7 +200,7 @@ public void Cannot_Infer_Input_Type() context, typeRegistry, typeLookup, - new HashSet + new HashSet { _typeInspector.GetTypeRef(typeof(QueryWithInferError), TypeContext.Output), }, @@ -234,7 +234,7 @@ public void Cannot_Infer_Multiple_Input_Type() context, typeRegistry, typeLookup, - new HashSet + new HashSet { _typeInspector.GetTypeRef(typeof(QueryWithInferError), TypeContext.Output), _typeInspector.GetTypeRef(typeof(QueryWithInferError2), TypeContext.Output), diff --git a/src/HotChocolate/Core/test/Types.Tests/Configuration/TypeInitializerTests.cs b/src/HotChocolate/Core/test/Types.Tests/Configuration/TypeInitializerTests.cs index 5b5bc401706..9f7b3b98c6f 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Configuration/TypeInitializerTests.cs +++ b/src/HotChocolate/Core/test/Types.Tests/Configuration/TypeInitializerTests.cs @@ -24,7 +24,7 @@ public void Register_SchemaType_ClrTypeExists() var typeInitializer = new TypeInitializer( context, typeRegistry, - new List + new List { context.TypeInspector.GetTypeRef(typeof(FooType), TypeContext.Output) }, @@ -72,7 +72,7 @@ public void Register_ClrType_InferSchemaTypes() var typeInitializer = new TypeInitializer( context, typeRegistry, - new List + new List { context.TypeInspector.GetTypeRef(typeof(Foo), TypeContext.Output) }, @@ -128,7 +128,7 @@ public void Initializer_SchemaOptions_Are_Null() void Action() => new TypeInitializer( context, typeRegistry, - new List + new List { context.TypeInspector.GetTypeRef(typeof(Foo), TypeContext.Output) }, @@ -269,12 +269,12 @@ public override void OnTypeRegistered(ITypeDiscoveryContext discoveryContext) private sealed class InjectTypes : TypeInterceptor { - private readonly List _typeReferences; + private readonly List _typeReferences; - public InjectTypes(IEnumerable typeReferences) + public InjectTypes(IEnumerable typeReferences) => _typeReferences = typeReferences.ToList(); - public override IEnumerable RegisterMoreTypes( + public override IEnumerable RegisterMoreTypes( IReadOnlyCollection discoveryContexts) => _typeReferences; } diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/TypeReferences/ClrTypeReferenceTests.cs b/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/TypeReferences/ClrTypeReferenceTests.cs index 10e236a873f..4ed75b6e82e 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/TypeReferences/ClrTypeReferenceTests.cs +++ b/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/TypeReferences/ClrTypeReferenceTests.cs @@ -147,35 +147,35 @@ public void ClrTypeReference_Equals_Scope_Different() } [Fact] - public void ITypeReference_Equals_To_Null() + public void TypeReference_Equals_To_Null() { // arrange var x = TypeReference.Create( _typeInspector.GetType(typeof(string))); // act - var result = x.Equals((ITypeReference)null); + var result = x.Equals((TypeReference)null); // assert Assert.False(result); } [Fact] - public void ITypeReference_Equals_To_Same() + public void TypeReference_Equals_To_Same() { // arrange var x = TypeReference.Create( _typeInspector.GetType(typeof(string))); // act - var xx = x.Equals((ITypeReference)x); + var xx = x.Equals((TypeReference)x); // assert Assert.True(xx); } [Fact] - public void ITypeReference_Equals_To_SyntaxTypeRef() + public void TypeReference_Equals_To_SyntaxTypeRef() { // arrange var x = TypeReference.Create(_typeInspector.GetType(typeof(string))); @@ -188,7 +188,7 @@ public void ITypeReference_Equals_To_SyntaxTypeRef() } [Fact] - public void ITypeReference_Equals_Context_None_Does_Not_Matter() + public void TypeReference_Equals_Context_None_Does_Not_Matter() { // arrange var x = TypeReference.Create( @@ -204,9 +204,9 @@ public void ITypeReference_Equals_Context_None_Does_Not_Matter() TypeContext.Input); // act - var xy = x.Equals((ITypeReference)y); - var xz = x.Equals((ITypeReference)z); - var yz = y.Equals((ITypeReference)z); + var xy = x.Equals((TypeReference)y); + var xz = x.Equals((TypeReference)z); + var yz = y.Equals((TypeReference)z); // assert Assert.True(xy); @@ -215,7 +215,7 @@ public void ITypeReference_Equals_Context_None_Does_Not_Matter() } [Fact] - public void ITypeReference_Equals_Scope_Different() + public void TypeReference_Equals_Scope_Different() { // arrange var x = TypeReference.Create( @@ -233,9 +233,9 @@ public void ITypeReference_Equals_Scope_Different() TypeContext.Input); // act - var xy = x.Equals((ITypeReference)y); - var xz = x.Equals((ITypeReference)z); - var yz = y.Equals((ITypeReference)z); + var xy = x.Equals((TypeReference)y); + var xz = x.Equals((TypeReference)z); + var yz = y.Equals((TypeReference)z); // assert Assert.True(xy); diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/TypeReferences/SchemaTypeReferenceTests.cs b/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/TypeReferences/SchemaTypeReferenceTests.cs index 3d5e76a8e2c..391e3b87e13 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/TypeReferences/SchemaTypeReferenceTests.cs +++ b/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/TypeReferences/SchemaTypeReferenceTests.cs @@ -106,35 +106,35 @@ public async Task SchemaTypeReference_Equals_Scope_Different() } [Fact] - public async Task ITypeReference_Equals_To_Null() + public async Task TypeReference_Equals_To_Null() { // arrange var type = await CreateTypeAsync(); var x = TypeReference.Create(type); // act - var result = x.Equals((ITypeReference)null); + var result = x.Equals((TypeReference)null); // assert Assert.False(result); } [Fact] - public async Task ITypeReference_Equals_To_Same() + public async Task TypeReference_Equals_To_Same() { // arrange var type = await CreateTypeAsync(); var x = TypeReference.Create(type); // act - var xx = x.Equals((ITypeReference)x); + var xx = x.Equals((TypeReference)x); // assert Assert.True(xx); } [Fact] - public async Task ITypeReference_Equals_To_SyntaxTypeRef() + public async Task TypeReference_Equals_To_SyntaxTypeRef() { // arrange var type = await CreateTypeAsync(); @@ -148,7 +148,7 @@ public async Task ITypeReference_Equals_To_SyntaxTypeRef() } [Fact] - public async Task ITypeReference_Equals_Scope_Different() + public async Task TypeReference_Equals_Scope_Different() { // arrange var type = await CreateTypeAsync(); @@ -157,8 +157,8 @@ public async Task ITypeReference_Equals_Scope_Different() var z = TypeReference.Create(type, scope: "abc"); // act - var xy = x.Equals((ITypeReference)y); - var xz = x.Equals((ITypeReference)y); + var xy = x.Equals((TypeReference)y); + var xz = x.Equals((TypeReference)y); // assert Assert.False(xy); diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/TypeReferences/SyntaxTypeReferenceTests.cs b/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/TypeReferences/SyntaxTypeReferenceTests.cs index 9baa67cb344..4f8e24b3187 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/TypeReferences/SyntaxTypeReferenceTests.cs +++ b/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/TypeReferences/SyntaxTypeReferenceTests.cs @@ -129,7 +129,7 @@ public void SyntaxTypeReference_Equals_Scope_Different() } [Fact] - public void ITypeReference_Equals_To_Null() + public void TypeReference_Equals_To_Null() { // arrange var x = TypeReference.Create( @@ -137,14 +137,14 @@ public void ITypeReference_Equals_To_Null() TypeContext.None); // act - var result = x.Equals((ITypeReference)null); + var result = x.Equals((TypeReference)null); // assert Assert.False(result); } [Fact] - public void ITypeReference_Equals_To_Same() + public void TypeReference_Equals_To_Same() { // arrange var x = TypeReference.Create( @@ -152,14 +152,14 @@ public void ITypeReference_Equals_To_Same() TypeContext.None); // act - var xx = x.Equals((ITypeReference)x); + var xx = x.Equals((TypeReference)x); // assert Assert.True(xx); } [Fact] - public void ITypeReference_Equals_To_SyntaxTypeRef() + public void TypeReference_Equals_To_SyntaxTypeRef() { // arrange var x = TypeReference.Create( @@ -174,7 +174,7 @@ public void ITypeReference_Equals_To_SyntaxTypeRef() } [Fact] - public void ITypeReference_Equals_Context_None_Does_Not_Matter() + public void TypeReference_Equals_Context_None_Does_Not_Matter() { // arrange var x = TypeReference.Create( @@ -190,9 +190,9 @@ public void ITypeReference_Equals_Context_None_Does_Not_Matter() TypeContext.Input); // act - var xy = x.Equals((ITypeReference)y); - var xz = x.Equals((ITypeReference)z); - var yz = y.Equals((ITypeReference)z); + var xy = x.Equals((TypeReference)y); + var xz = x.Equals((TypeReference)z); + var yz = y.Equals((TypeReference)z); // assert Assert.True(xy); @@ -201,7 +201,7 @@ public void ITypeReference_Equals_Context_None_Does_Not_Matter() } [Fact] - public void ITypeReference_Equals_Scope_Different() + public void TypeReference_Equals_Scope_Different() { // arrange var x = TypeReference.Create( @@ -219,9 +219,9 @@ public void ITypeReference_Equals_Scope_Different() TypeContext.Input); // act - var xy = x.Equals((ITypeReference)y); - var xz = x.Equals((ITypeReference)z); - var yz = y.Equals((ITypeReference)z); + var xy = x.Equals((TypeReference)y); + var xz = x.Equals((TypeReference)z); + var yz = y.Equals((TypeReference)z); // assert Assert.True(xy); diff --git a/src/HotChocolate/Data/src/Data/Filters/Convention/FilterConvention.cs b/src/HotChocolate/Data/src/Data/Filters/Convention/FilterConvention.cs index 6a9fd9275cf..45ece4d9677 100644 --- a/src/HotChocolate/Data/src/Data/Filters/Convention/FilterConvention.cs +++ b/src/HotChocolate/Data/src/Data/Filters/Convention/FilterConvention.cs @@ -28,7 +28,7 @@ public class FilterConvention private INamingConventions _namingConventions = default!; private IReadOnlyDictionary _operations = default!; private IDictionary _bindings = default!; - private IDictionary> _configs = default!; + private IDictionary> _configs = default!; private string _argumentName = default!; private IFilterProvider _provider = default!; @@ -249,7 +249,7 @@ public string GetOperationName(int operation) /// public void ApplyConfigurations( - ITypeReference typeReference, + TypeReference typeReference, IFilterInputTypeDescriptor descriptor) { if (_configs.TryGetValue( diff --git a/src/HotChocolate/Data/src/Data/Filters/Convention/FilterConventionDefinition.cs b/src/HotChocolate/Data/src/Data/Filters/Convention/FilterConventionDefinition.cs index 40bcf57d88a..d6e31bb437b 100644 --- a/src/HotChocolate/Data/src/Data/Filters/Convention/FilterConventionDefinition.cs +++ b/src/HotChocolate/Data/src/Data/Filters/Convention/FilterConventionDefinition.cs @@ -28,8 +28,8 @@ public string ArgumentName public IDictionary Bindings { get; } = new Dictionary(); - public IDictionary> Configurations { get; } = - new Dictionary>( + public IDictionary> Configurations { get; } = + new Dictionary>( TypeReferenceComparer.Default); public List ProviderExtensions { get; } = new(); diff --git a/src/HotChocolate/Data/src/Data/Filters/Convention/FilterConventionDescriptor.cs b/src/HotChocolate/Data/src/Data/Filters/Convention/FilterConventionDescriptor.cs index a6adf1c4214..60b561460bb 100644 --- a/src/HotChocolate/Data/src/Data/Filters/Convention/FilterConventionDescriptor.cs +++ b/src/HotChocolate/Data/src/Data/Filters/Convention/FilterConventionDescriptor.cs @@ -104,7 +104,7 @@ public IFilterConventionDescriptor BindRuntimeType(Type runtimeType, Type filter }); protected IFilterConventionDescriptor Configure( - ITypeReference typeReference, + TypeReference typeReference, ConfigureFilterInputType configure) { if (!Definition.Configurations.TryGetValue( diff --git a/src/HotChocolate/Data/src/Data/Filters/Convention/IFilterConvention.cs b/src/HotChocolate/Data/src/Data/Filters/Convention/IFilterConvention.cs index a18cdff905c..11c5ccabb2d 100644 --- a/src/HotChocolate/Data/src/Data/Filters/Convention/IFilterConvention.cs +++ b/src/HotChocolate/Data/src/Data/Filters/Convention/IFilterConvention.cs @@ -110,7 +110,7 @@ public interface IFilterConvention : IConvention /// The descriptor to which the configurations shall be applied to. /// void ApplyConfigurations( - ITypeReference typeReference, + TypeReference typeReference, IFilterInputTypeDescriptor descriptor); bool TryGetHandler( diff --git a/src/HotChocolate/Data/src/Data/Filters/Convention/TypeReferenceComparer.cs b/src/HotChocolate/Data/src/Data/Filters/Convention/TypeReferenceComparer.cs index 0c6b1f33338..b89a5c23a81 100644 --- a/src/HotChocolate/Data/src/Data/Filters/Convention/TypeReferenceComparer.cs +++ b/src/HotChocolate/Data/src/Data/Filters/Convention/TypeReferenceComparer.cs @@ -6,9 +6,9 @@ namespace HotChocolate.Data.Filters; internal sealed class TypeReferenceComparer - : IEqualityComparer + : IEqualityComparer { - public bool Equals(ITypeReference? x, ITypeReference? y) + public bool Equals(TypeReference? x, TypeReference? y) { if (ReferenceEquals(x, y)) { @@ -47,7 +47,7 @@ public bool Equals(ITypeReference? x, ITypeReference? y) return x.Equals(y); } - public int GetHashCode(ITypeReference obj) + public int GetHashCode(TypeReference obj) { unchecked { @@ -77,6 +77,6 @@ public int GetHashCode(ITypeReference obj) ExtendedTypeReference extendedTypeReference) => schemaTypeReference.Type.GetType() == extendedTypeReference.Type.Source; - public static readonly IEqualityComparer Default = + public static readonly IEqualityComparer Default = new TypeReferenceComparer(); } diff --git a/src/HotChocolate/Data/src/Data/Filters/Extensions/FilterFieldDescriptorExtensions.cs b/src/HotChocolate/Data/src/Data/Filters/Extensions/FilterFieldDescriptorExtensions.cs index f089874b447..2cdaafeddef 100644 --- a/src/HotChocolate/Data/src/Data/Filters/Extensions/FilterFieldDescriptorExtensions.cs +++ b/src/HotChocolate/Data/src/Data/Filters/Extensions/FilterFieldDescriptorExtensions.cs @@ -18,7 +18,7 @@ public static class FilterFieldDescriptorExtensions .OnBeforeCreate( (c, def) => def.Type = RewriteTypeToNullableType(def, c.TypeInspector)); - private static ITypeReference RewriteTypeToNullableType( + private static TypeReference RewriteTypeToNullableType( FilterFieldDefinition definition, ITypeInspector typeInspector) { diff --git a/src/HotChocolate/Data/src/Data/Filters/Extensions/FilterObjectFieldDescriptorExtensions.cs b/src/HotChocolate/Data/src/Data/Filters/Extensions/FilterObjectFieldDescriptorExtensions.cs index 665afeb9ac8..bbc97babe31 100644 --- a/src/HotChocolate/Data/src/Data/Filters/Extensions/FilterObjectFieldDescriptorExtensions.cs +++ b/src/HotChocolate/Data/src/Data/Filters/Extensions/FilterObjectFieldDescriptorExtensions.cs @@ -140,7 +140,7 @@ public static class FilterObjectFieldDescriptorExtensions (c, definition) => { var convention = c.GetFilterConvention(scope); - ITypeReference argumentTypeReference; + TypeReference argumentTypeReference; if (filterTypeInstance is not null) { @@ -206,7 +206,7 @@ public static class FilterObjectFieldDescriptorExtensions private static void CompileMiddleware( ITypeCompletionContext context, ObjectFieldDefinition definition, - ITypeReference argumentTypeReference, + TypeReference argumentTypeReference, FieldMiddlewareDefinition placeholder, string? scope) { diff --git a/src/HotChocolate/Data/src/Data/Sorting/Convention/ISortConvention.cs b/src/HotChocolate/Data/src/Data/Sorting/Convention/ISortConvention.cs index 5201b5014f9..6674389e819 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/Convention/ISortConvention.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/Convention/ISortConvention.cs @@ -111,7 +111,7 @@ public interface ISortConvention : IConvention /// The descriptor to which the configurations shall be applied to. /// void ApplyConfigurations( - ITypeReference typeReference, + TypeReference typeReference, ISortInputTypeDescriptor descriptor); /// @@ -124,7 +124,7 @@ public interface ISortConvention : IConvention /// The descriptor to which the configurations shall be applied to. /// void ApplyConfigurations( - ITypeReference typeReference, + TypeReference typeReference, ISortEnumTypeDescriptor descriptor); bool TryGetFieldHandler( diff --git a/src/HotChocolate/Data/src/Data/Sorting/Convention/SortConvention.cs b/src/HotChocolate/Data/src/Data/Sorting/Convention/SortConvention.cs index 3558ea2a4bf..fedbca5763a 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/Convention/SortConvention.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/Convention/SortConvention.cs @@ -30,10 +30,10 @@ public class SortConvention private IReadOnlyDictionary _operations = default!; private IDictionary _bindings = default!; - private IDictionary> _inputTypeConfigs = + private IDictionary> _inputTypeConfigs = default!; - private IDictionary> _enumTypeConfigs = + private IDictionary> _enumTypeConfigs = default!; private string _argumentName = default!; @@ -191,7 +191,7 @@ public string GetOperationName(int operation) /// public void ApplyConfigurations( - ITypeReference typeReference, + TypeReference typeReference, ISortInputTypeDescriptor descriptor) { if (_inputTypeConfigs.TryGetValue( @@ -211,7 +211,7 @@ public string GetOperationName(int operation) } public void ApplyConfigurations( - ITypeReference typeReference, + TypeReference typeReference, ISortEnumTypeDescriptor descriptor) { if (_enumTypeConfigs.TryGetValue( diff --git a/src/HotChocolate/Data/src/Data/Sorting/Convention/SortConventionDefinition.cs b/src/HotChocolate/Data/src/Data/Sorting/Convention/SortConventionDefinition.cs index 1f7eb3afeee..4be45f9dc7f 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/Convention/SortConventionDefinition.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/Convention/SortConventionDefinition.cs @@ -30,12 +30,12 @@ public string ArgumentName public IDictionary Bindings { get; } = new Dictionary(); - public IDictionary> Configurations { get; } = - new Dictionary>( + public IDictionary> Configurations { get; } = + new Dictionary>( TypeReferenceComparer.Default); - public IDictionary> EnumConfigurations { get; } - = new Dictionary>( + public IDictionary> EnumConfigurations { get; } + = new Dictionary>( TypeReferenceComparer.Default); public IList ProviderExtensions { get; } = diff --git a/src/HotChocolate/Data/src/Data/Sorting/Convention/SortConventionDescriptor.cs b/src/HotChocolate/Data/src/Data/Sorting/Convention/SortConventionDescriptor.cs index b3b880cea3b..e631d1c3142 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/Convention/SortConventionDescriptor.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/Convention/SortConventionDescriptor.cs @@ -135,7 +135,7 @@ public ISortConventionDescriptor BindRuntimeType(Type runtimeType, Type sortType } protected ISortConventionDescriptor Configure( - ITypeReference typeReference, + TypeReference typeReference, ConfigureSortInputType configure) { if (!Definition.Configurations.TryGetValue( diff --git a/src/HotChocolate/Data/src/Data/Sorting/Convention/TypeReferenceComparer.cs b/src/HotChocolate/Data/src/Data/Sorting/Convention/TypeReferenceComparer.cs index b7c5ef20cd7..f791bb05f6d 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/Convention/TypeReferenceComparer.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/Convention/TypeReferenceComparer.cs @@ -6,9 +6,9 @@ namespace HotChocolate.Data.Sorting; internal sealed class TypeReferenceComparer - : IEqualityComparer + : IEqualityComparer { - public bool Equals(ITypeReference? x, ITypeReference? y) + public bool Equals(TypeReference? x, TypeReference? y) { if (ReferenceEquals(x, y)) { @@ -47,7 +47,7 @@ public bool Equals(ITypeReference? x, ITypeReference? y) return x.Equals(y); } - public int GetHashCode(ITypeReference obj) + public int GetHashCode(TypeReference obj) { unchecked { @@ -77,6 +77,6 @@ public int GetHashCode(ITypeReference obj) ExtendedTypeReference extendedTypeReference) => schemaTypeReference.Type.GetType() == extendedTypeReference.Type.Source; - public static readonly IEqualityComparer Default = + public static readonly IEqualityComparer Default = new TypeReferenceComparer(); } diff --git a/src/HotChocolate/Data/src/Data/Sorting/Extensions/SortObjectFieldDescriptorExtensions.cs b/src/HotChocolate/Data/src/Data/Sorting/Extensions/SortObjectFieldDescriptorExtensions.cs index e190f908e8d..246e204d9cd 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/Extensions/SortObjectFieldDescriptorExtensions.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/Extensions/SortObjectFieldDescriptorExtensions.cs @@ -142,7 +142,7 @@ public static class SortObjectFieldDescriptorExtensions (c, definition) => { var convention = c.GetSortConvention(scope); - ITypeReference argumentTypeReference; + TypeReference argumentTypeReference; if (sortTypeInstance is not null) { argumentTypeReference = diff --git a/src/HotChocolate/Filters/src/Types.Filters/Array/ArrayBooleanFilterOperationDescriptor.cs b/src/HotChocolate/Filters/src/Types.Filters/Array/ArrayBooleanFilterOperationDescriptor.cs index 26b0cce0161..cb7c76cad19 100644 --- a/src/HotChocolate/Filters/src/Types.Filters/Array/ArrayBooleanFilterOperationDescriptor.cs +++ b/src/HotChocolate/Filters/src/Types.Filters/Array/ArrayBooleanFilterOperationDescriptor.cs @@ -15,7 +15,7 @@ public class ArrayBooleanFilterOperationDescriptor IDescriptorContext context, ArrayFilterFieldDescriptor descriptor, string name, - ITypeReference type, + TypeReference type, FilterOperation operation) : base(context, name, type, operation) { @@ -92,7 +92,7 @@ public new IArrayBooleanFilterOperationDescriptor Directive() IDescriptorContext context, ArrayFilterFieldDescriptor descriptor, string name, - ITypeReference type, + TypeReference type, FilterOperation operation) => new(context, descriptor, name, type, operation); } diff --git a/src/HotChocolate/Filters/src/Types.Filters/Array/ArrayFilterOperationDescriptor.cs b/src/HotChocolate/Filters/src/Types.Filters/Array/ArrayFilterOperationDescriptor.cs index 2d5007dd70f..c6243d0c767 100644 --- a/src/HotChocolate/Filters/src/Types.Filters/Array/ArrayFilterOperationDescriptor.cs +++ b/src/HotChocolate/Filters/src/Types.Filters/Array/ArrayFilterOperationDescriptor.cs @@ -15,7 +15,7 @@ public class ArrayFilterOperationDescriptor IDescriptorContext context, ArrayFilterFieldDescriptor descriptor, string name, - ITypeReference type, + TypeReference type, FilterOperation operation) : base(context) { @@ -92,7 +92,7 @@ public new IArrayFilterOperationDescriptor Directive() IDescriptorContext context, ArrayFilterFieldDescriptor descriptor, string name, - ITypeReference type, + TypeReference type, FilterOperation operation) => new(context, descriptor, name, type, operation); } diff --git a/src/HotChocolate/Filters/src/Types.Filters/Array/ArrayFilterOperationDescriptor~1.cs b/src/HotChocolate/Filters/src/Types.Filters/Array/ArrayFilterOperationDescriptor~1.cs index ebb9428a9f9..94b0e3759c9 100644 --- a/src/HotChocolate/Filters/src/Types.Filters/Array/ArrayFilterOperationDescriptor~1.cs +++ b/src/HotChocolate/Filters/src/Types.Filters/Array/ArrayFilterOperationDescriptor~1.cs @@ -15,7 +15,7 @@ public class ArrayFilterOperationDescriptor IDescriptorContext context, ArrayFilterFieldDescriptor descriptor, string name, - ITypeReference type, + TypeReference type, FilterOperation operation) : base(context, descriptor, name, type, operation) { @@ -90,7 +90,7 @@ public new IArrayFilterOperationDescriptor Directive() IDescriptorContext context, ArrayFilterFieldDescriptor descriptor, string name, - ITypeReference type, + TypeReference type, FilterOperation operation) => new(context, descriptor, name, type, operation); } diff --git a/src/HotChocolate/Filters/src/Types.Filters/Boolean/BooleanFilterOperationDescriptor.cs b/src/HotChocolate/Filters/src/Types.Filters/Boolean/BooleanFilterOperationDescriptor.cs index f2ca20c6921..0c92ca9062e 100644 --- a/src/HotChocolate/Filters/src/Types.Filters/Boolean/BooleanFilterOperationDescriptor.cs +++ b/src/HotChocolate/Filters/src/Types.Filters/Boolean/BooleanFilterOperationDescriptor.cs @@ -15,7 +15,7 @@ public class BooleanFilterOperationDescriptor IDescriptorContext context, BooleanFilterFieldDescriptor descriptor, string name, - ITypeReference type, + TypeReference type, FilterOperation operation) : base(context, name, type, operation) { @@ -90,7 +90,7 @@ public new IBooleanFilterOperationDescriptor Directive() IDescriptorContext context, BooleanFilterFieldDescriptor descriptor, string name, - ITypeReference type, + TypeReference type, FilterOperation operation) => new(context, descriptor, name, type, operation); } diff --git a/src/HotChocolate/Filters/src/Types.Filters/Boolean/BooleanFilterOperationDescriptorBase.cs b/src/HotChocolate/Filters/src/Types.Filters/Boolean/BooleanFilterOperationDescriptorBase.cs index 8dbef83f1b2..3e478095996 100644 --- a/src/HotChocolate/Filters/src/Types.Filters/Boolean/BooleanFilterOperationDescriptorBase.cs +++ b/src/HotChocolate/Filters/src/Types.Filters/Boolean/BooleanFilterOperationDescriptorBase.cs @@ -12,7 +12,7 @@ public class BooleanFilterOperationDescriptorBase protected BooleanFilterOperationDescriptorBase( IDescriptorContext context, string name, - ITypeReference type, + TypeReference type, FilterOperation operation) : base(context) { diff --git a/src/HotChocolate/Filters/src/Types.Filters/Comparable/ComparableFilterOperationDescriptor.cs b/src/HotChocolate/Filters/src/Types.Filters/Comparable/ComparableFilterOperationDescriptor.cs index ab65d832ebd..397017fd95a 100644 --- a/src/HotChocolate/Filters/src/Types.Filters/Comparable/ComparableFilterOperationDescriptor.cs +++ b/src/HotChocolate/Filters/src/Types.Filters/Comparable/ComparableFilterOperationDescriptor.cs @@ -15,7 +15,7 @@ public class ComparableFilterOperationDescriptor IDescriptorContext context, ComparableFilterFieldDescriptor descriptor, string name, - ITypeReference type, + TypeReference type, FilterOperation operation) : base(context) { @@ -92,7 +92,7 @@ public new IComparableFilterOperationDescriptor Directive() IDescriptorContext context, ComparableFilterFieldDescriptor descriptor, string name, - ITypeReference type, + TypeReference type, FilterOperation operation) => new ComparableFilterOperationDescriptor(context, descriptor, name, type, operation); } diff --git a/src/HotChocolate/Filters/src/Types.Filters/Extensions/FilterObjectFieldDescriptorExtensions.cs b/src/HotChocolate/Filters/src/Types.Filters/Extensions/FilterObjectFieldDescriptorExtensions.cs index b151ef2ac96..67128511e3f 100644 --- a/src/HotChocolate/Filters/src/Types.Filters/Extensions/FilterObjectFieldDescriptorExtensions.cs +++ b/src/HotChocolate/Filters/src/Types.Filters/Extensions/FilterObjectFieldDescriptorExtensions.cs @@ -100,7 +100,7 @@ public static class FilterObjectFieldDescriptorExtensions .MakeGenericType(typeInfo.NamedType); } - ITypeReference argumentTypeReference = filterTypeInstance is null + TypeReference argumentTypeReference = filterTypeInstance is null ? c.TypeInspector.GetTypeRef( argumentType, TypeContext.Input) @@ -146,7 +146,7 @@ public static class FilterObjectFieldDescriptorExtensions private static void CompileMiddleware( ITypeCompletionContext context, ObjectFieldDefinition definition, - ITypeReference argumentTypeReference, + TypeReference argumentTypeReference, FieldMiddlewareDefinition placeholder) { var convention = diff --git a/src/HotChocolate/Filters/src/Types.Filters/FilterFieldDescriptorBase.cs b/src/HotChocolate/Filters/src/Types.Filters/FilterFieldDescriptorBase.cs index 866f127834b..ebcc0668ab2 100644 --- a/src/HotChocolate/Filters/src/Types.Filters/FilterFieldDescriptorBase.cs +++ b/src/HotChocolate/Filters/src/Types.Filters/FilterFieldDescriptorBase.cs @@ -172,7 +172,7 @@ protected void Type(ITypeNode typeNode) Definition.SetMoreSpecificType(typeNode, TypeContext.Input); } - protected ITypeReference RewriteTypeListType() + protected TypeReference RewriteTypeListType() { var reference = Definition.Type; @@ -209,14 +209,14 @@ protected ITypeReference RewriteTypeListType() throw new NotSupportedException(); } - protected ITypeReference RewriteTypeToNullableType() + protected TypeReference RewriteTypeToNullableType() { var reference = Definition.Type; return RewriteTypeToNullableType(reference!, Context.TypeInspector); } - protected static ITypeReference RewriteTypeToNullableType( - ITypeReference reference, + protected static TypeReference RewriteTypeToNullableType( + TypeReference reference, ITypeInspector typeInspector) { if (reference is ExtendedTypeReference extendedTypeRef) @@ -254,7 +254,7 @@ protected string CreateFieldName(FilterOperationKind kind) return _namingConvention.CreateFieldName(Definition, kind); } - protected virtual ITypeReference RewriteType( + protected virtual TypeReference RewriteType( FilterOperationKind operationKind) { if (ListOperations.Contains(operationKind)) diff --git a/src/HotChocolate/Filters/src/Types.Filters/Object/ObjectFilterOperationDescriptor.cs b/src/HotChocolate/Filters/src/Types.Filters/Object/ObjectFilterOperationDescriptor.cs index 8cf03e22d4b..cec33feb2d8 100644 --- a/src/HotChocolate/Filters/src/Types.Filters/Object/ObjectFilterOperationDescriptor.cs +++ b/src/HotChocolate/Filters/src/Types.Filters/Object/ObjectFilterOperationDescriptor.cs @@ -15,7 +15,7 @@ public class ObjectFilterOperationDescriptor IDescriptorContext context, ObjectFilterFieldDescriptor descriptor, string name, - ITypeReference type, + TypeReference type, FilterOperation operation) : base(context) { @@ -92,7 +92,7 @@ public new IObjectFilterOperationDescriptor Directive() IDescriptorContext context, ObjectFilterFieldDescriptor descriptor, string name, - ITypeReference type, + TypeReference type, FilterOperation operation) => new(context, descriptor, name, type, operation); } diff --git a/src/HotChocolate/Filters/src/Types.Filters/Object/ObjectFilterOperationDescriptor~1.cs b/src/HotChocolate/Filters/src/Types.Filters/Object/ObjectFilterOperationDescriptor~1.cs index 6a3cd4b92ec..f986e220914 100644 --- a/src/HotChocolate/Filters/src/Types.Filters/Object/ObjectFilterOperationDescriptor~1.cs +++ b/src/HotChocolate/Filters/src/Types.Filters/Object/ObjectFilterOperationDescriptor~1.cs @@ -15,7 +15,7 @@ public class ObjectFilterOperationDescriptor IDescriptorContext context, ObjectFilterFieldDescriptor descriptor, string name, - ITypeReference type, + TypeReference type, FilterOperation operation) : base(context, descriptor, name, type, operation) { @@ -92,7 +92,7 @@ public new IObjectFilterOperationDescriptor Directive() IDescriptorContext context, ObjectFilterFieldDescriptor descriptor, string name, - ITypeReference type, + TypeReference type, FilterOperation operation) => new(context, descriptor, name, type, operation); } diff --git a/src/HotChocolate/Filters/src/Types.Filters/String/StringFilterOperationDescriptor.cs b/src/HotChocolate/Filters/src/Types.Filters/String/StringFilterOperationDescriptor.cs index 3fb7e99e983..ece56ccca9c 100644 --- a/src/HotChocolate/Filters/src/Types.Filters/String/StringFilterOperationDescriptor.cs +++ b/src/HotChocolate/Filters/src/Types.Filters/String/StringFilterOperationDescriptor.cs @@ -15,7 +15,7 @@ public class StringFilterOperationDescriptor IDescriptorContext context, StringFilterFieldDescriptor descriptor, string name, - ITypeReference type, + TypeReference type, FilterOperation operation) : base(context) { @@ -92,7 +92,7 @@ public new IStringFilterOperationDescriptor Directive() IDescriptorContext context, StringFilterFieldDescriptor descriptor, string name, - ITypeReference type, + TypeReference type, FilterOperation operation) => new(context, descriptor, name, type, operation); } diff --git a/src/HotChocolate/Filters/src/Types.Sorting/Extensions/SortObjectFieldDescriptorExtensions.cs b/src/HotChocolate/Filters/src/Types.Sorting/Extensions/SortObjectFieldDescriptorExtensions.cs index 0f95e327b24..e986d649344 100644 --- a/src/HotChocolate/Filters/src/Types.Sorting/Extensions/SortObjectFieldDescriptorExtensions.cs +++ b/src/HotChocolate/Filters/src/Types.Sorting/Extensions/SortObjectFieldDescriptorExtensions.cs @@ -83,7 +83,7 @@ public static class SortObjectFieldDescriptorExtensions { var argumentType = GetArgumentType(definition, sortType, c.TypeInspector); - ITypeReference argumentTypeReference = sortTypeInstance is null + TypeReference argumentTypeReference = sortTypeInstance is null ? c.TypeInspector.GetTypeRef( argumentType, TypeContext.Input) @@ -167,7 +167,7 @@ public static class SortObjectFieldDescriptorExtensions private static void CompileMiddleware( ITypeCompletionContext context, ObjectFieldDefinition definition, - ITypeReference argumentTypeReference, + TypeReference argumentTypeReference, FieldMiddlewareDefinition placeholder) { var convention = diff --git a/src/HotChocolate/Filters/src/Types.Sorting/IgnoredSortingFieldDescriptor.cs b/src/HotChocolate/Filters/src/Types.Sorting/IgnoredSortingFieldDescriptor.cs index 40370009a42..0b30ffef720 100644 --- a/src/HotChocolate/Filters/src/Types.Sorting/IgnoredSortingFieldDescriptor.cs +++ b/src/HotChocolate/Filters/src/Types.Sorting/IgnoredSortingFieldDescriptor.cs @@ -12,7 +12,7 @@ internal class IgnoredSortingFieldDescriptor protected IgnoredSortingFieldDescriptor( IDescriptorContext context, string name, - ITypeReference type, + TypeReference type, SortOperation operation) : base(context, name, type, operation) { @@ -23,7 +23,7 @@ internal class IgnoredSortingFieldDescriptor public static IgnoredSortingFieldDescriptor New( IDescriptorContext context, string name, - ITypeReference type, + TypeReference type, SortOperation operation) => new(context, name, type, operation); diff --git a/src/HotChocolate/Filters/src/Types.Sorting/SortObjectOperationDescriptor.cs b/src/HotChocolate/Filters/src/Types.Sorting/SortObjectOperationDescriptor.cs index 18f4b43e6af..dc811dddda9 100644 --- a/src/HotChocolate/Filters/src/Types.Sorting/SortObjectOperationDescriptor.cs +++ b/src/HotChocolate/Filters/src/Types.Sorting/SortObjectOperationDescriptor.cs @@ -14,7 +14,7 @@ public class SortObjectOperationDescriptor protected SortObjectOperationDescriptor( IDescriptorContext context, string name, - ITypeReference type, + TypeReference type, SortOperation operation) : base(context, name, type, operation) { @@ -69,7 +69,7 @@ public new ISortObjectOperationDescriptor Directive() public static SortObjectOperationDescriptor New( IDescriptorContext context, string name, - ITypeReference type, + TypeReference type, SortOperation operation) => new(context, name, type, operation); diff --git a/src/HotChocolate/Filters/src/Types.Sorting/SortObjectOperationDescriptor~1.cs b/src/HotChocolate/Filters/src/Types.Sorting/SortObjectOperationDescriptor~1.cs index 6094251b5c1..6312bbe1f3d 100644 --- a/src/HotChocolate/Filters/src/Types.Sorting/SortObjectOperationDescriptor~1.cs +++ b/src/HotChocolate/Filters/src/Types.Sorting/SortObjectOperationDescriptor~1.cs @@ -13,7 +13,7 @@ public class SortObjectOperationDescriptor protected SortObjectOperationDescriptor( IDescriptorContext context, string name, - ITypeReference type, + TypeReference type, SortOperation operation) : base(context, name, type, operation) { @@ -77,7 +77,7 @@ public new ISortObjectOperationDescriptor Type() public new static SortObjectOperationDescriptor New( IDescriptorContext context, string name, - ITypeReference type, + TypeReference type, SortOperation operation) => new(context, name, type, operation); diff --git a/src/HotChocolate/Filters/src/Types.Sorting/SortOperationDescriptor.cs b/src/HotChocolate/Filters/src/Types.Sorting/SortOperationDescriptor.cs index 8190e59c5c7..f6b2c57f7fa 100644 --- a/src/HotChocolate/Filters/src/Types.Sorting/SortOperationDescriptor.cs +++ b/src/HotChocolate/Filters/src/Types.Sorting/SortOperationDescriptor.cs @@ -13,7 +13,7 @@ public class SortOperationDescriptor protected SortOperationDescriptor( IDescriptorContext context, string name, - ITypeReference type, + TypeReference type, SortOperation operation) : base(context, name, type, operation) { @@ -79,7 +79,7 @@ public new ISortOperationDescriptor Directive() public static SortOperationDescriptor New( IDescriptorContext context, string name, - ITypeReference type, + TypeReference type, SortOperation operation) => new(context, name, type, operation); diff --git a/src/HotChocolate/Filters/src/Types.Sorting/SortOperationDescriptorBase.cs b/src/HotChocolate/Filters/src/Types.Sorting/SortOperationDescriptorBase.cs index daf803a93ce..683ea5200e7 100644 --- a/src/HotChocolate/Filters/src/Types.Sorting/SortOperationDescriptorBase.cs +++ b/src/HotChocolate/Filters/src/Types.Sorting/SortOperationDescriptorBase.cs @@ -10,7 +10,7 @@ public abstract class SortOperationDescriptorBase protected SortOperationDescriptorBase( IDescriptorContext context, string name, - ITypeReference type, + TypeReference type, SortOperation operation) : base(context) { diff --git a/src/HotChocolate/PersistedQueries/test/PersistedQueries.Redis.Tests/RedisQueryStorageTests.cs b/src/HotChocolate/PersistedQueries/test/PersistedQueries.Redis.Tests/RedisQueryStorageTests.cs index 70040db0943..d1199a59f85 100644 --- a/src/HotChocolate/PersistedQueries/test/PersistedQueries.Redis.Tests/RedisQueryStorageTests.cs +++ b/src/HotChocolate/PersistedQueries/test/PersistedQueries.Redis.Tests/RedisQueryStorageTests.cs @@ -34,7 +34,7 @@ public Task Write_Query_To_Storage() await storage.WriteQueryAsync(queryId, query); // assert - var buffer = (byte[])await _database.StringGetAsync(queryId); + var buffer = ((byte[])await _database.StringGetAsync(queryId!))!; Utf8GraphQLParser.Parse(buffer).Print().MatchSnapshot(snapshotName); }, () => _database.KeyDeleteAsync(queryId)); diff --git a/src/HotChocolate/Spatial/src/Types/Extensions/SpatialCompletionContextExtensions.cs b/src/HotChocolate/Spatial/src/Types/Extensions/SpatialCompletionContextExtensions.cs index 3c5e2c80fce..91dba52ea90 100644 --- a/src/HotChocolate/Spatial/src/Types/Extensions/SpatialCompletionContextExtensions.cs +++ b/src/HotChocolate/Spatial/src/Types/Extensions/SpatialCompletionContextExtensions.cs @@ -17,7 +17,7 @@ internal static class SpatialCompletionContextExtensions /// true when the type reference is of public static bool IsNamedType( this ITypeCompletionContext context, - ITypeReference typeReference) + TypeReference typeReference) where T : IType { return context.TryGetType(typeReference, out var type) && type.NamedType() is T;