From a4b41f66ddba6b4b52db9477e0d7582fc86639ee Mon Sep 17 00:00:00 2001 From: tobias-tengler <45513122+tobias-tengler@users.noreply.github.com> Date: Thu, 4 Jun 2026 08:37:19 +0200 Subject: [PATCH] Revert "[Analyzer] Add analyzer for conflicting [ID] attribute usage (#9828)" This reverts commit f9e257af1c9de159e72e910272de8c3f8bca4505. --- .../ConflictingIdAttributeAnalyzer.cs | 224 ------ .../Core/src/Types.Analyzers/Errors.cs | 9 - .../Properties/SourceGenResources.Designer.cs | 9 - .../Properties/SourceGenResources.resx | 3 - .../Types.Analyzers/WellKnownAttributes.cs | 2 - .../ConflictingIdAttributeAnalyzerTests.cs | 663 ------------------ .../test/Types.Analyzers.Tests/TestHelper.cs | 3 +- ...lExceptIdMember_When_IdMemberIsNotFirst.md | 98 --- ...d_FlagSecondMember_When_NoMemberNamedId.md | 87 --- ...r_When_CollectionShapesShareElementType.md | 69 -- ...ror_When_EnumerableElementMatchesScalar.md | 69 -- ...iseError_When_EnumerableInnerTypesMatch.md | 69 -- ...eError_When_ExplicitTypeNameIsSpecified.md | 69 -- ...aiseError_When_GenericIdAttributeIsUsed.md | 69 -- ...seError_When_GenericTypeArgumentsDiffer.md | 69 -- ..._Should_NotRaiseError_When_IdTypesMatch.md | 69 -- ...seError_When_NullableMatchesNonNullable.md | 69 -- ...otRaiseError_When_TypeNameStringsDiffer.md | 69 -- ...Error_When_ValueTaskResultMatchesScalar.md | 69 -- ...orOnMismatchedMember_When_IdTypesDiffer.md | 87 --- ...smatchedMethod_When_IdMethodTypesDiffer.md | 87 --- ...RaiseError_When_ArrayElementTypesDiffer.md | 87 --- ...seError_When_EnumerableInnerTypesDiffer.md | 87 --- ...iseError_When_InterfaceHasMismatchedIds.md | 87 --- ..._RaiseError_When_ListElementTypesDiffer.md | 87 --- ...r_When_NestedTaskListElementTypesDiffer.md | 87 --- ...aiseError_When_NullableValueTypesDiffer.md | 87 --- ...SameGenericTypeNameHasMismatchedIdTypes.md | 87 --- ..._SameTypeNameStringHasMismatchedIdTypes.md | 87 --- ...d_RaiseError_When_TaskResultTypesDiffer.md | 87 --- 30 files changed, 1 insertion(+), 2744 deletions(-) delete mode 100644 src/HotChocolate/Core/src/Types.Analyzers/ConflictingIdAttributeAnalyzer.cs delete mode 100644 src/HotChocolate/Core/test/Types.Analyzers.Tests/ConflictingIdAttributeAnalyzerTests.cs delete mode 100644 src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_FlagAllExceptIdMember_When_IdMemberIsNotFirst.md delete mode 100644 src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_FlagSecondMember_When_NoMemberNamedId.md delete mode 100644 src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_NotRaiseError_When_CollectionShapesShareElementType.md delete mode 100644 src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_NotRaiseError_When_EnumerableElementMatchesScalar.md delete mode 100644 src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_NotRaiseError_When_EnumerableInnerTypesMatch.md delete mode 100644 src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_NotRaiseError_When_ExplicitTypeNameIsSpecified.md delete mode 100644 src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_NotRaiseError_When_GenericIdAttributeIsUsed.md delete mode 100644 src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_NotRaiseError_When_GenericTypeArgumentsDiffer.md delete mode 100644 src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_NotRaiseError_When_IdTypesMatch.md delete mode 100644 src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_NotRaiseError_When_NullableMatchesNonNullable.md delete mode 100644 src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_NotRaiseError_When_TypeNameStringsDiffer.md delete mode 100644 src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_NotRaiseError_When_ValueTaskResultMatchesScalar.md delete mode 100644 src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_RaiseErrorOnMismatchedMember_When_IdTypesDiffer.md delete mode 100644 src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_RaiseErrorOnMismatchedMethod_When_IdMethodTypesDiffer.md delete mode 100644 src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_RaiseError_When_ArrayElementTypesDiffer.md delete mode 100644 src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_RaiseError_When_EnumerableInnerTypesDiffer.md delete mode 100644 src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_RaiseError_When_InterfaceHasMismatchedIds.md delete mode 100644 src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_RaiseError_When_ListElementTypesDiffer.md delete mode 100644 src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_RaiseError_When_NestedTaskListElementTypesDiffer.md delete mode 100644 src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_RaiseError_When_NullableValueTypesDiffer.md delete mode 100644 src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_RaiseError_When_SameGenericTypeNameHasMismatchedIdTypes.md delete mode 100644 src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_RaiseError_When_SameTypeNameStringHasMismatchedIdTypes.md delete mode 100644 src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_RaiseError_When_TaskResultTypesDiffer.md diff --git a/src/HotChocolate/Core/src/Types.Analyzers/ConflictingIdAttributeAnalyzer.cs b/src/HotChocolate/Core/src/Types.Analyzers/ConflictingIdAttributeAnalyzer.cs deleted file mode 100644 index afc2263175b..00000000000 --- a/src/HotChocolate/Core/src/Types.Analyzers/ConflictingIdAttributeAnalyzer.cs +++ /dev/null @@ -1,224 +0,0 @@ -using System.Collections.Immutable; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Diagnostics; - -namespace HotChocolate.Types.Analyzers; - -[DiagnosticAnalyzer(LanguageNames.CSharp)] -public sealed class ConflictingIdAttributeAnalyzer : DiagnosticAnalyzer -{ - // Every [ID] member without a type name shares the declaring type's inferred GraphQL type name. - // Since each named type is analyzed in isolation, a single constant key is sufficient. - private const string InferredTypeNameKey = "inferred"; - - public override ImmutableArray SupportedDiagnostics { get; } = - [Errors.ConflictingIdAttribute]; - - public override void Initialize(AnalysisContext context) - { - context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None); - context.EnableConcurrentExecution(); - context.RegisterSymbolAction(AnalyzeNamedType, SymbolKind.NamedType); - } - - private static void AnalyzeNamedType(SymbolAnalysisContext context) - { - var namedType = (INamedTypeSymbol)context.Symbol; - - if (namedType.TypeKind is not (TypeKind.Class or TypeKind.Struct or TypeKind.Interface)) - { - return; - } - - // Group all [ID] members of the type by their effective GraphQL type-name key, - // preserving source order within each group. - Dictionary>? groups = null; - - foreach (var member in namedType.GetMembers()) - { - ITypeSymbol? memberType = member switch - { - IPropertySymbol property => property.Type, - IMethodSymbol { MethodKind: MethodKind.Ordinary } method => method.ReturnType, - _ => null - }; - - if (memberType is null) - { - continue; - } - - var idAttribute = GetIdAttribute(member); - if (idAttribute is null) - { - continue; - } - - var idMember = new IdMember(member, UnwrapRuntimeIdType(memberType), idAttribute.Value.Attribute); - - groups ??= []; - if (!groups.TryGetValue(idAttribute.Value.TypeNameKey, out var members)) - { - members = []; - groups[idAttribute.Value.TypeNameKey] = members; - } - - members.Add(idMember); - } - - if (groups is null) - { - return; - } - - foreach (var group in groups.Values) - { - AnalyzeGroup(context, group); - } - } - - private static void AnalyzeGroup(SymbolAnalysisContext context, List group) - { - if (group.Count < 2) - { - return; - } - - // The authoritative member is the [ID] member named "Id" (case-insensitive) - // if one exists, otherwise the first [ID] member in source order. - var authoritative = group[0]; - foreach (var candidate in group) - { - if (string.Equals(candidate.Member.Name, "Id", StringComparison.OrdinalIgnoreCase)) - { - authoritative = candidate; - break; - } - } - - foreach (var idMember in group) - { - if (ReferenceEquals(idMember, authoritative)) - { - continue; - } - - if (SymbolEqualityComparer.Default.Equals(idMember.RuntimeIdType, authoritative.RuntimeIdType)) - { - continue; - } - - var syntaxReference = idMember.Attribute.ApplicationSyntaxReference; - if (syntaxReference is null) - { - continue; - } - - var diagnostic = Diagnostic.Create( - Errors.ConflictingIdAttribute, - syntaxReference.GetSyntax(context.CancellationToken).GetLocation(), - idMember.Member.Name, - authoritative.Member.Name, - authoritative.RuntimeIdType.ToDisplayString()); - - context.ReportDiagnostic(diagnostic); - } - } - - private static (string TypeNameKey, AttributeData Attribute)? GetIdAttribute(ISymbol member) - { - foreach (var attribute in member.GetAttributes()) - { - var attributeClass = attribute.AttributeClass; - if (attributeClass is null) - { - continue; - } - - if (attributeClass.Name != "IDAttribute" - || attributeClass.ContainingNamespace?.ToDisplayString() != "HotChocolate.Types.Relay") - { - continue; - } - - // The generic IDAttribute derives its type name from the type argument. - if (attributeClass is { IsGenericType: true, TypeArguments.Length: 1 }) - { - return ("generic:" + attributeClass.TypeArguments[0].ToDisplayString(), attribute); - } - - // An explicit string type name forms its own group. - if (attribute.ConstructorArguments.Length > 0 - && attribute.ConstructorArguments[0].Value is string typeName) - { - return ("literal:" + typeName, attribute); - } - - // No type name was supplied, so the GraphQL type name is inferred from the - // declaring type and shared across all such [ID] members of that type. - return (InferredTypeNameKey, attribute); - } - - return null; - } - - private static ITypeSymbol UnwrapRuntimeIdType(ITypeSymbol type) - { - while (true) - { - if (type is IArrayTypeSymbol arrayType) - { - type = arrayType.ElementType; - continue; - } - - if (type is INamedTypeSymbol { IsGenericType: true } namedType) - { - var constructedFrom = namedType.ConstructedFrom.ToDisplayString(); - - if (constructedFrom is "System.Threading.Tasks.Task" - or "System.Threading.Tasks.ValueTask" - or "System.Nullable") - { - type = namedType.TypeArguments[0]; - continue; - } - - var elementType = GetEnumerableElementType(namedType); - if (elementType is not null) - { - type = elementType; - continue; - } - } - - return type; - } - } - - private static ITypeSymbol? GetEnumerableElementType(INamedTypeSymbol namedType) - { - // Strings implement IEnumerable but must be treated as scalar IDs. - if (namedType.SpecialType == SpecialType.System_String) - { - return null; - } - - if (namedType.ConstructedFrom.SpecialType == SpecialType.System_Collections_Generic_IEnumerable_T) - { - return namedType.TypeArguments[0]; - } - - foreach (var @interface in namedType.AllInterfaces) - { - if (@interface.ConstructedFrom.SpecialType == SpecialType.System_Collections_Generic_IEnumerable_T) - { - return @interface.TypeArguments[0]; - } - } - - return null; - } - - private sealed record IdMember(ISymbol Member, ITypeSymbol RuntimeIdType, AttributeData Attribute); -} diff --git a/src/HotChocolate/Core/src/Types.Analyzers/Errors.cs b/src/HotChocolate/Core/src/Types.Analyzers/Errors.cs index 4a408745e8a..fd7a87ae6c4 100644 --- a/src/HotChocolate/Core/src/Types.Analyzers/Errors.cs +++ b/src/HotChocolate/Core/src/Types.Analyzers/Errors.cs @@ -274,13 +274,4 @@ public static class Errors category: "TypeSystem", DiagnosticSeverity.Error, isEnabledByDefault: true); - - public static readonly DiagnosticDescriptor ConflictingIdAttribute = - new( - id: "HC0115", - title: "Conflicting [ID] attribute ID types", - messageFormat: SourceGenResources.ConflictingIdAttribute, - category: "TypeSystem", - DiagnosticSeverity.Error, - isEnabledByDefault: true); } diff --git a/src/HotChocolate/Core/src/Types.Analyzers/Properties/SourceGenResources.Designer.cs b/src/HotChocolate/Core/src/Types.Analyzers/Properties/SourceGenResources.Designer.cs index a57cd09aca3..4dcfcccd2bf 100644 --- a/src/HotChocolate/Core/src/Types.Analyzers/Properties/SourceGenResources.Designer.cs +++ b/src/HotChocolate/Core/src/Types.Analyzers/Properties/SourceGenResources.Designer.cs @@ -59,15 +59,6 @@ internal SourceGenResources() { } } - /// - /// Looks up a localized string similar to The [ID] attribute on '{0}' maps to the same ID type name as '{1}', but their ID value types differ. An ID type name can only bind to a single value type, so change '{0}' to use the same type as '{1}' ('{2}'), or give it a different type name with [ID<T>] or [ID("TypeName")]. - /// - internal static string ConflictingIdAttribute { - get { - return ResourceManager.GetString("ConflictingIdAttribute", resourceCulture); - } - } - /// /// Looks up a localized string similar to The DataLoader access modifier must be public or internal. /// diff --git a/src/HotChocolate/Core/src/Types.Analyzers/Properties/SourceGenResources.resx b/src/HotChocolate/Core/src/Types.Analyzers/Properties/SourceGenResources.resx index bd8ad051794..04ee5074021 100644 --- a/src/HotChocolate/Core/src/Types.Analyzers/Properties/SourceGenResources.resx +++ b/src/HotChocolate/Core/src/Types.Analyzers/Properties/SourceGenResources.resx @@ -21,9 +21,6 @@ A DataLoader must at least provides a key or keys parameter - - The [ID] attribute on '{0}' maps to the same ID type name as '{1}', but their ID value types differ. An ID type name can only bind to a single value type, so change '{0}' to use the same type as '{1}' ('{2}'), or give it a different type name with [ID<T>] or [ID("TypeName")]. - The DataLoader access modifier must be public or internal diff --git a/src/HotChocolate/Core/src/Types.Analyzers/WellKnownAttributes.cs b/src/HotChocolate/Core/src/Types.Analyzers/WellKnownAttributes.cs index 1acc5d20a78..28208bd4833 100644 --- a/src/HotChocolate/Core/src/Types.Analyzers/WellKnownAttributes.cs +++ b/src/HotChocolate/Core/src/Types.Analyzers/WellKnownAttributes.cs @@ -21,8 +21,6 @@ public static class WellKnownAttributes public const string SubscriptionAttribute = "HotChocolate.SubscriptionAttribute"; public const string SubscribeAttribute = "HotChocolate.Types.SubscribeAttribute"; public const string NodeResolverAttribute = "HotChocolate.Types.Relay.NodeResolverAttribute"; - public const string IdAttribute = "HotChocolate.Types.Relay.IDAttribute"; - public const string GenericIdAttribute = "HotChocolate.Types.Relay.IDAttribute`1"; public const string ParentAttribute = "HotChocolate.ParentAttribute"; public const string EventMessageAttribute = "HotChocolate.EventMessageAttribute"; public const string ServiceAttribute = "HotChocolate.ServiceAttribute"; diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/ConflictingIdAttributeAnalyzerTests.cs b/src/HotChocolate/Core/test/Types.Analyzers.Tests/ConflictingIdAttributeAnalyzerTests.cs deleted file mode 100644 index adfdd371df6..00000000000 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/ConflictingIdAttributeAnalyzerTests.cs +++ /dev/null @@ -1,663 +0,0 @@ -namespace HotChocolate.Types; - -public class ConflictingIdAttributeAnalyzerTests -{ - [Fact] - public async Task Analyze_Should_RaiseErrorOnMismatchedMember_When_IdTypesDiffer() - { - await TestHelper.GetGeneratedSourceSnapshot( - [""" - using System; - using HotChocolate.Types; - using HotChocolate.Types.Relay; - - namespace TestNamespace; - - [ObjectType] - public static partial class ThingType - { - } - - public class Thing - { - [ID] - public int Id { get; set; } - - [ID] - public Guid AnotherTypeId { get; set; } - } - """], - enableAnalyzers: true).MatchMarkdownAsync(); - } - - [Fact] - public async Task Analyze_Should_NotRaiseError_When_ExplicitTypeNameIsSpecified() - { - await TestHelper.GetGeneratedSourceSnapshot( - [""" - using System; - using HotChocolate.Types; - using HotChocolate.Types.Relay; - - namespace TestNamespace; - - [ObjectType] - public static partial class ThingType - { - } - - public class Thing - { - [ID] - public int Id { get; set; } - - [ID("Foo")] - public Guid AnotherTypeId { get; set; } - } - """], - enableAnalyzers: true).MatchMarkdownAsync(); - } - - [Fact] - public async Task Analyze_Should_NotRaiseError_When_GenericIdAttributeIsUsed() - { - await TestHelper.GetGeneratedSourceSnapshot( - [""" - using System; - using HotChocolate.Types; - using HotChocolate.Types.Relay; - - namespace TestNamespace; - - [ObjectType] - public static partial class ThingType - { - } - - public class Thing - { - [ID] - public int Id { get; set; } - - [ID] - public Guid AnotherTypeId { get; set; } - } - """], - enableAnalyzers: true).MatchMarkdownAsync(); - } - - [Fact] - public async Task Analyze_Should_NotRaiseError_When_IdTypesMatch() - { - await TestHelper.GetGeneratedSourceSnapshot( - [""" - using HotChocolate.Types; - using HotChocolate.Types.Relay; - - namespace TestNamespace; - - [ObjectType] - public static partial class ThingType - { - } - - public class Thing - { - [ID] - public int Id { get; set; } - - [ID] - public int AnotherTypeId { get; set; } - } - """], - enableAnalyzers: true).MatchMarkdownAsync(); - } - - [Fact] - public async Task Analyze_Should_NotRaiseError_When_NullableMatchesNonNullable() - { - await TestHelper.GetGeneratedSourceSnapshot( - [""" - using HotChocolate.Types; - using HotChocolate.Types.Relay; - - namespace TestNamespace; - - [ObjectType] - public static partial class ThingType - { - } - - public class Thing - { - [ID] - public int Id { get; set; } - - [ID] - public int? AnotherTypeId { get; set; } - } - """], - enableAnalyzers: true).MatchMarkdownAsync(); - } - - [Fact] - public async Task Analyze_Should_NotRaiseError_When_EnumerableElementMatchesScalar() - { - await TestHelper.GetGeneratedSourceSnapshot( - [""" - using System.Collections.Generic; - using HotChocolate.Types; - using HotChocolate.Types.Relay; - - namespace TestNamespace; - - [ObjectType] - public static partial class ThingType - { - } - - public class Thing - { - [ID] - public int Id { get; set; } - - [ID] - public IEnumerable AnotherTypeId { get; set; } - } - """], - enableAnalyzers: true).MatchMarkdownAsync(); - } - - [Fact] - public async Task Analyze_Should_RaiseError_When_InterfaceHasMismatchedIds() - { - await TestHelper.GetGeneratedSourceSnapshot( - [""" - using System; - using HotChocolate.Types; - using HotChocolate.Types.Relay; - - namespace TestNamespace; - - [InterfaceType] - public static partial class ThingType - { - } - - public interface IThing - { - [ID] - int Id { get; } - - [ID] - Guid AnotherTypeId { get; } - } - """], - enableAnalyzers: true).MatchMarkdownAsync(); - } - - [Fact] - public async Task Analyze_Should_RaiseErrorOnMismatchedMethod_When_IdMethodTypesDiffer() - { - await TestHelper.GetGeneratedSourceSnapshot( - [""" - using System; - using HotChocolate.Types; - using HotChocolate.Types.Relay; - - namespace TestNamespace; - - [ObjectType] - public static partial class ThingType - { - } - - public class Thing - { - [ID] - public int GetId() => 1; - - [ID] - public Guid GetOther() => Guid.NewGuid(); - } - """], - enableAnalyzers: true).MatchMarkdownAsync(); - } - - [Fact] - public async Task Analyze_Should_FlagSecondMember_When_NoMemberNamedId() - { - await TestHelper.GetGeneratedSourceSnapshot( - [""" - using System; - using HotChocolate.Types; - using HotChocolate.Types.Relay; - - namespace TestNamespace; - - [ObjectType] - public static partial class ThingType - { - } - - public class Thing - { - [ID] - public int FirstId { get; set; } - - [ID] - public Guid SecondId { get; set; } - } - """], - enableAnalyzers: true).MatchMarkdownAsync(); - } - - [Fact] - public async Task Analyze_Should_FlagAllExceptIdMember_When_IdMemberIsNotFirst() - { - await TestHelper.GetGeneratedSourceSnapshot( - [""" - using System; - using HotChocolate.Types; - using HotChocolate.Types.Relay; - - namespace TestNamespace; - - [ObjectType] - public static partial class ThingType - { - } - - public class Thing - { - [ID] - public Guid FooId { get; set; } - - [ID] - public int Id { get; set; } - - [ID] - public string BarId { get; set; } - } - """], - enableAnalyzers: true).MatchMarkdownAsync(); - } - - [Fact] - public async Task Analyze_Should_RaiseError_When_EnumerableInnerTypesDiffer() - { - await TestHelper.GetGeneratedSourceSnapshot( - [""" - using System; - using System.Collections.Generic; - using HotChocolate.Types; - using HotChocolate.Types.Relay; - - namespace TestNamespace; - - [ObjectType] - public static partial class ThingType - { - } - - public class Thing - { - [ID] - public IEnumerable Id { get; set; } - - [ID] - public IEnumerable OtherIds { get; set; } - } - """], - enableAnalyzers: true).MatchMarkdownAsync(); - } - - [Fact] - public async Task Analyze_Should_NotRaiseError_When_EnumerableInnerTypesMatch() - { - await TestHelper.GetGeneratedSourceSnapshot( - [""" - using System.Collections.Generic; - using HotChocolate.Types; - using HotChocolate.Types.Relay; - - namespace TestNamespace; - - [ObjectType] - public static partial class ThingType - { - } - - public class Thing - { - [ID] - public IEnumerable Id { get; set; } - - [ID] - public IEnumerable OtherIds { get; set; } - } - """], - enableAnalyzers: true).MatchMarkdownAsync(); - } - - [Fact] - public async Task Analyze_Should_RaiseError_When_SameGenericTypeNameHasMismatchedIdTypes() - { - await TestHelper.GetGeneratedSourceSnapshot( - [""" - using System; - using HotChocolate.Types; - using HotChocolate.Types.Relay; - - namespace TestNamespace; - - [ObjectType] - public static partial class ThingType - { - } - - public class Foo; - - public class Thing - { - [ID] - public int Id { get; set; } - - [ID] - public Guid Other { get; set; } - } - """], - enableAnalyzers: true).MatchMarkdownAsync(); - } - - [Fact] - public async Task Analyze_Should_RaiseError_When_SameTypeNameStringHasMismatchedIdTypes() - { - await TestHelper.GetGeneratedSourceSnapshot( - [""" - using System; - using HotChocolate.Types; - using HotChocolate.Types.Relay; - - namespace TestNamespace; - - [ObjectType] - public static partial class ThingType - { - } - - public class Thing - { - [ID("Shared")] - public int Id { get; set; } - - [ID("Shared")] - public Guid Other { get; set; } - } - """], - enableAnalyzers: true).MatchMarkdownAsync(); - } - - [Fact] - public async Task Analyze_Should_NotRaiseError_When_TypeNameStringsDiffer() - { - await TestHelper.GetGeneratedSourceSnapshot( - [""" - using System; - using HotChocolate.Types; - using HotChocolate.Types.Relay; - - namespace TestNamespace; - - [ObjectType] - public static partial class ThingType - { - } - - public class Thing - { - [ID("A")] - public int Id { get; set; } - - [ID("B")] - public Guid Other { get; set; } - } - """], - enableAnalyzers: true).MatchMarkdownAsync(); - } - - [Fact] - public async Task Analyze_Should_NotRaiseError_When_GenericTypeArgumentsDiffer() - { - await TestHelper.GetGeneratedSourceSnapshot( - [""" - using System; - using HotChocolate.Types; - using HotChocolate.Types.Relay; - - namespace TestNamespace; - - [ObjectType] - public static partial class ThingType - { - } - - public class Foo; - - public class Bar; - - public class Thing - { - [ID] - public int Id { get; set; } - - [ID] - public Guid Other { get; set; } - } - """], - enableAnalyzers: true).MatchMarkdownAsync(); - } - - [Fact] - public async Task Analyze_Should_RaiseError_When_ArrayElementTypesDiffer() - { - await TestHelper.GetGeneratedSourceSnapshot( - [""" - using System; - using HotChocolate.Types; - using HotChocolate.Types.Relay; - - namespace TestNamespace; - - [ObjectType] - public static partial class ThingType - { - } - - public class Thing - { - [ID] - public int[] Id { get; set; } - - [ID] - public Guid[] OtherIds { get; set; } - } - """], - enableAnalyzers: true).MatchMarkdownAsync(); - } - - [Fact] - public async Task Analyze_Should_RaiseError_When_ListElementTypesDiffer() - { - await TestHelper.GetGeneratedSourceSnapshot( - [""" - using System; - using System.Collections.Generic; - using HotChocolate.Types; - using HotChocolate.Types.Relay; - - namespace TestNamespace; - - [ObjectType] - public static partial class ThingType - { - } - - public class Thing - { - [ID] - public List Id { get; set; } - - [ID] - public List OtherIds { get; set; } - } - """], - enableAnalyzers: true).MatchMarkdownAsync(); - } - - [Fact] - public async Task Analyze_Should_NotRaiseError_When_CollectionShapesShareElementType() - { - await TestHelper.GetGeneratedSourceSnapshot( - [""" - using System.Collections.Generic; - using HotChocolate.Types; - using HotChocolate.Types.Relay; - - namespace TestNamespace; - - [ObjectType] - public static partial class ThingType - { - } - - public class Thing - { - [ID] - public int[] Id { get; set; } - - [ID] - public IEnumerable Two { get; set; } - - [ID] - public List Three { get; set; } - } - """], - enableAnalyzers: true).MatchMarkdownAsync(); - } - - [Fact] - public async Task Analyze_Should_RaiseError_When_TaskResultTypesDiffer() - { - await TestHelper.GetGeneratedSourceSnapshot( - [""" - using System; - using System.Threading.Tasks; - using HotChocolate.Types; - using HotChocolate.Types.Relay; - - namespace TestNamespace; - - [ObjectType] - public static partial class ThingType - { - } - - public class Thing - { - [ID] - public Task GetId() => Task.FromResult(1); - - [ID] - public Task GetOther() => Task.FromResult(Guid.NewGuid()); - } - """], - enableAnalyzers: true).MatchMarkdownAsync(); - } - - [Fact] - public async Task Analyze_Should_NotRaiseError_When_ValueTaskResultMatchesScalar() - { - await TestHelper.GetGeneratedSourceSnapshot( - [""" - using System.Threading.Tasks; - using HotChocolate.Types; - using HotChocolate.Types.Relay; - - namespace TestNamespace; - - [ObjectType] - public static partial class ThingType - { - } - - public class Thing - { - [ID] - public ValueTask GetId() => new ValueTask(1); - - [ID] - public int Other { get; set; } - } - """], - enableAnalyzers: true).MatchMarkdownAsync(); - } - - [Fact] - public async Task Analyze_Should_RaiseError_When_NullableValueTypesDiffer() - { - await TestHelper.GetGeneratedSourceSnapshot( - [""" - using System; - using HotChocolate.Types; - using HotChocolate.Types.Relay; - - namespace TestNamespace; - - [ObjectType] - public static partial class ThingType - { - } - - public class Thing - { - [ID] - public int? Id { get; set; } - - [ID] - public Guid? OtherId { get; set; } - } - """], - enableAnalyzers: true).MatchMarkdownAsync(); - } - - [Fact] - public async Task Analyze_Should_RaiseError_When_NestedTaskListElementTypesDiffer() - { - await TestHelper.GetGeneratedSourceSnapshot( - [""" - using System; - using System.Collections.Generic; - using System.Threading.Tasks; - using HotChocolate.Types; - using HotChocolate.Types.Relay; - - namespace TestNamespace; - - [ObjectType] - public static partial class ThingType - { - } - - public class Thing - { - [ID] - public Task> GetId() => Task.FromResult(new List()); - - [ID] - public Task> GetOther() => Task.FromResult(new List()); - } - """], - enableAnalyzers: true).MatchMarkdownAsync(); - } -} diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/TestHelper.cs b/src/HotChocolate/Core/test/Types.Analyzers.Tests/TestHelper.cs index e43543b378d..6737b92db28 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/TestHelper.cs +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/TestHelper.cs @@ -222,8 +222,7 @@ private static Snapshot CreateSnapshot(CSharpCompilation compilation, GeneratorD new IdAttributeOnRecordParameterAnalyzer(), new WrongAuthorizationAttributeAnalyzer(), new LookupReturnsNonNullableTypeAnalyzer(), - new LookupReturnsListTypeAnalyzer(), - new ConflictingIdAttributeAnalyzer()); + new LookupReturnsListTypeAnalyzer()); var compilationWithAnalyzers = compilation.WithAnalyzers(analyzers); var analyzerDiagnostics = compilationWithAnalyzers.GetAllDiagnosticsAsync().Result; diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_FlagAllExceptIdMember_When_IdMemberIsNotFirst.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_FlagAllExceptIdMember_When_IdMemberIsNotFirst.md deleted file mode 100644 index 93a073d8f74..00000000000 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_FlagAllExceptIdMember_When_IdMemberIsNotFirst.md +++ /dev/null @@ -1,98 +0,0 @@ -# Analyze_Should_FlagAllExceptIdMember_When_IdMemberIsNotFirst - -## HotChocolateTypeModule.735550c.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; - -namespace Microsoft.Extensions.DependencyInjection -{ - public static partial class TestsTypesRequestExecutorBuilderExtensions - { - public static IRequestExecutorBuilder AddTestsTypes(this IRequestExecutorBuilder builder) - { - builder.ConfigureDescriptorContext(ctx => ctx.TypeConfiguration.TryAdd( - "Tests::TestNamespace.ThingType", - () => global::TestNamespace.ThingType.Initialize)); - builder.AddType>(); - return builder; - } - } -} - -``` - -## ThingType.WaAdMHmlGJHjtEI4nqY7WA.hc.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; -using Microsoft.Extensions.DependencyInjection; -using HotChocolate.Internal; - -namespace TestNamespace -{ - public static partial class ThingType - { - internal static void Initialize(global::HotChocolate.Types.IObjectTypeDescriptor descriptor) - { - - Configure(descriptor); - } - - static partial void Configure(global::HotChocolate.Types.IObjectTypeDescriptor descriptor); - - private sealed class __Resolvers - { - } - } -} - - -``` - -## Analyzer Diagnostics - -```json -[ - { - "Id": "HC0115", - "Title": "Conflicting [ID] attribute ID types", - "Severity": "Error", - "WarningLevel": 0, - "Location": ": (13,5)-(13,7)", - "MessageFormat": "The [ID] attribute on '{0}' maps to the same ID type name as '{1}', but their ID value types differ. An ID type name can only bind to a single value type, so change '{0}' to use the same type as '{1}' ('{2}'), or give it a different type name with [ID] or [ID(\"TypeName\")].", - "Message": "The [ID] attribute on 'FooId' maps to the same ID type name as 'Id', but their ID value types differ. An ID type name can only bind to a single value type, so change 'FooId' to use the same type as 'Id' ('int'), or give it a different type name with [ID] or [ID(\"TypeName\")].", - "Category": "TypeSystem", - "CustomTags": [] - }, - { - "Id": "HC0115", - "Title": "Conflicting [ID] attribute ID types", - "Severity": "Error", - "WarningLevel": 0, - "Location": ": (19,5)-(19,7)", - "MessageFormat": "The [ID] attribute on '{0}' maps to the same ID type name as '{1}', but their ID value types differ. An ID type name can only bind to a single value type, so change '{0}' to use the same type as '{1}' ('{2}'), or give it a different type name with [ID] or [ID(\"TypeName\")].", - "Message": "The [ID] attribute on 'BarId' maps to the same ID type name as 'Id', but their ID value types differ. An ID type name can only bind to a single value type, so change 'BarId' to use the same type as 'Id' ('int'), or give it a different type name with [ID] or [ID(\"TypeName\")].", - "Category": "TypeSystem", - "CustomTags": [] - } -] -``` diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_FlagSecondMember_When_NoMemberNamedId.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_FlagSecondMember_When_NoMemberNamedId.md deleted file mode 100644 index 431f25ce437..00000000000 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_FlagSecondMember_When_NoMemberNamedId.md +++ /dev/null @@ -1,87 +0,0 @@ -# Analyze_Should_FlagSecondMember_When_NoMemberNamedId - -## HotChocolateTypeModule.735550c.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; - -namespace Microsoft.Extensions.DependencyInjection -{ - public static partial class TestsTypesRequestExecutorBuilderExtensions - { - public static IRequestExecutorBuilder AddTestsTypes(this IRequestExecutorBuilder builder) - { - builder.ConfigureDescriptorContext(ctx => ctx.TypeConfiguration.TryAdd( - "Tests::TestNamespace.ThingType", - () => global::TestNamespace.ThingType.Initialize)); - builder.AddType>(); - return builder; - } - } -} - -``` - -## ThingType.WaAdMHmlGJHjtEI4nqY7WA.hc.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; -using Microsoft.Extensions.DependencyInjection; -using HotChocolate.Internal; - -namespace TestNamespace -{ - public static partial class ThingType - { - internal static void Initialize(global::HotChocolate.Types.IObjectTypeDescriptor descriptor) - { - - Configure(descriptor); - } - - static partial void Configure(global::HotChocolate.Types.IObjectTypeDescriptor descriptor); - - private sealed class __Resolvers - { - } - } -} - - -``` - -## Analyzer Diagnostics - -```json -[ - { - "Id": "HC0115", - "Title": "Conflicting [ID] attribute ID types", - "Severity": "Error", - "WarningLevel": 0, - "Location": ": (16,5)-(16,7)", - "MessageFormat": "The [ID] attribute on '{0}' maps to the same ID type name as '{1}', but their ID value types differ. An ID type name can only bind to a single value type, so change '{0}' to use the same type as '{1}' ('{2}'), or give it a different type name with [ID] or [ID(\"TypeName\")].", - "Message": "The [ID] attribute on 'SecondId' maps to the same ID type name as 'FirstId', but their ID value types differ. An ID type name can only bind to a single value type, so change 'SecondId' to use the same type as 'FirstId' ('int'), or give it a different type name with [ID] or [ID(\"TypeName\")].", - "Category": "TypeSystem", - "CustomTags": [] - } -] -``` diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_NotRaiseError_When_CollectionShapesShareElementType.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_NotRaiseError_When_CollectionShapesShareElementType.md deleted file mode 100644 index ce74d830752..00000000000 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_NotRaiseError_When_CollectionShapesShareElementType.md +++ /dev/null @@ -1,69 +0,0 @@ -# Analyze_Should_NotRaiseError_When_CollectionShapesShareElementType - -## HotChocolateTypeModule.735550c.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; - -namespace Microsoft.Extensions.DependencyInjection -{ - public static partial class TestsTypesRequestExecutorBuilderExtensions - { - public static IRequestExecutorBuilder AddTestsTypes(this IRequestExecutorBuilder builder) - { - builder.ConfigureDescriptorContext(ctx => ctx.TypeConfiguration.TryAdd( - "Tests::TestNamespace.ThingType", - () => global::TestNamespace.ThingType.Initialize)); - builder.AddType>(); - return builder; - } - } -} - -``` - -## ThingType.WaAdMHmlGJHjtEI4nqY7WA.hc.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; -using Microsoft.Extensions.DependencyInjection; -using HotChocolate.Internal; - -namespace TestNamespace -{ - public static partial class ThingType - { - internal static void Initialize(global::HotChocolate.Types.IObjectTypeDescriptor descriptor) - { - - Configure(descriptor); - } - - static partial void Configure(global::HotChocolate.Types.IObjectTypeDescriptor descriptor); - - private sealed class __Resolvers - { - } - } -} - - -``` diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_NotRaiseError_When_EnumerableElementMatchesScalar.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_NotRaiseError_When_EnumerableElementMatchesScalar.md deleted file mode 100644 index 304beb1546a..00000000000 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_NotRaiseError_When_EnumerableElementMatchesScalar.md +++ /dev/null @@ -1,69 +0,0 @@ -# Analyze_Should_NotRaiseError_When_EnumerableElementMatchesScalar - -## HotChocolateTypeModule.735550c.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; - -namespace Microsoft.Extensions.DependencyInjection -{ - public static partial class TestsTypesRequestExecutorBuilderExtensions - { - public static IRequestExecutorBuilder AddTestsTypes(this IRequestExecutorBuilder builder) - { - builder.ConfigureDescriptorContext(ctx => ctx.TypeConfiguration.TryAdd( - "Tests::TestNamespace.ThingType", - () => global::TestNamespace.ThingType.Initialize)); - builder.AddType>(); - return builder; - } - } -} - -``` - -## ThingType.WaAdMHmlGJHjtEI4nqY7WA.hc.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; -using Microsoft.Extensions.DependencyInjection; -using HotChocolate.Internal; - -namespace TestNamespace -{ - public static partial class ThingType - { - internal static void Initialize(global::HotChocolate.Types.IObjectTypeDescriptor descriptor) - { - - Configure(descriptor); - } - - static partial void Configure(global::HotChocolate.Types.IObjectTypeDescriptor descriptor); - - private sealed class __Resolvers - { - } - } -} - - -``` diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_NotRaiseError_When_EnumerableInnerTypesMatch.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_NotRaiseError_When_EnumerableInnerTypesMatch.md deleted file mode 100644 index de1fe35b4f5..00000000000 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_NotRaiseError_When_EnumerableInnerTypesMatch.md +++ /dev/null @@ -1,69 +0,0 @@ -# Analyze_Should_NotRaiseError_When_EnumerableInnerTypesMatch - -## HotChocolateTypeModule.735550c.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; - -namespace Microsoft.Extensions.DependencyInjection -{ - public static partial class TestsTypesRequestExecutorBuilderExtensions - { - public static IRequestExecutorBuilder AddTestsTypes(this IRequestExecutorBuilder builder) - { - builder.ConfigureDescriptorContext(ctx => ctx.TypeConfiguration.TryAdd( - "Tests::TestNamespace.ThingType", - () => global::TestNamespace.ThingType.Initialize)); - builder.AddType>(); - return builder; - } - } -} - -``` - -## ThingType.WaAdMHmlGJHjtEI4nqY7WA.hc.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; -using Microsoft.Extensions.DependencyInjection; -using HotChocolate.Internal; - -namespace TestNamespace -{ - public static partial class ThingType - { - internal static void Initialize(global::HotChocolate.Types.IObjectTypeDescriptor descriptor) - { - - Configure(descriptor); - } - - static partial void Configure(global::HotChocolate.Types.IObjectTypeDescriptor descriptor); - - private sealed class __Resolvers - { - } - } -} - - -``` diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_NotRaiseError_When_ExplicitTypeNameIsSpecified.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_NotRaiseError_When_ExplicitTypeNameIsSpecified.md deleted file mode 100644 index af5513a5309..00000000000 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_NotRaiseError_When_ExplicitTypeNameIsSpecified.md +++ /dev/null @@ -1,69 +0,0 @@ -# Analyze_Should_NotRaiseError_When_ExplicitTypeNameIsSpecified - -## HotChocolateTypeModule.735550c.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; - -namespace Microsoft.Extensions.DependencyInjection -{ - public static partial class TestsTypesRequestExecutorBuilderExtensions - { - public static IRequestExecutorBuilder AddTestsTypes(this IRequestExecutorBuilder builder) - { - builder.ConfigureDescriptorContext(ctx => ctx.TypeConfiguration.TryAdd( - "Tests::TestNamespace.ThingType", - () => global::TestNamespace.ThingType.Initialize)); - builder.AddType>(); - return builder; - } - } -} - -``` - -## ThingType.WaAdMHmlGJHjtEI4nqY7WA.hc.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; -using Microsoft.Extensions.DependencyInjection; -using HotChocolate.Internal; - -namespace TestNamespace -{ - public static partial class ThingType - { - internal static void Initialize(global::HotChocolate.Types.IObjectTypeDescriptor descriptor) - { - - Configure(descriptor); - } - - static partial void Configure(global::HotChocolate.Types.IObjectTypeDescriptor descriptor); - - private sealed class __Resolvers - { - } - } -} - - -``` diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_NotRaiseError_When_GenericIdAttributeIsUsed.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_NotRaiseError_When_GenericIdAttributeIsUsed.md deleted file mode 100644 index 61255d67108..00000000000 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_NotRaiseError_When_GenericIdAttributeIsUsed.md +++ /dev/null @@ -1,69 +0,0 @@ -# Analyze_Should_NotRaiseError_When_GenericIdAttributeIsUsed - -## HotChocolateTypeModule.735550c.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; - -namespace Microsoft.Extensions.DependencyInjection -{ - public static partial class TestsTypesRequestExecutorBuilderExtensions - { - public static IRequestExecutorBuilder AddTestsTypes(this IRequestExecutorBuilder builder) - { - builder.ConfigureDescriptorContext(ctx => ctx.TypeConfiguration.TryAdd( - "Tests::TestNamespace.ThingType", - () => global::TestNamespace.ThingType.Initialize)); - builder.AddType>(); - return builder; - } - } -} - -``` - -## ThingType.WaAdMHmlGJHjtEI4nqY7WA.hc.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; -using Microsoft.Extensions.DependencyInjection; -using HotChocolate.Internal; - -namespace TestNamespace -{ - public static partial class ThingType - { - internal static void Initialize(global::HotChocolate.Types.IObjectTypeDescriptor descriptor) - { - - Configure(descriptor); - } - - static partial void Configure(global::HotChocolate.Types.IObjectTypeDescriptor descriptor); - - private sealed class __Resolvers - { - } - } -} - - -``` diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_NotRaiseError_When_GenericTypeArgumentsDiffer.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_NotRaiseError_When_GenericTypeArgumentsDiffer.md deleted file mode 100644 index eab38942770..00000000000 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_NotRaiseError_When_GenericTypeArgumentsDiffer.md +++ /dev/null @@ -1,69 +0,0 @@ -# Analyze_Should_NotRaiseError_When_GenericTypeArgumentsDiffer - -## HotChocolateTypeModule.735550c.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; - -namespace Microsoft.Extensions.DependencyInjection -{ - public static partial class TestsTypesRequestExecutorBuilderExtensions - { - public static IRequestExecutorBuilder AddTestsTypes(this IRequestExecutorBuilder builder) - { - builder.ConfigureDescriptorContext(ctx => ctx.TypeConfiguration.TryAdd( - "Tests::TestNamespace.ThingType", - () => global::TestNamespace.ThingType.Initialize)); - builder.AddType>(); - return builder; - } - } -} - -``` - -## ThingType.WaAdMHmlGJHjtEI4nqY7WA.hc.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; -using Microsoft.Extensions.DependencyInjection; -using HotChocolate.Internal; - -namespace TestNamespace -{ - public static partial class ThingType - { - internal static void Initialize(global::HotChocolate.Types.IObjectTypeDescriptor descriptor) - { - - Configure(descriptor); - } - - static partial void Configure(global::HotChocolate.Types.IObjectTypeDescriptor descriptor); - - private sealed class __Resolvers - { - } - } -} - - -``` diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_NotRaiseError_When_IdTypesMatch.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_NotRaiseError_When_IdTypesMatch.md deleted file mode 100644 index 8719cd7a2c5..00000000000 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_NotRaiseError_When_IdTypesMatch.md +++ /dev/null @@ -1,69 +0,0 @@ -# Analyze_Should_NotRaiseError_When_IdTypesMatch - -## HotChocolateTypeModule.735550c.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; - -namespace Microsoft.Extensions.DependencyInjection -{ - public static partial class TestsTypesRequestExecutorBuilderExtensions - { - public static IRequestExecutorBuilder AddTestsTypes(this IRequestExecutorBuilder builder) - { - builder.ConfigureDescriptorContext(ctx => ctx.TypeConfiguration.TryAdd( - "Tests::TestNamespace.ThingType", - () => global::TestNamespace.ThingType.Initialize)); - builder.AddType>(); - return builder; - } - } -} - -``` - -## ThingType.WaAdMHmlGJHjtEI4nqY7WA.hc.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; -using Microsoft.Extensions.DependencyInjection; -using HotChocolate.Internal; - -namespace TestNamespace -{ - public static partial class ThingType - { - internal static void Initialize(global::HotChocolate.Types.IObjectTypeDescriptor descriptor) - { - - Configure(descriptor); - } - - static partial void Configure(global::HotChocolate.Types.IObjectTypeDescriptor descriptor); - - private sealed class __Resolvers - { - } - } -} - - -``` diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_NotRaiseError_When_NullableMatchesNonNullable.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_NotRaiseError_When_NullableMatchesNonNullable.md deleted file mode 100644 index b5ab2d36993..00000000000 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_NotRaiseError_When_NullableMatchesNonNullable.md +++ /dev/null @@ -1,69 +0,0 @@ -# Analyze_Should_NotRaiseError_When_NullableMatchesNonNullable - -## HotChocolateTypeModule.735550c.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; - -namespace Microsoft.Extensions.DependencyInjection -{ - public static partial class TestsTypesRequestExecutorBuilderExtensions - { - public static IRequestExecutorBuilder AddTestsTypes(this IRequestExecutorBuilder builder) - { - builder.ConfigureDescriptorContext(ctx => ctx.TypeConfiguration.TryAdd( - "Tests::TestNamespace.ThingType", - () => global::TestNamespace.ThingType.Initialize)); - builder.AddType>(); - return builder; - } - } -} - -``` - -## ThingType.WaAdMHmlGJHjtEI4nqY7WA.hc.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; -using Microsoft.Extensions.DependencyInjection; -using HotChocolate.Internal; - -namespace TestNamespace -{ - public static partial class ThingType - { - internal static void Initialize(global::HotChocolate.Types.IObjectTypeDescriptor descriptor) - { - - Configure(descriptor); - } - - static partial void Configure(global::HotChocolate.Types.IObjectTypeDescriptor descriptor); - - private sealed class __Resolvers - { - } - } -} - - -``` diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_NotRaiseError_When_TypeNameStringsDiffer.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_NotRaiseError_When_TypeNameStringsDiffer.md deleted file mode 100644 index fd43b51845b..00000000000 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_NotRaiseError_When_TypeNameStringsDiffer.md +++ /dev/null @@ -1,69 +0,0 @@ -# Analyze_Should_NotRaiseError_When_TypeNameStringsDiffer - -## HotChocolateTypeModule.735550c.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; - -namespace Microsoft.Extensions.DependencyInjection -{ - public static partial class TestsTypesRequestExecutorBuilderExtensions - { - public static IRequestExecutorBuilder AddTestsTypes(this IRequestExecutorBuilder builder) - { - builder.ConfigureDescriptorContext(ctx => ctx.TypeConfiguration.TryAdd( - "Tests::TestNamespace.ThingType", - () => global::TestNamespace.ThingType.Initialize)); - builder.AddType>(); - return builder; - } - } -} - -``` - -## ThingType.WaAdMHmlGJHjtEI4nqY7WA.hc.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; -using Microsoft.Extensions.DependencyInjection; -using HotChocolate.Internal; - -namespace TestNamespace -{ - public static partial class ThingType - { - internal static void Initialize(global::HotChocolate.Types.IObjectTypeDescriptor descriptor) - { - - Configure(descriptor); - } - - static partial void Configure(global::HotChocolate.Types.IObjectTypeDescriptor descriptor); - - private sealed class __Resolvers - { - } - } -} - - -``` diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_NotRaiseError_When_ValueTaskResultMatchesScalar.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_NotRaiseError_When_ValueTaskResultMatchesScalar.md deleted file mode 100644 index a0ff942a416..00000000000 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_NotRaiseError_When_ValueTaskResultMatchesScalar.md +++ /dev/null @@ -1,69 +0,0 @@ -# Analyze_Should_NotRaiseError_When_ValueTaskResultMatchesScalar - -## HotChocolateTypeModule.735550c.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; - -namespace Microsoft.Extensions.DependencyInjection -{ - public static partial class TestsTypesRequestExecutorBuilderExtensions - { - public static IRequestExecutorBuilder AddTestsTypes(this IRequestExecutorBuilder builder) - { - builder.ConfigureDescriptorContext(ctx => ctx.TypeConfiguration.TryAdd( - "Tests::TestNamespace.ThingType", - () => global::TestNamespace.ThingType.Initialize)); - builder.AddType>(); - return builder; - } - } -} - -``` - -## ThingType.WaAdMHmlGJHjtEI4nqY7WA.hc.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; -using Microsoft.Extensions.DependencyInjection; -using HotChocolate.Internal; - -namespace TestNamespace -{ - public static partial class ThingType - { - internal static void Initialize(global::HotChocolate.Types.IObjectTypeDescriptor descriptor) - { - - Configure(descriptor); - } - - static partial void Configure(global::HotChocolate.Types.IObjectTypeDescriptor descriptor); - - private sealed class __Resolvers - { - } - } -} - - -``` diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_RaiseErrorOnMismatchedMember_When_IdTypesDiffer.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_RaiseErrorOnMismatchedMember_When_IdTypesDiffer.md deleted file mode 100644 index dee23d7618b..00000000000 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_RaiseErrorOnMismatchedMember_When_IdTypesDiffer.md +++ /dev/null @@ -1,87 +0,0 @@ -# Analyze_Should_RaiseErrorOnMismatchedMember_When_IdTypesDiffer - -## HotChocolateTypeModule.735550c.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; - -namespace Microsoft.Extensions.DependencyInjection -{ - public static partial class TestsTypesRequestExecutorBuilderExtensions - { - public static IRequestExecutorBuilder AddTestsTypes(this IRequestExecutorBuilder builder) - { - builder.ConfigureDescriptorContext(ctx => ctx.TypeConfiguration.TryAdd( - "Tests::TestNamespace.ThingType", - () => global::TestNamespace.ThingType.Initialize)); - builder.AddType>(); - return builder; - } - } -} - -``` - -## ThingType.WaAdMHmlGJHjtEI4nqY7WA.hc.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; -using Microsoft.Extensions.DependencyInjection; -using HotChocolate.Internal; - -namespace TestNamespace -{ - public static partial class ThingType - { - internal static void Initialize(global::HotChocolate.Types.IObjectTypeDescriptor descriptor) - { - - Configure(descriptor); - } - - static partial void Configure(global::HotChocolate.Types.IObjectTypeDescriptor descriptor); - - private sealed class __Resolvers - { - } - } -} - - -``` - -## Analyzer Diagnostics - -```json -[ - { - "Id": "HC0115", - "Title": "Conflicting [ID] attribute ID types", - "Severity": "Error", - "WarningLevel": 0, - "Location": ": (16,5)-(16,7)", - "MessageFormat": "The [ID] attribute on '{0}' maps to the same ID type name as '{1}', but their ID value types differ. An ID type name can only bind to a single value type, so change '{0}' to use the same type as '{1}' ('{2}'), or give it a different type name with [ID] or [ID(\"TypeName\")].", - "Message": "The [ID] attribute on 'AnotherTypeId' maps to the same ID type name as 'Id', but their ID value types differ. An ID type name can only bind to a single value type, so change 'AnotherTypeId' to use the same type as 'Id' ('int'), or give it a different type name with [ID] or [ID(\"TypeName\")].", - "Category": "TypeSystem", - "CustomTags": [] - } -] -``` diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_RaiseErrorOnMismatchedMethod_When_IdMethodTypesDiffer.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_RaiseErrorOnMismatchedMethod_When_IdMethodTypesDiffer.md deleted file mode 100644 index d0c38f2bfd7..00000000000 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_RaiseErrorOnMismatchedMethod_When_IdMethodTypesDiffer.md +++ /dev/null @@ -1,87 +0,0 @@ -# Analyze_Should_RaiseErrorOnMismatchedMethod_When_IdMethodTypesDiffer - -## HotChocolateTypeModule.735550c.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; - -namespace Microsoft.Extensions.DependencyInjection -{ - public static partial class TestsTypesRequestExecutorBuilderExtensions - { - public static IRequestExecutorBuilder AddTestsTypes(this IRequestExecutorBuilder builder) - { - builder.ConfigureDescriptorContext(ctx => ctx.TypeConfiguration.TryAdd( - "Tests::TestNamespace.ThingType", - () => global::TestNamespace.ThingType.Initialize)); - builder.AddType>(); - return builder; - } - } -} - -``` - -## ThingType.WaAdMHmlGJHjtEI4nqY7WA.hc.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; -using Microsoft.Extensions.DependencyInjection; -using HotChocolate.Internal; - -namespace TestNamespace -{ - public static partial class ThingType - { - internal static void Initialize(global::HotChocolate.Types.IObjectTypeDescriptor descriptor) - { - - Configure(descriptor); - } - - static partial void Configure(global::HotChocolate.Types.IObjectTypeDescriptor descriptor); - - private sealed class __Resolvers - { - } - } -} - - -``` - -## Analyzer Diagnostics - -```json -[ - { - "Id": "HC0115", - "Title": "Conflicting [ID] attribute ID types", - "Severity": "Error", - "WarningLevel": 0, - "Location": ": (16,5)-(16,7)", - "MessageFormat": "The [ID] attribute on '{0}' maps to the same ID type name as '{1}', but their ID value types differ. An ID type name can only bind to a single value type, so change '{0}' to use the same type as '{1}' ('{2}'), or give it a different type name with [ID] or [ID(\"TypeName\")].", - "Message": "The [ID] attribute on 'GetOther' maps to the same ID type name as 'GetId', but their ID value types differ. An ID type name can only bind to a single value type, so change 'GetOther' to use the same type as 'GetId' ('int'), or give it a different type name with [ID] or [ID(\"TypeName\")].", - "Category": "TypeSystem", - "CustomTags": [] - } -] -``` diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_RaiseError_When_ArrayElementTypesDiffer.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_RaiseError_When_ArrayElementTypesDiffer.md deleted file mode 100644 index c5826e43d9c..00000000000 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_RaiseError_When_ArrayElementTypesDiffer.md +++ /dev/null @@ -1,87 +0,0 @@ -# Analyze_Should_RaiseError_When_ArrayElementTypesDiffer - -## HotChocolateTypeModule.735550c.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; - -namespace Microsoft.Extensions.DependencyInjection -{ - public static partial class TestsTypesRequestExecutorBuilderExtensions - { - public static IRequestExecutorBuilder AddTestsTypes(this IRequestExecutorBuilder builder) - { - builder.ConfigureDescriptorContext(ctx => ctx.TypeConfiguration.TryAdd( - "Tests::TestNamespace.ThingType", - () => global::TestNamespace.ThingType.Initialize)); - builder.AddType>(); - return builder; - } - } -} - -``` - -## ThingType.WaAdMHmlGJHjtEI4nqY7WA.hc.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; -using Microsoft.Extensions.DependencyInjection; -using HotChocolate.Internal; - -namespace TestNamespace -{ - public static partial class ThingType - { - internal static void Initialize(global::HotChocolate.Types.IObjectTypeDescriptor descriptor) - { - - Configure(descriptor); - } - - static partial void Configure(global::HotChocolate.Types.IObjectTypeDescriptor descriptor); - - private sealed class __Resolvers - { - } - } -} - - -``` - -## Analyzer Diagnostics - -```json -[ - { - "Id": "HC0115", - "Title": "Conflicting [ID] attribute ID types", - "Severity": "Error", - "WarningLevel": 0, - "Location": ": (16,5)-(16,7)", - "MessageFormat": "The [ID] attribute on '{0}' maps to the same ID type name as '{1}', but their ID value types differ. An ID type name can only bind to a single value type, so change '{0}' to use the same type as '{1}' ('{2}'), or give it a different type name with [ID] or [ID(\"TypeName\")].", - "Message": "The [ID] attribute on 'OtherIds' maps to the same ID type name as 'Id', but their ID value types differ. An ID type name can only bind to a single value type, so change 'OtherIds' to use the same type as 'Id' ('int'), or give it a different type name with [ID] or [ID(\"TypeName\")].", - "Category": "TypeSystem", - "CustomTags": [] - } -] -``` diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_RaiseError_When_EnumerableInnerTypesDiffer.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_RaiseError_When_EnumerableInnerTypesDiffer.md deleted file mode 100644 index 66f2f476b5a..00000000000 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_RaiseError_When_EnumerableInnerTypesDiffer.md +++ /dev/null @@ -1,87 +0,0 @@ -# Analyze_Should_RaiseError_When_EnumerableInnerTypesDiffer - -## HotChocolateTypeModule.735550c.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; - -namespace Microsoft.Extensions.DependencyInjection -{ - public static partial class TestsTypesRequestExecutorBuilderExtensions - { - public static IRequestExecutorBuilder AddTestsTypes(this IRequestExecutorBuilder builder) - { - builder.ConfigureDescriptorContext(ctx => ctx.TypeConfiguration.TryAdd( - "Tests::TestNamespace.ThingType", - () => global::TestNamespace.ThingType.Initialize)); - builder.AddType>(); - return builder; - } - } -} - -``` - -## ThingType.WaAdMHmlGJHjtEI4nqY7WA.hc.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; -using Microsoft.Extensions.DependencyInjection; -using HotChocolate.Internal; - -namespace TestNamespace -{ - public static partial class ThingType - { - internal static void Initialize(global::HotChocolate.Types.IObjectTypeDescriptor descriptor) - { - - Configure(descriptor); - } - - static partial void Configure(global::HotChocolate.Types.IObjectTypeDescriptor descriptor); - - private sealed class __Resolvers - { - } - } -} - - -``` - -## Analyzer Diagnostics - -```json -[ - { - "Id": "HC0115", - "Title": "Conflicting [ID] attribute ID types", - "Severity": "Error", - "WarningLevel": 0, - "Location": ": (17,5)-(17,7)", - "MessageFormat": "The [ID] attribute on '{0}' maps to the same ID type name as '{1}', but their ID value types differ. An ID type name can only bind to a single value type, so change '{0}' to use the same type as '{1}' ('{2}'), or give it a different type name with [ID] or [ID(\"TypeName\")].", - "Message": "The [ID] attribute on 'OtherIds' maps to the same ID type name as 'Id', but their ID value types differ. An ID type name can only bind to a single value type, so change 'OtherIds' to use the same type as 'Id' ('int'), or give it a different type name with [ID] or [ID(\"TypeName\")].", - "Category": "TypeSystem", - "CustomTags": [] - } -] -``` diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_RaiseError_When_InterfaceHasMismatchedIds.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_RaiseError_When_InterfaceHasMismatchedIds.md deleted file mode 100644 index a624025e645..00000000000 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_RaiseError_When_InterfaceHasMismatchedIds.md +++ /dev/null @@ -1,87 +0,0 @@ -# Analyze_Should_RaiseError_When_InterfaceHasMismatchedIds - -## HotChocolateTypeModule.735550c.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; - -namespace Microsoft.Extensions.DependencyInjection -{ - public static partial class TestsTypesRequestExecutorBuilderExtensions - { - public static IRequestExecutorBuilder AddTestsTypes(this IRequestExecutorBuilder builder) - { - builder.ConfigureDescriptorContext(ctx => ctx.TypeConfiguration.TryAdd( - "Tests::TestNamespace.ThingType", - () => global::TestNamespace.ThingType.Initialize)); - builder.AddType>(); - return builder; - } - } -} - -``` - -## ThingType.WaAdMHmlGJHjtEI4nqY7WA.hc.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; -using Microsoft.Extensions.DependencyInjection; -using HotChocolate.Internal; - -namespace TestNamespace -{ - public static partial class ThingType - { - internal static void Initialize(global::HotChocolate.Types.IInterfaceTypeDescriptor descriptor) - { - - Configure(descriptor); - } - - static partial void Configure(global::HotChocolate.Types.IInterfaceTypeDescriptor descriptor); - - private sealed class __Resolvers - { - } - } -} - - -``` - -## Analyzer Diagnostics - -```json -[ - { - "Id": "HC0115", - "Title": "Conflicting [ID] attribute ID types", - "Severity": "Error", - "WarningLevel": 0, - "Location": ": (16,5)-(16,7)", - "MessageFormat": "The [ID] attribute on '{0}' maps to the same ID type name as '{1}', but their ID value types differ. An ID type name can only bind to a single value type, so change '{0}' to use the same type as '{1}' ('{2}'), or give it a different type name with [ID] or [ID(\"TypeName\")].", - "Message": "The [ID] attribute on 'AnotherTypeId' maps to the same ID type name as 'Id', but their ID value types differ. An ID type name can only bind to a single value type, so change 'AnotherTypeId' to use the same type as 'Id' ('int'), or give it a different type name with [ID] or [ID(\"TypeName\")].", - "Category": "TypeSystem", - "CustomTags": [] - } -] -``` diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_RaiseError_When_ListElementTypesDiffer.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_RaiseError_When_ListElementTypesDiffer.md deleted file mode 100644 index bbb7bf30e8f..00000000000 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_RaiseError_When_ListElementTypesDiffer.md +++ /dev/null @@ -1,87 +0,0 @@ -# Analyze_Should_RaiseError_When_ListElementTypesDiffer - -## HotChocolateTypeModule.735550c.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; - -namespace Microsoft.Extensions.DependencyInjection -{ - public static partial class TestsTypesRequestExecutorBuilderExtensions - { - public static IRequestExecutorBuilder AddTestsTypes(this IRequestExecutorBuilder builder) - { - builder.ConfigureDescriptorContext(ctx => ctx.TypeConfiguration.TryAdd( - "Tests::TestNamespace.ThingType", - () => global::TestNamespace.ThingType.Initialize)); - builder.AddType>(); - return builder; - } - } -} - -``` - -## ThingType.WaAdMHmlGJHjtEI4nqY7WA.hc.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; -using Microsoft.Extensions.DependencyInjection; -using HotChocolate.Internal; - -namespace TestNamespace -{ - public static partial class ThingType - { - internal static void Initialize(global::HotChocolate.Types.IObjectTypeDescriptor descriptor) - { - - Configure(descriptor); - } - - static partial void Configure(global::HotChocolate.Types.IObjectTypeDescriptor descriptor); - - private sealed class __Resolvers - { - } - } -} - - -``` - -## Analyzer Diagnostics - -```json -[ - { - "Id": "HC0115", - "Title": "Conflicting [ID] attribute ID types", - "Severity": "Error", - "WarningLevel": 0, - "Location": ": (17,5)-(17,7)", - "MessageFormat": "The [ID] attribute on '{0}' maps to the same ID type name as '{1}', but their ID value types differ. An ID type name can only bind to a single value type, so change '{0}' to use the same type as '{1}' ('{2}'), or give it a different type name with [ID] or [ID(\"TypeName\")].", - "Message": "The [ID] attribute on 'OtherIds' maps to the same ID type name as 'Id', but their ID value types differ. An ID type name can only bind to a single value type, so change 'OtherIds' to use the same type as 'Id' ('int'), or give it a different type name with [ID] or [ID(\"TypeName\")].", - "Category": "TypeSystem", - "CustomTags": [] - } -] -``` diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_RaiseError_When_NestedTaskListElementTypesDiffer.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_RaiseError_When_NestedTaskListElementTypesDiffer.md deleted file mode 100644 index ed3d1247b0b..00000000000 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_RaiseError_When_NestedTaskListElementTypesDiffer.md +++ /dev/null @@ -1,87 +0,0 @@ -# Analyze_Should_RaiseError_When_NestedTaskListElementTypesDiffer - -## HotChocolateTypeModule.735550c.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; - -namespace Microsoft.Extensions.DependencyInjection -{ - public static partial class TestsTypesRequestExecutorBuilderExtensions - { - public static IRequestExecutorBuilder AddTestsTypes(this IRequestExecutorBuilder builder) - { - builder.ConfigureDescriptorContext(ctx => ctx.TypeConfiguration.TryAdd( - "Tests::TestNamespace.ThingType", - () => global::TestNamespace.ThingType.Initialize)); - builder.AddType>(); - return builder; - } - } -} - -``` - -## ThingType.WaAdMHmlGJHjtEI4nqY7WA.hc.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; -using Microsoft.Extensions.DependencyInjection; -using HotChocolate.Internal; - -namespace TestNamespace -{ - public static partial class ThingType - { - internal static void Initialize(global::HotChocolate.Types.IObjectTypeDescriptor descriptor) - { - - Configure(descriptor); - } - - static partial void Configure(global::HotChocolate.Types.IObjectTypeDescriptor descriptor); - - private sealed class __Resolvers - { - } - } -} - - -``` - -## Analyzer Diagnostics - -```json -[ - { - "Id": "HC0115", - "Title": "Conflicting [ID] attribute ID types", - "Severity": "Error", - "WarningLevel": 0, - "Location": ": (18,5)-(18,7)", - "MessageFormat": "The [ID] attribute on '{0}' maps to the same ID type name as '{1}', but their ID value types differ. An ID type name can only bind to a single value type, so change '{0}' to use the same type as '{1}' ('{2}'), or give it a different type name with [ID] or [ID(\"TypeName\")].", - "Message": "The [ID] attribute on 'GetOther' maps to the same ID type name as 'GetId', but their ID value types differ. An ID type name can only bind to a single value type, so change 'GetOther' to use the same type as 'GetId' ('int'), or give it a different type name with [ID] or [ID(\"TypeName\")].", - "Category": "TypeSystem", - "CustomTags": [] - } -] -``` diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_RaiseError_When_NullableValueTypesDiffer.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_RaiseError_When_NullableValueTypesDiffer.md deleted file mode 100644 index d7c1ee80511..00000000000 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_RaiseError_When_NullableValueTypesDiffer.md +++ /dev/null @@ -1,87 +0,0 @@ -# Analyze_Should_RaiseError_When_NullableValueTypesDiffer - -## HotChocolateTypeModule.735550c.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; - -namespace Microsoft.Extensions.DependencyInjection -{ - public static partial class TestsTypesRequestExecutorBuilderExtensions - { - public static IRequestExecutorBuilder AddTestsTypes(this IRequestExecutorBuilder builder) - { - builder.ConfigureDescriptorContext(ctx => ctx.TypeConfiguration.TryAdd( - "Tests::TestNamespace.ThingType", - () => global::TestNamespace.ThingType.Initialize)); - builder.AddType>(); - return builder; - } - } -} - -``` - -## ThingType.WaAdMHmlGJHjtEI4nqY7WA.hc.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; -using Microsoft.Extensions.DependencyInjection; -using HotChocolate.Internal; - -namespace TestNamespace -{ - public static partial class ThingType - { - internal static void Initialize(global::HotChocolate.Types.IObjectTypeDescriptor descriptor) - { - - Configure(descriptor); - } - - static partial void Configure(global::HotChocolate.Types.IObjectTypeDescriptor descriptor); - - private sealed class __Resolvers - { - } - } -} - - -``` - -## Analyzer Diagnostics - -```json -[ - { - "Id": "HC0115", - "Title": "Conflicting [ID] attribute ID types", - "Severity": "Error", - "WarningLevel": 0, - "Location": ": (16,5)-(16,7)", - "MessageFormat": "The [ID] attribute on '{0}' maps to the same ID type name as '{1}', but their ID value types differ. An ID type name can only bind to a single value type, so change '{0}' to use the same type as '{1}' ('{2}'), or give it a different type name with [ID] or [ID(\"TypeName\")].", - "Message": "The [ID] attribute on 'OtherId' maps to the same ID type name as 'Id', but their ID value types differ. An ID type name can only bind to a single value type, so change 'OtherId' to use the same type as 'Id' ('int'), or give it a different type name with [ID] or [ID(\"TypeName\")].", - "Category": "TypeSystem", - "CustomTags": [] - } -] -``` diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_RaiseError_When_SameGenericTypeNameHasMismatchedIdTypes.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_RaiseError_When_SameGenericTypeNameHasMismatchedIdTypes.md deleted file mode 100644 index bf93880c685..00000000000 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_RaiseError_When_SameGenericTypeNameHasMismatchedIdTypes.md +++ /dev/null @@ -1,87 +0,0 @@ -# Analyze_Should_RaiseError_When_SameGenericTypeNameHasMismatchedIdTypes - -## HotChocolateTypeModule.735550c.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; - -namespace Microsoft.Extensions.DependencyInjection -{ - public static partial class TestsTypesRequestExecutorBuilderExtensions - { - public static IRequestExecutorBuilder AddTestsTypes(this IRequestExecutorBuilder builder) - { - builder.ConfigureDescriptorContext(ctx => ctx.TypeConfiguration.TryAdd( - "Tests::TestNamespace.ThingType", - () => global::TestNamespace.ThingType.Initialize)); - builder.AddType>(); - return builder; - } - } -} - -``` - -## ThingType.WaAdMHmlGJHjtEI4nqY7WA.hc.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; -using Microsoft.Extensions.DependencyInjection; -using HotChocolate.Internal; - -namespace TestNamespace -{ - public static partial class ThingType - { - internal static void Initialize(global::HotChocolate.Types.IObjectTypeDescriptor descriptor) - { - - Configure(descriptor); - } - - static partial void Configure(global::HotChocolate.Types.IObjectTypeDescriptor descriptor); - - private sealed class __Resolvers - { - } - } -} - - -``` - -## Analyzer Diagnostics - -```json -[ - { - "Id": "HC0115", - "Title": "Conflicting [ID] attribute ID types", - "Severity": "Error", - "WarningLevel": 0, - "Location": ": (18,5)-(18,12)", - "MessageFormat": "The [ID] attribute on '{0}' maps to the same ID type name as '{1}', but their ID value types differ. An ID type name can only bind to a single value type, so change '{0}' to use the same type as '{1}' ('{2}'), or give it a different type name with [ID] or [ID(\"TypeName\")].", - "Message": "The [ID] attribute on 'Other' maps to the same ID type name as 'Id', but their ID value types differ. An ID type name can only bind to a single value type, so change 'Other' to use the same type as 'Id' ('int'), or give it a different type name with [ID] or [ID(\"TypeName\")].", - "Category": "TypeSystem", - "CustomTags": [] - } -] -``` diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_RaiseError_When_SameTypeNameStringHasMismatchedIdTypes.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_RaiseError_When_SameTypeNameStringHasMismatchedIdTypes.md deleted file mode 100644 index c663a6f73cb..00000000000 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_RaiseError_When_SameTypeNameStringHasMismatchedIdTypes.md +++ /dev/null @@ -1,87 +0,0 @@ -# Analyze_Should_RaiseError_When_SameTypeNameStringHasMismatchedIdTypes - -## HotChocolateTypeModule.735550c.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; - -namespace Microsoft.Extensions.DependencyInjection -{ - public static partial class TestsTypesRequestExecutorBuilderExtensions - { - public static IRequestExecutorBuilder AddTestsTypes(this IRequestExecutorBuilder builder) - { - builder.ConfigureDescriptorContext(ctx => ctx.TypeConfiguration.TryAdd( - "Tests::TestNamespace.ThingType", - () => global::TestNamespace.ThingType.Initialize)); - builder.AddType>(); - return builder; - } - } -} - -``` - -## ThingType.WaAdMHmlGJHjtEI4nqY7WA.hc.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; -using Microsoft.Extensions.DependencyInjection; -using HotChocolate.Internal; - -namespace TestNamespace -{ - public static partial class ThingType - { - internal static void Initialize(global::HotChocolate.Types.IObjectTypeDescriptor descriptor) - { - - Configure(descriptor); - } - - static partial void Configure(global::HotChocolate.Types.IObjectTypeDescriptor descriptor); - - private sealed class __Resolvers - { - } - } -} - - -``` - -## Analyzer Diagnostics - -```json -[ - { - "Id": "HC0115", - "Title": "Conflicting [ID] attribute ID types", - "Severity": "Error", - "WarningLevel": 0, - "Location": ": (16,5)-(16,17)", - "MessageFormat": "The [ID] attribute on '{0}' maps to the same ID type name as '{1}', but their ID value types differ. An ID type name can only bind to a single value type, so change '{0}' to use the same type as '{1}' ('{2}'), or give it a different type name with [ID] or [ID(\"TypeName\")].", - "Message": "The [ID] attribute on 'Other' maps to the same ID type name as 'Id', but their ID value types differ. An ID type name can only bind to a single value type, so change 'Other' to use the same type as 'Id' ('int'), or give it a different type name with [ID] or [ID(\"TypeName\")].", - "Category": "TypeSystem", - "CustomTags": [] - } -] -``` diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_RaiseError_When_TaskResultTypesDiffer.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_RaiseError_When_TaskResultTypesDiffer.md deleted file mode 100644 index 42f3a810bce..00000000000 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ConflictingIdAttributeAnalyzerTests.Analyze_Should_RaiseError_When_TaskResultTypesDiffer.md +++ /dev/null @@ -1,87 +0,0 @@ -# Analyze_Should_RaiseError_When_TaskResultTypesDiffer - -## HotChocolateTypeModule.735550c.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; - -namespace Microsoft.Extensions.DependencyInjection -{ - public static partial class TestsTypesRequestExecutorBuilderExtensions - { - public static IRequestExecutorBuilder AddTestsTypes(this IRequestExecutorBuilder builder) - { - builder.ConfigureDescriptorContext(ctx => ctx.TypeConfiguration.TryAdd( - "Tests::TestNamespace.ThingType", - () => global::TestNamespace.ThingType.Initialize)); - builder.AddType>(); - return builder; - } - } -} - -``` - -## ThingType.WaAdMHmlGJHjtEI4nqY7WA.hc.g.cs - -```csharp -// - -#nullable enable -#pragma warning disable - -using System; -using System.Runtime.CompilerServices; -using HotChocolate; -using HotChocolate.Types; -using HotChocolate.Execution.Configuration; -using Microsoft.Extensions.DependencyInjection; -using HotChocolate.Internal; - -namespace TestNamespace -{ - public static partial class ThingType - { - internal static void Initialize(global::HotChocolate.Types.IObjectTypeDescriptor descriptor) - { - - Configure(descriptor); - } - - static partial void Configure(global::HotChocolate.Types.IObjectTypeDescriptor descriptor); - - private sealed class __Resolvers - { - } - } -} - - -``` - -## Analyzer Diagnostics - -```json -[ - { - "Id": "HC0115", - "Title": "Conflicting [ID] attribute ID types", - "Severity": "Error", - "WarningLevel": 0, - "Location": ": (17,5)-(17,7)", - "MessageFormat": "The [ID] attribute on '{0}' maps to the same ID type name as '{1}', but their ID value types differ. An ID type name can only bind to a single value type, so change '{0}' to use the same type as '{1}' ('{2}'), or give it a different type name with [ID] or [ID(\"TypeName\")].", - "Message": "The [ID] attribute on 'GetOther' maps to the same ID type name as 'GetId', but their ID value types differ. An ID type name can only bind to a single value type, so change 'GetOther' to use the same type as 'GetId' ('int'), or give it a different type name with [ID] or [ID(\"TypeName\")].", - "Category": "TypeSystem", - "CustomTags": [] - } -] -```