diff --git a/src/HotChocolate/Core/src/Types.Analyzers/FileBuilders/TypeFileBuilderBase.cs b/src/HotChocolate/Core/src/Types.Analyzers/FileBuilders/TypeFileBuilderBase.cs index 673c5815256..b00d537e3fe 100644 --- a/src/HotChocolate/Core/src/Types.Analyzers/FileBuilders/TypeFileBuilderBase.cs +++ b/src/HotChocolate/Core/src/Types.Analyzers/FileBuilders/TypeFileBuilderBase.cs @@ -12,6 +12,8 @@ public abstract class TypeFileBuilderBase(StringBuilder sb) { public CodeWriter Writer { get; } = new(sb); + private bool _hasDescription; + protected abstract string OutputFieldDescriptorType { get; } public void WriteHeader() @@ -276,13 +278,19 @@ private void WriteResolverBindingExtendsWith( var description = resolver.Description; if (!string.IsNullOrEmpty(description)) { - Writer.WriteIndentedLine("configuration.Description = \"{0}\";", GeneratorUtils.EscapeForStringLiteral(description)); + _hasDescription = true; + Writer.WriteIndentedLine( + "configuration.Description = GetDescription(\"{0}\", {1}, field.Context.Options.UseXmlDocumentation);", + GeneratorUtils.EscapeForStringLiteral(description), + resolver.IsDescriptionFromAttribute ? "false" : "true"); } var deprecationReason = resolver.DeprecationReason; if (!string.IsNullOrEmpty(deprecationReason)) { - Writer.WriteIndentedLine("configuration.DeprecationReason = \"{0}\";", GeneratorUtils.EscapeForStringLiteral(deprecationReason)); + Writer.WriteIndentedLine( + "configuration.DeprecationReason = \"{0}\";", + GeneratorUtils.EscapeForStringLiteral(deprecationReason)); } WriteResolverBindingDescriptor(type, resolver); @@ -381,9 +389,11 @@ private void WriteResolverBindingExtendsWith( description = parameter.Description; if (!string.IsNullOrEmpty(description)) { + _hasDescription = true; Writer.WriteIndentedLine( - "Description = \"{0}\",", - GeneratorUtils.EscapeForStringLiteral(description)); + "Description = GetDescription(\"{0}\", {1}, field.Context.Options.UseXmlDocumentation),", + GeneratorUtils.EscapeForStringLiteral(description), + parameter.IsDescriptionFromAttribute ? "false" : "true"); } deprecationReason = parameter.DeprecationReason; @@ -618,6 +628,22 @@ public void WriteEndResolverClass() Writer.WriteIndentedLine("}"); } + public void WriteGetDescriptionHelper() + { + if (!_hasDescription) + { + return; + } + + Writer.WriteLine(); + Writer.WriteIndentedLine("[global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]"); + Writer.WriteIndentedLine("private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation)"); + using (Writer.IncreaseIndent()) + { + Writer.WriteIndentedLine("=> !isXmlDocumentation || useXmlDocumentation ? value : null;"); + } + } + public virtual void WriteResolverFields(IOutputTypeInfo type) { foreach (var resolver in type.Resolvers) diff --git a/src/HotChocolate/Core/src/Types.Analyzers/Generators/TypesSyntaxGenerator.cs b/src/HotChocolate/Core/src/Types.Analyzers/Generators/TypesSyntaxGenerator.cs index 1dd749c28a5..09a0389706a 100644 --- a/src/HotChocolate/Core/src/Types.Analyzers/Generators/TypesSyntaxGenerator.cs +++ b/src/HotChocolate/Core/src/Types.Analyzers/Generators/TypesSyntaxGenerator.cs @@ -148,6 +148,7 @@ private static void WriteFile(TypeFileBuilderBase file, IOutputTypeInfo type, IL file.WriteResolverConstructor(type, typeLookup); file.WriteResolverMethods(type, typeLookup); file.WriteEndResolverClass(); + file.WriteGetDescriptionHelper(); file.WriteEndClass(); file.WriteEndNamespace(); file.Flush(); diff --git a/src/HotChocolate/Core/src/Types.Analyzers/Helpers/CompilationExtensions.cs b/src/HotChocolate/Core/src/Types.Analyzers/Helpers/CompilationExtensions.cs index ab8dbdc8cbb..6757b3c8ebf 100644 --- a/src/HotChocolate/Core/src/Types.Analyzers/Helpers/CompilationExtensions.cs +++ b/src/HotChocolate/Core/src/Types.Analyzers/Helpers/CompilationExtensions.cs @@ -94,21 +94,26 @@ public static bool TryGetGraphQLTypeName( switch (symbol) { case IPropertySymbol property: - return new PropertyDescription(property.GetDescriptionFromAttribute()); + return new PropertyDescription( + property.GetDescriptionFromAttribute(), + IsDescriptionFromAttribute: true); case IMethodSymbol method: - var paramDescs = ImmutableArray.CreateBuilder(method.Parameters.Length); + var paramDescs = ImmutableArray.CreateBuilder<(string?, bool)>(method.Parameters.Length); foreach (var p in method.Parameters) { - paramDescs.Add(p.GetDescriptionFromAttribute()); + paramDescs.Add((p.GetDescriptionFromAttribute(), true)); } return new MethodDescription( method.GetDescriptionFromAttribute(), - paramDescs.ToImmutable()); + paramDescs.ToImmutable(), + isDescriptionFromAttribute: true); case IParameterSymbol parameter: - return new ParameterDescription(parameter.GetDescriptionFromAttribute()); + return new ParameterDescription( + parameter.GetDescriptionFromAttribute(), + IsDescriptionFromAttribute: true); default: return null; diff --git a/src/HotChocolate/Core/src/Types.Analyzers/Helpers/SymbolExtensions.cs b/src/HotChocolate/Core/src/Types.Analyzers/Helpers/SymbolExtensions.cs index a5b7483bdbe..643364463ec 100644 --- a/src/HotChocolate/Core/src/Types.Analyzers/Helpers/SymbolExtensions.cs +++ b/src/HotChocolate/Core/src/Types.Analyzers/Helpers/SymbolExtensions.cs @@ -34,15 +34,18 @@ public static MethodDescription GetDescription(this IMethodSymbol method) public static MethodDescription GetDescription(this IMethodSymbol method, Compilation? compilation) { - var methodDescription = ResolveDescriptionCore(method, compilation, ExtractSummaryDescriptionFunc()); + var (methodDescription, isFromAttribute) = ResolveDescriptionCore(method, compilation, ExtractSummaryDescriptionFunc()); // Process parameter descriptions var parameters = method.Parameters; - var paramDescriptions = ImmutableArray.CreateBuilder(parameters.Length); + var paramDescriptions = ImmutableArray.CreateBuilder<(string?, bool)>(parameters.Length); foreach (var param in parameters) { - var paramDescription = compilation?.GetDescription(param)?.Description ?? GetDescriptionFromAttribute(param); + var paramDesc = compilation?.GetDescription(param); + var paramDescription = paramDesc?.Description ?? GetDescriptionFromAttribute(param); + var paramIsFromAttribute = paramDesc?.IsDescriptionFromAttribute + ?? (paramDescription != null && GetDescriptionFromAttribute(param) != null); var commentXml = method.GetDocumentationCommentXml(); if (paramDescription == null && !string.IsNullOrEmpty(commentXml)) @@ -53,6 +56,7 @@ public static MethodDescription GetDescription(this IMethodSymbol method, Compil var paramDoc = ExtractParameterDescriptionFunc(param)(doc); paramDescription = GeneratorUtils.NormalizeXmlDocumentation(paramDoc); + paramIsFromAttribute = false; } catch { @@ -61,10 +65,10 @@ public static MethodDescription GetDescription(this IMethodSymbol method, Compil } } - paramDescriptions.Add(paramDescription); + paramDescriptions.Add((paramDescription, paramIsFromAttribute)); } - return new MethodDescription(methodDescription, paramDescriptions.ToImmutable()); + return new MethodDescription(methodDescription, paramDescriptions.ToImmutable(), isFromAttribute); } public static PropertyDescription? GetDescription(this IPropertySymbol property) @@ -72,8 +76,8 @@ public static MethodDescription GetDescription(this IMethodSymbol method, Compil public static PropertyDescription? GetDescription(this IPropertySymbol property, Compilation? compilation) { - var result = ResolveDescriptionCore(property, compilation, ExtractSummaryDescriptionFunc()); - return result is null ? null : new PropertyDescription(result); + var (result, isFromAttribute) = ResolveDescriptionCore(property, compilation, ExtractSummaryDescriptionFunc()); + return result is null ? null : new PropertyDescription(result, isFromAttribute); } public static ParameterDescription? GetDescription(this IParameterSymbol parameter) @@ -81,17 +85,17 @@ public static MethodDescription GetDescription(this IMethodSymbol method, Compil public static ParameterDescription? GetDescription(this IParameterSymbol parameter, Compilation? compilation) { - var result = ResolveDescriptionCore(parameter, compilation, ExtractParameterDescriptionFunc(parameter)); - return result is null ? null : new ParameterDescription(result); + var (result, isFromAttribute) = ResolveDescriptionCore(parameter, compilation, ExtractParameterDescriptionFunc(parameter)); + return result is null ? null : new ParameterDescription(result, isFromAttribute); } public static string? GetDescription(this INamedTypeSymbol type) => type.GetDescription(null); public static string? GetDescription(this INamedTypeSymbol type, Compilation? compilation) - => ResolveDescriptionCore(type, compilation, ExtractSummaryDescriptionFunc()); + => ResolveDescriptionCore(type, compilation, ExtractSummaryDescriptionFunc()).Description; - private static string? ResolveDescriptionCore( + private static (string? Description, bool IsFromAttribute) ResolveDescriptionCore( ISymbol symbol, Compilation? compilation, Func xmlExtractor) @@ -100,33 +104,33 @@ public static MethodDescription GetDescription(this IMethodSymbol method, Compil var description = GetDescriptionFromAttribute(symbol); if (description != null) { - return description; + return (description, true); } // 2. Inheritance-aware resolution when compilation is available if (compilation != null) { - return GetDocumentationWithInheritance(symbol, compilation, xmlExtractor); + return (GetDocumentationWithInheritance(symbol, compilation, xmlExtractor), false); } // 3. Fallback to simple XML extraction without inheritdoc support var xml = symbol.GetDocumentationCommentXml(); if (string.IsNullOrEmpty(xml)) { - return null; + return (null, false); } try { var doc = XDocument.Parse(xml); var extracted = xmlExtractor(doc); - return GeneratorUtils.NormalizeXmlDocumentation(extracted); + return (GeneratorUtils.NormalizeXmlDocumentation(extracted), false); } catch { // XML documentation parsing is best-effort only. // Malformed XML is ignored and we fall back to no description. - return null; + return (null, false); } } diff --git a/src/HotChocolate/Core/src/Types.Analyzers/Inspectors/InterfaceTypeInfoInspector.cs b/src/HotChocolate/Core/src/Types.Analyzers/Inspectors/InterfaceTypeInfoInspector.cs index 8ac1394de76..2a611954403 100644 --- a/src/HotChocolate/Core/src/Types.Analyzers/Inspectors/InterfaceTypeInfoInspector.cs +++ b/src/HotChocolate/Core/src/Types.Analyzers/Inspectors/InterfaceTypeInfoInspector.cs @@ -167,13 +167,15 @@ private static Resolver CreateResolver( var parameter = parameters[i]; var parameterKind = compilation.GetParameterKind(parameter, out var key); + var paramDesc = compilation.GetDescription(parameter); buffer[i] = new ResolverParameter( parameter, parameterKind, compilation.CreateTypeReference(parameter), - compilation.GetDescription(parameter)?.Description, + paramDesc?.Description, compilation.GetDeprecationReason(parameter), - key); + key, + paramDesc?.IsDescriptionFromAttribute ?? false); } return new Resolver( diff --git a/src/HotChocolate/Core/src/Types.Analyzers/Inspectors/ObjectTypeInspector.cs b/src/HotChocolate/Core/src/Types.Analyzers/Inspectors/ObjectTypeInspector.cs index 5edc5e2fb76..86ad03c14b2 100644 --- a/src/HotChocolate/Core/src/Types.Analyzers/Inspectors/ObjectTypeInspector.cs +++ b/src/HotChocolate/Core/src/Types.Analyzers/Inspectors/ObjectTypeInspector.cs @@ -296,13 +296,15 @@ public static Resolver CreateResolver( var parameter = parameters[i]; var parameterKind = compilation.GetParameterKind(parameter, out var key); + var paramDesc = compilation.GetDescription(parameter); buffer[i] = new ResolverParameter( parameter, parameterKind, compilation.CreateTypeReference(parameter, isBatchResolver), - compilation.GetDescription(parameter)?.Description, + paramDesc?.Description, compilation.GetDeprecationReason(parameter), - key); + key, + paramDesc?.IsDescriptionFromAttribute ?? false); } resolverTypeName ??= resolverType.Name; @@ -342,13 +344,15 @@ private static Resolver CreateNodeResolver( var parameter = parameters[i]; var parameterKind = compilation.GetParameterKind(parameter, out var key); + var paramDesc = compilation.GetDescription(parameter); var resolverParameter = new ResolverParameter( parameter, parameterKind, compilation.CreateTypeReference(parameter), - compilation.GetDescription(parameter)?.Description, + paramDesc?.Description, compilation.GetDeprecationReason(parameter), - key); + key, + paramDesc?.IsDescriptionFromAttribute ?? false); if (resolverParameter.Kind == ResolverParameterKind.Argument) { @@ -370,9 +374,10 @@ private static Resolver CreateNodeResolver( parameter, ResolverParameterKind.Argument, compilation.CreateTypeReference(parameter), - compilation.GetDescription(parameter)?.Description, + paramDesc?.Description, compilation.GetDeprecationReason(parameter), - key); + key, + paramDesc?.IsDescriptionFromAttribute ?? false); } buffer[i] = resolverParameter; diff --git a/src/HotChocolate/Core/src/Types.Analyzers/Models/MethodDescription.cs b/src/HotChocolate/Core/src/Types.Analyzers/Models/MethodDescription.cs index 4ee89eb994b..ab84ff7c408 100644 --- a/src/HotChocolate/Core/src/Types.Analyzers/Models/MethodDescription.cs +++ b/src/HotChocolate/Core/src/Types.Analyzers/Models/MethodDescription.cs @@ -14,12 +14,17 @@ namespace HotChocolate.Types.Analyzers.Models; /// /// The parameter descriptions in the same order as the method parameters. /// + /// + /// Whether the method description originates from a [GraphQLDescription] attribute. + /// public MethodDescription( string? description, - ImmutableArray parameterDescriptions) + ImmutableArray<(string? Description, bool IsFromAttribute)> parameterDescriptions, + bool isDescriptionFromAttribute = false) { Description = description; ParameterDescriptions = parameterDescriptions; + IsDescriptionFromAttribute = isDescriptionFromAttribute; } /// @@ -27,24 +32,37 @@ public MethodDescription( /// public string? Description { get; } + /// + /// Gets whether the description originates from a [GraphQLDescription] attribute. + /// + public bool IsDescriptionFromAttribute { get; } + /// /// Gets the parameter descriptions in the same order as the method parameters. /// Each element is null if the parameter is not documented. /// - public ImmutableArray ParameterDescriptions { get; } + public ImmutableArray<(string? Description, bool IsFromAttribute)> ParameterDescriptions { get; } } -public readonly record struct PropertyDescription(string? Description) : IMemberDescription +public readonly record struct PropertyDescription( + string? Description, + bool IsDescriptionFromAttribute = false) : IMemberDescription { public string? Description { get; } = Description; + public bool IsDescriptionFromAttribute { get; } = IsDescriptionFromAttribute; } -public readonly record struct ParameterDescription(string? Description) : IMemberDescription +public readonly record struct ParameterDescription( + string? Description, + bool IsDescriptionFromAttribute = false) : IMemberDescription { public string? Description { get; } = Description; + public bool IsDescriptionFromAttribute { get; } = IsDescriptionFromAttribute; } public interface IMemberDescription { string? Description { get; } + + bool IsDescriptionFromAttribute { get; } } diff --git a/src/HotChocolate/Core/src/Types.Analyzers/Models/Resolver.cs b/src/HotChocolate/Core/src/Types.Analyzers/Models/Resolver.cs index 38dc1458fff..3b943b8ad27 100644 --- a/src/HotChocolate/Core/src/Types.Analyzers/Models/Resolver.cs +++ b/src/HotChocolate/Core/src/Types.Analyzers/Models/Resolver.cs @@ -36,7 +36,12 @@ public Resolver( { for (var i = 0; i < parameters.Length; i++) { - parameters[i].Description ??= m.ParameterDescriptions[i]; + if (parameters[i].Description is null) + { + var (paramDesc, paramIsFromAttr) = m.ParameterDescriptions[i]; + parameters[i].Description = paramDesc; + parameters[i].IsDescriptionFromAttribute = paramIsFromAttr; + } } } @@ -53,6 +58,8 @@ public Resolver( public string? Description => _description?.Description; + public bool IsDescriptionFromAttribute => _description?.IsDescriptionFromAttribute ?? false; + public string? DeprecationReason { get; } public ISymbol Member { get; } diff --git a/src/HotChocolate/Core/src/Types.Analyzers/Models/ResolverParameter.cs b/src/HotChocolate/Core/src/Types.Analyzers/Models/ResolverParameter.cs index cf767f26dfa..31d36b3ecb1 100644 --- a/src/HotChocolate/Core/src/Types.Analyzers/Models/ResolverParameter.cs +++ b/src/HotChocolate/Core/src/Types.Analyzers/Models/ResolverParameter.cs @@ -12,10 +12,12 @@ public ResolverParameter( SchemaTypeReference schemaTypeRef, string? description, string? deprecationReason, - string? key) + string? key, + bool isDescriptionFromAttribute = false) : this(parameter, kind, schemaTypeRef, deprecationReason, key) { Description = description; + IsDescriptionFromAttribute = isDescriptionFromAttribute; } public ResolverParameter( @@ -49,6 +51,8 @@ public ResolverParameter( public string? Description { get; set; } + public bool IsDescriptionFromAttribute { get; set; } + public string? DeprecationReason { get; } public string? Key { get; } @@ -100,7 +104,8 @@ public ResolverParameter WithKind(ResolverParameterKind kind) SchemaTypeRef, Description, DeprecationReason, - Key); + Key, + IsDescriptionFromAttribute); private static ImmutableArray GetGenericTypeArgument(ITypeSymbol typeSymbol) { diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/ObjectTypeTests.DisableXmlDocumentation.cs b/src/HotChocolate/Core/test/Types.Analyzers.Tests/ObjectTypeTests.DisableXmlDocumentation.cs index 8f299400641..3d3f9d2f61d 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/ObjectTypeTests.DisableXmlDocumentation.cs +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/ObjectTypeTests.DisableXmlDocumentation.cs @@ -101,6 +101,6 @@ internal static partial class Query Assert.Equal("User description from XML doc.", emitted[1].Value); } - [GeneratedRegex("configuration.Description = \"(.*)\";")] + [GeneratedRegex("configuration\\.Description = GetDescription\\(\"(.*?)\",")] private static partial Regex DescriptionExtractorRegex(); } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/ObjectTypeTests.XmlDocInference.Ported.cs b/src/HotChocolate/Core/test/Types.Analyzers.Tests/ObjectTypeTests.XmlDocInference.Ported.cs index 056419a360e..11876956893 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/ObjectTypeTests.XmlDocInference.Ported.cs +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/ObjectTypeTests.XmlDocInference.Ported.cs @@ -460,14 +460,14 @@ private static void AssertFieldDocumentation(string content, string fieldDoc, pa for (var index = 0; index < paramDescriptions.Length; index++) { var paramDescription = paramDescriptions[index]; - Assert.Equal(parameterDocs[index], paramDescription.Groups[2].Value); + Assert.Equal(parameterDocs[index], paramDescription.Groups[1].Value); } } } - [System.Text.RegularExpressions.GeneratedRegex("configuration.Description = \"(.*)\";")] + [System.Text.RegularExpressions.GeneratedRegex("configuration\\.Description = GetDescription\\(\"(.*?)\",")] private static partial System.Text.RegularExpressions.Regex DescriptionExtractorRegex(); - [System.Text.RegularExpressions.GeneratedRegex("(\\s+)Description = \"(.*)\",")] + [System.Text.RegularExpressions.GeneratedRegex("(? !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeDisableXmlDocumentationTests.XmlDocumentation_Is_Emitted_When_DisableXmlDocumentation_Is_Not_Set.snap b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeDisableXmlDocumentationTests.XmlDocumentation_Is_Emitted_When_DisableXmlDocumentation_Is_Not_Set.snap index 9f7b017204d..90bfdfd336c 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeDisableXmlDocumentationTests.XmlDocumentation_Is_Emitted_When_DisableXmlDocumentation_Is_Not_Set.snap +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeDisableXmlDocumentationTests.XmlDocumentation_Is_Emitted_When_DisableXmlDocumentation_Is_Not_Set.snap @@ -78,7 +78,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "User description from XML doc."; + configuration.Description = GetDescription("User description from XML doc.", true, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(string), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("string"))); @@ -108,6 +108,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeTests.XmlDocumentation_With_ComplexScenario.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeTests.XmlDocumentation_With_ComplexScenario.md index 8ea588ef037..3d43724213b 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeTests.XmlDocumentation_With_ComplexScenario.md +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeTests.XmlDocumentation_With_ComplexScenario.md @@ -82,7 +82,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Executes a complex query with:\n- Multiple lines\n- Special chars: \"quotes\", 'apostrophes', `backticks`\n- Paths: C:\\Program Files\\App\n- Tab\tseparated\tvalues"; + configuration.Description = GetDescription("Executes a complex query with:\n- Multiple lines\n- Special chars: \"quotes\", 'apostrophes', `backticks`\n- Paths: C:\\Program Files\\App\n- Tab\tseparated\tvalues", true, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(string), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("string"))); @@ -99,7 +99,7 @@ namespace TestNamespace var argumentConfiguration = new global::HotChocolate.Types.Descriptors.Configurations.ArgumentConfiguration { Name = naming.GetMemberName("query", global::HotChocolate.Types.MemberKind.Argument), - Description = "SQL query like: SELECT * FROM \"Users\" WHERE name = 'John'", + Description = GetDescription("SQL query like: SELECT * FROM \"Users\" WHERE name = 'John'", true, field.Context.Options.UseXmlDocumentation), Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(string), HotChocolate.Types.TypeContext.Input), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("string"))), @@ -117,7 +117,7 @@ namespace TestNamespace var argumentConfiguration = new global::HotChocolate.Types.Descriptors.Configurations.ArgumentConfiguration { Name = naming.GetMemberName("timeout", global::HotChocolate.Types.MemberKind.Argument), - Description = "Timeout in ms (default: 30000)", + Description = GetDescription("Timeout in ms (default: 30000)", true, field.Context.Options.UseXmlDocumentation), RuntimeDefaultValue = 30000, Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Input), @@ -178,6 +178,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeTests.XmlDocumentation_With_MultilineDescription.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeTests.XmlDocumentation_With_MultilineDescription.md index 26be8de7dcc..d74e1b92ea4 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeTests.XmlDocumentation_With_MultilineDescription.md +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeTests.XmlDocumentation_With_MultilineDescription.md @@ -82,7 +82,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "This is a multiline description.\nIt spans multiple lines.\nAnd should be properly normalized."; + configuration.Description = GetDescription("This is a multiline description.\nIt spans multiple lines.\nAnd should be properly normalized.", true, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(string), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("string"))); @@ -112,6 +112,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeTests.XmlDocumentation_With_ParameterDescription.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeTests.XmlDocumentation_With_ParameterDescription.md index ecdfd64ac6d..ebb312b70a1 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeTests.XmlDocumentation_With_ParameterDescription.md +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeTests.XmlDocumentation_With_ParameterDescription.md @@ -82,7 +82,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Gets a user by ID.\nReturns null if not found."; + configuration.Description = GetDescription("Gets a user by ID.\nReturns null if not found.", true, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(string), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("string"))); @@ -99,7 +99,7 @@ namespace TestNamespace var argumentConfiguration = new global::HotChocolate.Types.Descriptors.Configurations.ArgumentConfiguration { Name = naming.GetMemberName("userId", global::HotChocolate.Types.MemberKind.Argument), - Description = "The user's unique identifier with \"quotes\"", + Description = GetDescription("The user's unique identifier with \"quotes\"", true, field.Context.Options.UseXmlDocumentation), Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Input), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))), @@ -117,7 +117,7 @@ namespace TestNamespace var argumentConfiguration = new global::HotChocolate.Types.Descriptors.Configurations.ArgumentConfiguration { Name = naming.GetMemberName("includeDeleted", global::HotChocolate.Types.MemberKind.Argument), - Description = "Include deleted users (default: false)", + Description = GetDescription("Include deleted users (default: false)", true, field.Context.Options.UseXmlDocumentation), RuntimeDefaultValue = false, Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(bool), HotChocolate.Types.TypeContext.Input), @@ -178,6 +178,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeTests.XmlDocumentation_With_SpecialCharacters.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeTests.XmlDocumentation_With_SpecialCharacters.md index 7c3b8c07c1b..6a3a95c06ba 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeTests.XmlDocumentation_With_SpecialCharacters.md +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeTests.XmlDocumentation_With_SpecialCharacters.md @@ -82,7 +82,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Use \"quotes\" and `backticks` here.\nPath: C:\\Windows\\System32"; + configuration.Description = GetDescription("Use \"quotes\" and `backticks` here.\nPath: C:\\Windows\\System32", true, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(string), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("string"))); @@ -112,6 +112,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_class_has_description_then_it_is_converted.snap b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_class_has_description_then_it_is_converted.snap index 6d2e6b0abd4..39650dd050b 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_class_has_description_then_it_is_converted.snap +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_class_has_description_then_it_is_converted.snap @@ -78,7 +78,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "I am a test class. This should not be escaped: >"; + configuration.Description = GetDescription("I am a test class. This should not be escaped: >", true, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))); @@ -108,6 +108,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_class_implements_interface_and_method_has_description_then_method_parameter_description_is_used.snap b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_class_implements_interface_and_method_has_description_then_method_parameter_description_is_used.snap index 3be4c5cc499..63d1cd34046 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_class_implements_interface_and_method_has_description_then_method_parameter_description_is_used.snap +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_class_implements_interface_and_method_has_description_then_method_parameter_description_is_used.snap @@ -78,7 +78,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "I am my own method."; + configuration.Description = GetDescription("I am my own method.", true, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))); @@ -95,7 +95,7 @@ namespace TestNamespace var argumentConfiguration = new global::HotChocolate.Types.Descriptors.Configurations.ArgumentConfiguration { Name = naming.GetMemberName("baz", global::HotChocolate.Types.MemberKind.Argument), - Description = "I am my own parameter.", + Description = GetDescription("I am my own parameter.", true, field.Context.Options.UseXmlDocumentation), Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(string), HotChocolate.Types.TypeContext.Input), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("string"))), @@ -146,6 +146,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_description_has_generic_tags_then_it_is_converted.snap b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_description_has_generic_tags_then_it_is_converted.snap index b9aa135aa25..5597d696ea3 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_description_has_generic_tags_then_it_is_converted.snap +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_description_has_generic_tags_then_it_is_converted.snap @@ -78,7 +78,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "These are some tags."; + configuration.Description = GetDescription("These are some tags.", true, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))); @@ -108,6 +108,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_description_has_paramref_tag_then_it_is_converted.snap b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_description_has_paramref_tag_then_it_is_converted.snap index 37a1e1bffbc..317d5bf7a8b 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_description_has_paramref_tag_then_it_is_converted.snap +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_description_has_paramref_tag_then_it_is_converted.snap @@ -78,7 +78,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "This is a parameter reference to id."; + configuration.Description = GetDescription("This is a parameter reference to id.", true, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))); @@ -145,6 +145,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_description_has_see_tag_then_it_is_converted.snap b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_description_has_see_tag_then_it_is_converted.snap index 9953efdcecc..6826f9d24d8 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_description_has_see_tag_then_it_is_converted.snap +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_description_has_see_tag_then_it_is_converted.snap @@ -78,7 +78,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "null for the default Record.\nSee this and\nthis at\nhttps://foo.com/bar/baz."; + configuration.Description = GetDescription("null for the default Record.\nSee this and\nthis at\nhttps://foo.com/bar/baz.", true, field.Context.Options.UseXmlDocumentation); configuration.Type = typeInspector.GetTypeRef(typeof(string), HotChocolate.Types.TypeContext.Output); configuration.ResultType = typeof(string); @@ -104,6 +104,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_method_has_exceptions_then_exceptions_with_no_code_will_be_ignored.snap b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_method_has_exceptions_then_exceptions_with_no_code_will_be_ignored.snap index c76ff06a4ff..d87d01e0abb 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_method_has_exceptions_then_exceptions_with_no_code_will_be_ignored.snap +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_method_has_exceptions_then_exceptions_with_no_code_will_be_ignored.snap @@ -78,7 +78,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Query and manages users.\n\n\n**Returns:**\nBar\n\n**Errors:**\n1. FOO_ERROR: Foo Error\n2. BAR_ERROR: Bar Error"; + configuration.Description = GetDescription("Query and manages users.\n\n\n**Returns:**\nBar\n\n**Errors:**\n1. FOO_ERROR: Foo Error\n2. BAR_ERROR: Bar Error", true, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))); @@ -108,6 +108,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_method_has_exceptions_then_it_is_converted.snap b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_method_has_exceptions_then_it_is_converted.snap index c76ff06a4ff..d87d01e0abb 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_method_has_exceptions_then_it_is_converted.snap +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_method_has_exceptions_then_it_is_converted.snap @@ -78,7 +78,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Query and manages users.\n\n\n**Returns:**\nBar\n\n**Errors:**\n1. FOO_ERROR: Foo Error\n2. BAR_ERROR: Bar Error"; + configuration.Description = GetDescription("Query and manages users.\n\n\n**Returns:**\nBar\n\n**Errors:**\n1. FOO_ERROR: Foo Error\n2. BAR_ERROR: Bar Error", true, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))); @@ -108,6 +108,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_method_has_inheritdoc_then_it_is_resolved.snap b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_method_has_inheritdoc_then_it_is_resolved.snap index 2c6c23b4cf9..26a4296c1ed 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_method_has_inheritdoc_then_it_is_resolved.snap +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_method_has_inheritdoc_then_it_is_resolved.snap @@ -78,7 +78,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Method doc."; + configuration.Description = GetDescription("Method doc.", true, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))); @@ -145,6 +145,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_method_has_only_exceptions_with_no_code_then_error_section_will_not_be_written.snap b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_method_has_only_exceptions_with_no_code_then_error_section_will_not_be_written.snap index a5217435470..5314ecba1e3 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_method_has_only_exceptions_with_no_code_then_error_section_will_not_be_written.snap +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_method_has_only_exceptions_with_no_code_then_error_section_will_not_be_written.snap @@ -78,7 +78,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Query and manages users.\n\n\n**Returns:**\nBar"; + configuration.Description = GetDescription("Query and manages users.\n\n\n**Returns:**\nBar", true, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))); @@ -108,6 +108,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_method_has_returns_then_it_is_converted.snap b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_method_has_returns_then_it_is_converted.snap index a5217435470..5314ecba1e3 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_method_has_returns_then_it_is_converted.snap +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_method_has_returns_then_it_is_converted.snap @@ -78,7 +78,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Query and manages users.\n\n\n**Returns:**\nBar"; + configuration.Description = GetDescription("Query and manages users.\n\n\n**Returns:**\nBar", true, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))); @@ -108,6 +108,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_parameter_has_inheritdoc_then_it_is_resolved.snap b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_parameter_has_inheritdoc_then_it_is_resolved.snap index bcf36d2d7b0..10ab976122e 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_parameter_has_inheritdoc_then_it_is_resolved.snap +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_parameter_has_inheritdoc_then_it_is_resolved.snap @@ -78,7 +78,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Method doc."; + configuration.Description = GetDescription("Method doc.", true, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))); @@ -95,7 +95,7 @@ namespace TestNamespace var argumentConfiguration = new global::HotChocolate.Types.Descriptors.Configurations.ArgumentConfiguration { Name = naming.GetMemberName("baz", global::HotChocolate.Types.MemberKind.Argument), - Description = "Parameter details.", + Description = GetDescription("Parameter details.", true, field.Context.Options.UseXmlDocumentation), Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(string), HotChocolate.Types.TypeContext.Input), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("string"))), @@ -146,6 +146,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_xml_doc_with_multiple_breaks_is_read_then_they_are_not_stripped_away.snap b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_xml_doc_with_multiple_breaks_is_read_then_they_are_not_stripped_away.snap index 7a5c7398726..01b94f571ac 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_xml_doc_with_multiple_breaks_is_read_then_they_are_not_stripped_away.snap +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.When_xml_doc_with_multiple_breaks_is_read_then_they_are_not_stripped_away.snap @@ -78,7 +78,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Query and manages users.\n\nPlease note:\n* Users ...\n* Users ...\n * Users ...\n * Users ...\n\nYou need one of the following role: Owner,\nEditor, use XYZ to manage permissions."; + configuration.Description = GetDescription("Query and manages users.\n\nPlease note:\n* Users ...\n* Users ...\n * Users ...\n * Users ...\n\nYou need one of the following role: Owner,\nEditor, use XYZ to manage permissions.", true, field.Context.Options.UseXmlDocumentation); configuration.Type = typeInspector.GetTypeRef(typeof(string), HotChocolate.Types.TypeContext.Output); configuration.ResultType = typeof(string); @@ -104,6 +104,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_Is_Overriden_By_DescriptionAttribute.snap b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_Is_Overriden_By_DescriptionAttribute.snap index e99c170da9b..1a3531468cd 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_Is_Overriden_By_DescriptionAttribute.snap +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_Is_Overriden_By_DescriptionAttribute.snap @@ -78,7 +78,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Nothing"; + configuration.Description = GetDescription("Nothing", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(string), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("string"))); @@ -108,6 +108,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_WithInheritdoc_And_MultipleLayersOfInheritance.snap b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_WithInheritdoc_And_MultipleLayersOfInheritance.snap index 2c6c23b4cf9..26a4296c1ed 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_WithInheritdoc_And_MultipleLayersOfInheritance.snap +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_WithInheritdoc_And_MultipleLayersOfInheritance.snap @@ -78,7 +78,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Method doc."; + configuration.Description = GetDescription("Method doc.", true, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))); @@ -145,6 +145,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_WithInheritdoc_Inside_Exception.snap b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_WithInheritdoc_Inside_Exception.snap index cb033945cbf..b1fff3eea5a 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_WithInheritdoc_Inside_Exception.snap +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_WithInheritdoc_Inside_Exception.snap @@ -78,7 +78,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "My Method doc.\n\n\n**Returns:**\nMy Returns doc.\n\n**Errors:**\n1. FOO_ERROR: My Foo Error Inherited: Foo Error\n2. BAR_ERROR: My Bar Error"; + configuration.Description = GetDescription("My Method doc.\n\n\n**Returns:**\nMy Returns doc.\n\n**Errors:**\n1. FOO_ERROR: My Foo Error Inherited: Foo Error\n2. BAR_ERROR: My Bar Error", true, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))); @@ -95,7 +95,7 @@ namespace TestNamespace var argumentConfiguration = new global::HotChocolate.Types.Descriptors.Configurations.ArgumentConfiguration { Name = naming.GetMemberName("x", global::HotChocolate.Types.MemberKind.Argument), - Description = "My Parameter doc.", + Description = GetDescription("My Parameter doc.", true, field.Context.Options.UseXmlDocumentation), Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Input), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))), @@ -146,6 +146,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_WithInheritdoc_Inside_Param.snap b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_WithInheritdoc_Inside_Param.snap index 732e74b0560..5ff785c5a31 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_WithInheritdoc_Inside_Param.snap +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_WithInheritdoc_Inside_Param.snap @@ -78,7 +78,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "My Method doc.\n\n\n**Returns:**\nMy Returns doc.\n\n**Errors:**\n1. FOO_ERROR: My Foo Error\n2. BAR_ERROR: My Bar Error"; + configuration.Description = GetDescription("My Method doc.\n\n\n**Returns:**\nMy Returns doc.\n\n**Errors:**\n1. FOO_ERROR: My Foo Error\n2. BAR_ERROR: My Bar Error", true, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))); @@ -95,7 +95,7 @@ namespace TestNamespace var argumentConfiguration = new global::HotChocolate.Types.Descriptors.Configurations.ArgumentConfiguration { Name = naming.GetMemberName("x", global::HotChocolate.Types.MemberKind.Argument), - Description = "My Parameter doc. Inherited: Parameter doc.", + Description = GetDescription("My Parameter doc. Inherited: Parameter doc.", true, field.Context.Options.UseXmlDocumentation), Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Input), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))), @@ -146,6 +146,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_WithInheritdoc_Inside_Returns.snap b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_WithInheritdoc_Inside_Returns.snap index 2952ec09bc0..24d22f25d4f 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_WithInheritdoc_Inside_Returns.snap +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_WithInheritdoc_Inside_Returns.snap @@ -78,7 +78,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "My Method doc.\n\n\n**Returns:**\nMy Returns doc. Inherited: Returns doc.\n\n**Errors:**\n1. FOO_ERROR: My Foo Error\n2. BAR_ERROR: My Bar Error"; + configuration.Description = GetDescription("My Method doc.\n\n\n**Returns:**\nMy Returns doc. Inherited: Returns doc.\n\n**Errors:**\n1. FOO_ERROR: My Foo Error\n2. BAR_ERROR: My Bar Error", true, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))); @@ -95,7 +95,7 @@ namespace TestNamespace var argumentConfiguration = new global::HotChocolate.Types.Descriptors.Configurations.ArgumentConfiguration { Name = naming.GetMemberName("x", global::HotChocolate.Types.MemberKind.Argument), - Description = "My Parameter doc.", + Description = GetDescription("My Parameter doc.", true, field.Context.Options.UseXmlDocumentation), Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Input), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))), @@ -146,6 +146,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_WithInheritdoc_Inside_Summary.snap b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_WithInheritdoc_Inside_Summary.snap index c5d0656339a..aca883d3cd1 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_WithInheritdoc_Inside_Summary.snap +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_WithInheritdoc_Inside_Summary.snap @@ -78,7 +78,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "My Method doc. Inherited: Method doc.\n\n\n**Returns:**\nMy Returns doc.\n\n**Errors:**\n1. FOO_ERROR: My Foo Error\n2. BAR_ERROR: My Bar Error"; + configuration.Description = GetDescription("My Method doc. Inherited: Method doc.\n\n\n**Returns:**\nMy Returns doc.\n\n**Errors:**\n1. FOO_ERROR: My Foo Error\n2. BAR_ERROR: My Bar Error", true, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))); @@ -95,7 +95,7 @@ namespace TestNamespace var argumentConfiguration = new global::HotChocolate.Types.Descriptors.Configurations.ArgumentConfiguration { Name = naming.GetMemberName("x", global::HotChocolate.Types.MemberKind.Argument), - Description = "My Parameter doc.", + Description = GetDescription("My Parameter doc.", true, field.Context.Options.UseXmlDocumentation), Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Input), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))), @@ -146,6 +146,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_WithInheritdoc_OnRootLevel_CustomException.snap b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_WithInheritdoc_OnRootLevel_CustomException.snap index cc1cce6f932..c8a6f6c8c42 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_WithInheritdoc_OnRootLevel_CustomException.snap +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_WithInheritdoc_OnRootLevel_CustomException.snap @@ -78,7 +78,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Method doc.\n\n\n**Returns:**\nReturns doc.\n\n**Errors:**\n1. BAR_ERROR: Bar Error\n2. FOO_ERROR: My Foo Error"; + configuration.Description = GetDescription("Method doc.\n\n\n**Returns:**\nReturns doc.\n\n**Errors:**\n1. BAR_ERROR: Bar Error\n2. FOO_ERROR: My Foo Error", true, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))); @@ -95,7 +95,7 @@ namespace TestNamespace var argumentConfiguration = new global::HotChocolate.Types.Descriptors.Configurations.ArgumentConfiguration { Name = naming.GetMemberName("x", global::HotChocolate.Types.MemberKind.Argument), - Description = "Parameter doc.", + Description = GetDescription("Parameter doc.", true, field.Context.Options.UseXmlDocumentation), Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Input), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))), @@ -146,6 +146,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_WithInheritdoc_OnRootLevel_CustomParam.snap b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_WithInheritdoc_OnRootLevel_CustomParam.snap index 72a9c3e7d39..7594443978e 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_WithInheritdoc_OnRootLevel_CustomParam.snap +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_WithInheritdoc_OnRootLevel_CustomParam.snap @@ -78,7 +78,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Method doc.\n\n\n**Returns:**\nReturns doc.\n\n**Errors:**\n1. FOO_ERROR: Foo Error\n2. BAR_ERROR: Bar Error"; + configuration.Description = GetDescription("Method doc.\n\n\n**Returns:**\nReturns doc.\n\n**Errors:**\n1. FOO_ERROR: Foo Error\n2. BAR_ERROR: Bar Error", true, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))); @@ -95,7 +95,7 @@ namespace TestNamespace var argumentConfiguration = new global::HotChocolate.Types.Descriptors.Configurations.ArgumentConfiguration { Name = naming.GetMemberName("x", global::HotChocolate.Types.MemberKind.Argument), - Description = "My Parameter doc.", + Description = GetDescription("My Parameter doc.", true, field.Context.Options.UseXmlDocumentation), Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Input), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))), @@ -146,6 +146,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_WithInheritdoc_OnRootLevel_CustomReturns.snap b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_WithInheritdoc_OnRootLevel_CustomReturns.snap index 84985787ab9..12f7e4e77c5 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_WithInheritdoc_OnRootLevel_CustomReturns.snap +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_WithInheritdoc_OnRootLevel_CustomReturns.snap @@ -78,7 +78,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Method doc.\n\n\n**Returns:**\nMy Returns doc.\n\n**Errors:**\n1. FOO_ERROR: Foo Error\n2. BAR_ERROR: Bar Error"; + configuration.Description = GetDescription("Method doc.\n\n\n**Returns:**\nMy Returns doc.\n\n**Errors:**\n1. FOO_ERROR: Foo Error\n2. BAR_ERROR: Bar Error", true, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))); @@ -95,7 +95,7 @@ namespace TestNamespace var argumentConfiguration = new global::HotChocolate.Types.Descriptors.Configurations.ArgumentConfiguration { Name = naming.GetMemberName("x", global::HotChocolate.Types.MemberKind.Argument), - Description = "Parameter doc.", + Description = GetDescription("Parameter doc.", true, field.Context.Options.UseXmlDocumentation), Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Input), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))), @@ -146,6 +146,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_WithInheritdoc_OnRootLevel_CustomSummary.snap b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_WithInheritdoc_OnRootLevel_CustomSummary.snap index 2fc0591fc42..1a8caac3b61 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_WithInheritdoc_OnRootLevel_CustomSummary.snap +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_WithInheritdoc_OnRootLevel_CustomSummary.snap @@ -78,7 +78,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "My Method doc.\n\n\n**Returns:**\nReturns doc.\n\n**Errors:**\n1. FOO_ERROR: Foo Error\n2. BAR_ERROR: Bar Error"; + configuration.Description = GetDescription("My Method doc.\n\n\n**Returns:**\nReturns doc.\n\n**Errors:**\n1. FOO_ERROR: Foo Error\n2. BAR_ERROR: Bar Error", true, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))); @@ -95,7 +95,7 @@ namespace TestNamespace var argumentConfiguration = new global::HotChocolate.Types.Descriptors.Configurations.ArgumentConfiguration { Name = naming.GetMemberName("x", global::HotChocolate.Types.MemberKind.Argument), - Description = "Parameter doc.", + Description = GetDescription("Parameter doc.", true, field.Context.Options.UseXmlDocumentation), Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Input), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))), @@ -146,6 +146,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_WithInheritdoc_ThatContainsInheritdoc.snap b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_WithInheritdoc_ThatContainsInheritdoc.snap index 1127734e654..7f121039fb0 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_WithInheritdoc_ThatContainsInheritdoc.snap +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_WithInheritdoc_ThatContainsInheritdoc.snap @@ -78,7 +78,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Concrete Method doc.\nMethod doc."; + configuration.Description = GetDescription("Concrete Method doc.\nMethod doc.", true, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))); @@ -145,6 +145,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_With_Nested_InheritdocCref.snap b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_With_Nested_InheritdocCref.snap index e20785c3e13..6cd270b7bc6 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_With_Nested_InheritdocCref.snap +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForMethod_With_Nested_InheritdocCref.snap @@ -78,7 +78,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "This type is similar useless to 'The Bar type.'."; + configuration.Description = GetDescription("This type is similar useless to 'The Bar type.'.", true, field.Context.Options.UseXmlDocumentation); configuration.Type = typeInspector.GetTypeRef(typeof(string), HotChocolate.Types.TypeContext.Output); configuration.ResultType = typeof(string); @@ -106,6 +106,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForParameter_Ignores_ReturnsAndExceptions.snap b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForParameter_Ignores_ReturnsAndExceptions.snap index 5aaf2ded2c7..10c3dffbbaf 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForParameter_Ignores_ReturnsAndExceptions.snap +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForParameter_Ignores_ReturnsAndExceptions.snap @@ -78,7 +78,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Foo.\n\n\n**Returns:**\nBar-object\n\n**Errors:**\n1. EX: Foo-exception"; + configuration.Description = GetDescription("Foo.\n\n\n**Returns:**\nBar-object\n\n**Errors:**\n1. EX: Foo-exception", true, field.Context.Options.UseXmlDocumentation); configuration.Type = typeInspector.GetTypeRef(typeof(string), HotChocolate.Types.TypeContext.Output); configuration.ResultType = typeof(string); @@ -93,7 +93,7 @@ namespace TestNamespace var argumentConfiguration = new global::HotChocolate.Types.Descriptors.Configurations.ArgumentConfiguration { Name = naming.GetMemberName("bar", global::HotChocolate.Types.MemberKind.Argument), - Description = "Bar.", + Description = GetDescription("Bar.", true, field.Context.Options.UseXmlDocumentation), Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Input), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))), @@ -144,6 +144,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForParameter_IsInferred.snap b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForParameter_IsInferred.snap index 4125d633a1e..caa6446421d 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForParameter_IsInferred.snap +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForParameter_IsInferred.snap @@ -78,7 +78,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Foo."; + configuration.Description = GetDescription("Foo.", true, field.Context.Options.UseXmlDocumentation); configuration.Type = typeInspector.GetTypeRef(typeof(string), HotChocolate.Types.TypeContext.Output); configuration.ResultType = typeof(string); @@ -93,7 +93,7 @@ namespace TestNamespace var argumentConfiguration = new global::HotChocolate.Types.Descriptors.Configurations.ArgumentConfiguration { Name = naming.GetMemberName("bar", global::HotChocolate.Types.MemberKind.Argument), - Description = "Bar.", + Description = GetDescription("Bar.", true, field.Context.Options.UseXmlDocumentation), Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Input), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))), @@ -144,6 +144,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForParameter_Is_Overriden_By_DescriptionAttribute.snap b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForParameter_Is_Overriden_By_DescriptionAttribute.snap index 2a6741823dc..edb05fef480 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForParameter_Is_Overriden_By_DescriptionAttribute.snap +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForParameter_Is_Overriden_By_DescriptionAttribute.snap @@ -78,7 +78,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Foo."; + configuration.Description = GetDescription("Foo.", true, field.Context.Options.UseXmlDocumentation); configuration.Type = typeInspector.GetTypeRef(typeof(string), HotChocolate.Types.TypeContext.Output); configuration.ResultType = typeof(string); @@ -93,7 +93,7 @@ namespace TestNamespace var argumentConfiguration = new global::HotChocolate.Types.Descriptors.Configurations.ArgumentConfiguration { Name = naming.GetMemberName("bar", global::HotChocolate.Types.MemberKind.Argument), - Description = "FooBar", + Description = GetDescription("FooBar", false, field.Context.Options.UseXmlDocumentation), Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Input), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))), @@ -146,6 +146,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForParameter_WithInheritdoc_AndAdditional_ExplicitParamComment.snap b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForParameter_WithInheritdoc_AndAdditional_ExplicitParamComment.snap index c01bd43cb27..f6e016ff62d 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForParameter_WithInheritdoc_AndAdditional_ExplicitParamComment.snap +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForParameter_WithInheritdoc_AndAdditional_ExplicitParamComment.snap @@ -78,7 +78,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Foo."; + configuration.Description = GetDescription("Foo.", true, field.Context.Options.UseXmlDocumentation); configuration.Type = typeInspector.GetTypeRef(typeof(string), HotChocolate.Types.TypeContext.Output); configuration.ResultType = typeof(string); @@ -93,7 +93,7 @@ namespace TestNamespace var argumentConfiguration = new global::HotChocolate.Types.Descriptors.Configurations.ArgumentConfiguration { Name = naming.GetMemberName("bar", global::HotChocolate.Types.MemberKind.Argument), - Description = "Bar.", + Description = GetDescription("Bar.", true, field.Context.Options.UseXmlDocumentation), Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Input), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))), @@ -111,7 +111,7 @@ namespace TestNamespace var argumentConfiguration = new global::HotChocolate.Types.Descriptors.Configurations.ArgumentConfiguration { Name = naming.GetMemberName("fooBar", global::HotChocolate.Types.MemberKind.Argument), - Description = "FooBar.", + Description = GetDescription("FooBar.", true, field.Context.Options.UseXmlDocumentation), Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Input), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))), @@ -171,6 +171,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForParameter_WithInheritdoc_Is_Overriden_By_DescriptionAttribute.snap b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForParameter_WithInheritdoc_Is_Overriden_By_DescriptionAttribute.snap index 2a6741823dc..edb05fef480 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForParameter_WithInheritdoc_Is_Overriden_By_DescriptionAttribute.snap +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForParameter_WithInheritdoc_Is_Overriden_By_DescriptionAttribute.snap @@ -78,7 +78,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Foo."; + configuration.Description = GetDescription("Foo.", true, field.Context.Options.UseXmlDocumentation); configuration.Type = typeInspector.GetTypeRef(typeof(string), HotChocolate.Types.TypeContext.Output); configuration.ResultType = typeof(string); @@ -93,7 +93,7 @@ namespace TestNamespace var argumentConfiguration = new global::HotChocolate.Types.Descriptors.Configurations.ArgumentConfiguration { Name = naming.GetMemberName("bar", global::HotChocolate.Types.MemberKind.Argument), - Description = "FooBar", + Description = GetDescription("FooBar", false, field.Context.Options.UseXmlDocumentation), Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Input), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))), @@ -146,6 +146,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForParameter_WithInheritdoc_Is_Overriden_By_ExplicitParamComment.snap b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForParameter_WithInheritdoc_Is_Overriden_By_ExplicitParamComment.snap index 5f4b2816cd4..b970fa69166 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForParameter_WithInheritdoc_Is_Overriden_By_ExplicitParamComment.snap +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForParameter_WithInheritdoc_Is_Overriden_By_ExplicitParamComment.snap @@ -78,7 +78,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Foo."; + configuration.Description = GetDescription("Foo.", true, field.Context.Options.UseXmlDocumentation); configuration.Type = typeInspector.GetTypeRef(typeof(string), HotChocolate.Types.TypeContext.Output); configuration.ResultType = typeof(string); @@ -93,7 +93,7 @@ namespace TestNamespace var argumentConfiguration = new global::HotChocolate.Types.Descriptors.Configurations.ArgumentConfiguration { Name = naming.GetMemberName("bar", global::HotChocolate.Types.MemberKind.Argument), - Description = "Explicit Bar.", + Description = GetDescription("Explicit Bar.", true, field.Context.Options.UseXmlDocumentation), Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Input), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))), @@ -144,6 +144,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForParameter_WithInheritdoc_WithinParamComment.snap b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForParameter_WithInheritdoc_WithinParamComment.snap index f0538c129c7..0841d29cdd0 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForParameter_WithInheritdoc_WithinParamComment.snap +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_ForParameter_WithInheritdoc_WithinParamComment.snap @@ -78,7 +78,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "My Foo."; + configuration.Description = GetDescription("My Foo.", true, field.Context.Options.UseXmlDocumentation); configuration.Type = typeInspector.GetTypeRef(typeof(string), HotChocolate.Types.TypeContext.Output); configuration.ResultType = typeof(string); @@ -93,7 +93,7 @@ namespace TestNamespace var argumentConfiguration = new global::HotChocolate.Types.Descriptors.Configurations.ArgumentConfiguration { Name = naming.GetMemberName("bar", global::HotChocolate.Types.MemberKind.Argument), - Description = "My Bar (inherited from: Bar.).", + Description = GetDescription("My Bar (inherited from: Bar.).", true, field.Context.Options.UseXmlDocumentation), Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Input), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))), @@ -144,6 +144,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_With_InheritdocCref_AllPossibleTargets.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_With_InheritdocCref_AllPossibleTargets.md index 8e4c6757f9b..e293570a215 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_With_InheritdocCref_AllPossibleTargets.md +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/ObjectTypeXmlDocInferenceTests.XmlDocumentation_With_InheritdocCref_AllPossibleTargets.md @@ -82,7 +82,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Type description."; + configuration.Description = GetDescription("Type description.", true, field.Context.Options.UseXmlDocumentation); configuration.Type = typeInspector.GetTypeRef(typeof(string), HotChocolate.Types.TypeContext.Output); configuration.ResultType = typeof(string); @@ -101,7 +101,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Field description."; + configuration.Description = GetDescription("Field description.", true, field.Context.Options.UseXmlDocumentation); configuration.Type = typeInspector.GetTypeRef(typeof(string), HotChocolate.Types.TypeContext.Output); configuration.ResultType = typeof(string); @@ -120,7 +120,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Property description."; + configuration.Description = GetDescription("Property description.", true, field.Context.Options.UseXmlDocumentation); configuration.Type = typeInspector.GetTypeRef(typeof(string), HotChocolate.Types.TypeContext.Output); configuration.ResultType = typeof(string); @@ -139,7 +139,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Method description."; + configuration.Description = GetDescription("Method description.", true, field.Context.Options.UseXmlDocumentation); configuration.Type = typeInspector.GetTypeRef(typeof(string), HotChocolate.Types.TypeContext.Output); configuration.ResultType = typeof(string); @@ -158,7 +158,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Event description."; + configuration.Description = GetDescription("Event description.", true, field.Context.Options.UseXmlDocumentation); configuration.Type = typeInspector.GetTypeRef(typeof(string), HotChocolate.Types.TypeContext.Output); configuration.ResultType = typeof(string); @@ -177,7 +177,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Nested type instance field description."; + configuration.Description = GetDescription("Nested type instance field description.", true, field.Context.Options.UseXmlDocumentation); configuration.Type = typeInspector.GetTypeRef(typeof(string), HotChocolate.Types.TypeContext.Output); configuration.ResultType = typeof(string); @@ -196,7 +196,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Int-overloaded method description."; + configuration.Description = GetDescription("Int-overloaded method description.", true, field.Context.Options.UseXmlDocumentation); configuration.Type = typeInspector.GetTypeRef(typeof(string), HotChocolate.Types.TypeContext.Output); configuration.ResultType = typeof(string); @@ -327,6 +327,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_ConnectionFlags.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_ConnectionFlags.md index cd1f98ffec3..811b8d36371 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_ConnectionFlags.md +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_ConnectionFlags.md @@ -229,7 +229,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "The item at the end of the edge."; + configuration.Description = GetDescription("The item at the end of the edge.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(global::TestNamespace.Author), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("global__TestNamespace_Author"))); @@ -250,7 +250,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "A cursor for use in pagination."; + configuration.Description = GetDescription("A cursor for use in pagination.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(string), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("string"))); @@ -292,6 +292,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_Inherit_From_ConnectionBase_Inherit_PageEdge.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_Inherit_From_ConnectionBase_Inherit_PageEdge.md index 0bfcd520a41..c6a1f9cf269 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_Inherit_From_ConnectionBase_Inherit_PageEdge.md +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_Inherit_From_ConnectionBase_Inherit_PageEdge.md @@ -229,7 +229,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "The item at the end of the edge."; + configuration.Description = GetDescription("The item at the end of the edge.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(global::TestNamespace.Author), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("global__TestNamespace_Author"))); @@ -250,7 +250,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "A cursor for use in pagination."; + configuration.Description = GetDescription("A cursor for use in pagination.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(string), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("string"))); @@ -292,6 +292,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_Inherit_From_ConnectionBase_Reuse_PageEdge.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_Inherit_From_ConnectionBase_Reuse_PageEdge.md index 2efc930c4a2..0c31d66c20c 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_Inherit_From_ConnectionBase_Reuse_PageEdge.md +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_Inherit_From_ConnectionBase_Reuse_PageEdge.md @@ -209,7 +209,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "The item at the end of the edge."; + configuration.Description = GetDescription("The item at the end of the edge.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(global::TestNamespace.Author), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("global__TestNamespace_Author"))); @@ -230,7 +230,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "A cursor for use in pagination."; + configuration.Description = GetDescription("A cursor for use in pagination.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(string), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("string"))); @@ -263,6 +263,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_Inherit_From_ConnectionBase_Reuse_PageEdge_Generic.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_Inherit_From_ConnectionBase_Reuse_PageEdge_Generic.md index f3563e68e02..4bf0b838a13 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_Inherit_From_ConnectionBase_Reuse_PageEdge_Generic.md +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_Inherit_From_ConnectionBase_Reuse_PageEdge_Generic.md @@ -215,7 +215,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "The item at the end of the edge."; + configuration.Description = GetDescription("The item at the end of the edge.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(global::TestNamespace.Author), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("global__TestNamespace_Author"))); @@ -236,7 +236,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "A cursor for use in pagination."; + configuration.Description = GetDescription("A cursor for use in pagination.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(string), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("string"))); @@ -269,6 +269,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_Inherit_From_PageConnection.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_Inherit_From_PageConnection.md index 4a617e9553f..bc15a7b21ea 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_Inherit_From_PageConnection.md +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.GenerateSource_Inherit_From_PageConnection.md @@ -66,7 +66,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "A list of edges."; + configuration.Description = GetDescription("A list of edges.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = typeInspector.GetTypeRef(typeof(global::HotChocolate.Types.ListType>), HotChocolate.Types.TypeContext.Output); configuration.ResultType = typeof(global::System.Collections.Generic.IReadOnlyList>); @@ -86,7 +86,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "A flattened list of the nodes"; + configuration.Description = GetDescription("A flattened list of the nodes", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(global::TestNamespace.Author), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.ListTypeNode(new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("global__TestNamespace_Author")))); @@ -108,7 +108,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Information to aid in pagination."; + configuration.Description = GetDescription("Information to aid in pagination.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(global::HotChocolate.Types.Pagination.PageInfo), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("global__HotChocolate_Types_Pagination_PageInfo"))); @@ -129,7 +129,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Identifies the total count of items in the connection."; + configuration.Description = GetDescription("Identifies the total count of items in the connection.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))); @@ -192,6 +192,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } @@ -244,7 +248,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "The item at the end of the edge."; + configuration.Description = GetDescription("The item at the end of the edge.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(global::TestNamespace.Author), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("global__TestNamespace_Author"))); @@ -265,7 +269,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "A cursor for use in pagination."; + configuration.Description = GetDescription("A cursor for use in pagination.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(string), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("string"))); @@ -298,6 +302,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.Inaccessible_On_PageConnection.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.Inaccessible_On_PageConnection.md index b5fb8b04e72..f3dc006ba73 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.Inaccessible_On_PageConnection.md +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.Inaccessible_On_PageConnection.md @@ -68,7 +68,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "A list of edges."; + configuration.Description = GetDescription("A list of edges.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = typeInspector.GetTypeRef(typeof(global::HotChocolate.Types.ListType>), HotChocolate.Types.TypeContext.Output); configuration.ResultType = typeof(global::System.Collections.Generic.IReadOnlyList>); @@ -88,7 +88,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "A flattened list of the nodes"; + configuration.Description = GetDescription("A flattened list of the nodes", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(global::TestNamespace.Author), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.ListTypeNode(new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("global__TestNamespace_Author")))); @@ -110,7 +110,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Information to aid in pagination."; + configuration.Description = GetDescription("Information to aid in pagination.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(global::HotChocolate.Types.Pagination.PageInfo), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("global__HotChocolate_Types_Pagination_PageInfo"))); @@ -131,7 +131,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Identifies the total count of items in the connection."; + configuration.Description = GetDescription("Identifies the total count of items in the connection.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))); @@ -194,6 +194,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } @@ -248,7 +252,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "The item at the end of the edge."; + configuration.Description = GetDescription("The item at the end of the edge.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(global::TestNamespace.Author), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("global__TestNamespace_Author"))); @@ -269,7 +273,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "A cursor for use in pagination."; + configuration.Description = GetDescription("A cursor for use in pagination.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(string), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("string"))); @@ -302,6 +306,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.Inaccessible_On_PageConnection_Scoped.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.Inaccessible_On_PageConnection_Scoped.md index 5a64df96469..dd521e06a99 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.Inaccessible_On_PageConnection_Scoped.md +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.Inaccessible_On_PageConnection_Scoped.md @@ -68,7 +68,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "A list of edges."; + configuration.Description = GetDescription("A list of edges.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = typeInspector.GetTypeRef(typeof(global::HotChocolate.Types.ListType>), HotChocolate.Types.TypeContext.Output); configuration.ResultType = typeof(global::System.Collections.Generic.IReadOnlyList>); @@ -89,7 +89,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "A flattened list of the nodes"; + configuration.Description = GetDescription("A flattened list of the nodes", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(global::TestNamespace.Author), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.ListTypeNode(new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("global__TestNamespace_Author")))); @@ -112,7 +112,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Information to aid in pagination."; + configuration.Description = GetDescription("Information to aid in pagination.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(global::HotChocolate.Types.Pagination.PageInfo), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("global__HotChocolate_Types_Pagination_PageInfo"))); @@ -134,7 +134,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Identifies the total count of items in the connection."; + configuration.Description = GetDescription("Identifies the total count of items in the connection.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))); @@ -197,6 +197,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } @@ -250,7 +254,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "The item at the end of the edge."; + configuration.Description = GetDescription("The item at the end of the edge.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(global::TestNamespace.Author), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("global__TestNamespace_Author"))); @@ -272,7 +276,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "A cursor for use in pagination."; + configuration.Description = GetDescription("A cursor for use in pagination.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(string), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("string"))); @@ -305,6 +309,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.Shareable_On_PageConnection.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.Shareable_On_PageConnection.md index e4bd624515a..3d5c07ac618 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.Shareable_On_PageConnection.md +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.Shareable_On_PageConnection.md @@ -63,7 +63,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "A list of edges."; + configuration.Description = GetDescription("A list of edges.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = typeInspector.GetTypeRef(typeof(global::HotChocolate.Types.ListType>), HotChocolate.Types.TypeContext.Output); configuration.ResultType = typeof(global::System.Collections.Generic.IReadOnlyList>); @@ -83,7 +83,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "A flattened list of the nodes"; + configuration.Description = GetDescription("A flattened list of the nodes", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(global::TestNamespace.Author), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.ListTypeNode(new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("global__TestNamespace_Author")))); @@ -105,7 +105,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Information to aid in pagination."; + configuration.Description = GetDescription("Information to aid in pagination.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(global::HotChocolate.Types.Pagination.PageInfo), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("global__HotChocolate_Types_Pagination_PageInfo"))); @@ -126,7 +126,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Identifies the total count of items in the connection."; + configuration.Description = GetDescription("Identifies the total count of items in the connection.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))); @@ -189,6 +189,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } @@ -238,7 +242,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "The item at the end of the edge."; + configuration.Description = GetDescription("The item at the end of the edge.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(global::TestNamespace.Author), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("global__TestNamespace_Author"))); @@ -259,7 +263,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "A cursor for use in pagination."; + configuration.Description = GetDescription("A cursor for use in pagination.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(string), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("string"))); @@ -292,6 +296,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.Shareable_On_PageConnection_Scoped.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.Shareable_On_PageConnection_Scoped.md index e42d279063d..2a40a3fddaf 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.Shareable_On_PageConnection_Scoped.md +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/PagingTests.Shareable_On_PageConnection_Scoped.md @@ -68,7 +68,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "A list of edges."; + configuration.Description = GetDescription("A list of edges.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = typeInspector.GetTypeRef(typeof(global::HotChocolate.Types.ListType>), HotChocolate.Types.TypeContext.Output); configuration.ResultType = typeof(global::System.Collections.Generic.IReadOnlyList>); @@ -89,7 +89,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "A flattened list of the nodes"; + configuration.Description = GetDescription("A flattened list of the nodes", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(global::TestNamespace.Author), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.ListTypeNode(new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("global__TestNamespace_Author")))); @@ -112,7 +112,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Information to aid in pagination."; + configuration.Description = GetDescription("Information to aid in pagination.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(global::HotChocolate.Types.Pagination.PageInfo), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("global__HotChocolate_Types_Pagination_PageInfo"))); @@ -134,7 +134,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Identifies the total count of items in the connection."; + configuration.Description = GetDescription("Identifies the total count of items in the connection.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))); @@ -197,6 +197,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } @@ -250,7 +254,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "The item at the end of the edge."; + configuration.Description = GetDescription("The item at the end of the edge.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(global::TestNamespace.Author), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("global__TestNamespace_Author"))); @@ -272,7 +276,7 @@ namespace TestNamespace var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "A cursor for use in pagination."; + configuration.Description = GetDescription("A cursor for use in pagination.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(string), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("string"))); @@ -305,6 +309,10 @@ namespace TestNamespace return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/QueryContextConnectionAnalyzerTests.CorrectGenericTypeMatch_NoError.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/QueryContextConnectionAnalyzerTests.CorrectGenericTypeMatch_NoError.md index c89059f3681..53666f9c203 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/QueryContextConnectionAnalyzerTests.CorrectGenericTypeMatch_NoError.md +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/QueryContextConnectionAnalyzerTests.CorrectGenericTypeMatch_NoError.md @@ -82,7 +82,7 @@ namespace HotChocolate.Types.Pagination var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "A list of edges."; + configuration.Description = GetDescription("A list of edges.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = typeInspector.GetTypeRef(typeof(global::HotChocolate.Types.ListType>), HotChocolate.Types.TypeContext.Output); configuration.ResultType = typeof(global::System.Collections.Generic.IReadOnlyList>); @@ -102,7 +102,7 @@ namespace HotChocolate.Types.Pagination var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "A flattened list of the nodes"; + configuration.Description = GetDescription("A flattened list of the nodes", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(global::TestNamespace.Product), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.ListTypeNode(new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("global__TestNamespace_Product")))); @@ -124,7 +124,7 @@ namespace HotChocolate.Types.Pagination var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Information to aid in pagination."; + configuration.Description = GetDescription("Information to aid in pagination.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(global::HotChocolate.Types.Pagination.PageInfo), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("global__HotChocolate_Types_Pagination_PageInfo"))); @@ -145,7 +145,7 @@ namespace HotChocolate.Types.Pagination var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Identifies the total count of items in the connection."; + configuration.Description = GetDescription("Identifies the total count of items in the connection.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))); @@ -197,6 +197,10 @@ namespace HotChocolate.Types.Pagination return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } @@ -252,7 +256,7 @@ namespace HotChocolate.Types.Pagination var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "The item at the end of the edge."; + configuration.Description = GetDescription("The item at the end of the edge.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(global::TestNamespace.Product), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("global__TestNamespace_Product"))); @@ -273,7 +277,7 @@ namespace HotChocolate.Types.Pagination var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "A cursor for use in pagination."; + configuration.Description = GetDescription("A cursor for use in pagination.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(string), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("string"))); @@ -306,6 +310,10 @@ namespace HotChocolate.Types.Pagination return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/QueryContextConnectionAnalyzerTests.NoQueryContextParameter_NoError.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/QueryContextConnectionAnalyzerTests.NoQueryContextParameter_NoError.md index 650a5a06f33..9e167404852 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/QueryContextConnectionAnalyzerTests.NoQueryContextParameter_NoError.md +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/QueryContextConnectionAnalyzerTests.NoQueryContextParameter_NoError.md @@ -82,7 +82,7 @@ namespace HotChocolate.Types.Pagination var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "A list of edges."; + configuration.Description = GetDescription("A list of edges.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = typeInspector.GetTypeRef(typeof(global::HotChocolate.Types.ListType>), HotChocolate.Types.TypeContext.Output); configuration.ResultType = typeof(global::System.Collections.Generic.IReadOnlyList>); @@ -102,7 +102,7 @@ namespace HotChocolate.Types.Pagination var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "A flattened list of the nodes"; + configuration.Description = GetDescription("A flattened list of the nodes", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(global::TestNamespace.Product), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.ListTypeNode(new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("global__TestNamespace_Product")))); @@ -124,7 +124,7 @@ namespace HotChocolate.Types.Pagination var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Information to aid in pagination."; + configuration.Description = GetDescription("Information to aid in pagination.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(global::HotChocolate.Types.Pagination.PageInfo), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("global__HotChocolate_Types_Pagination_PageInfo"))); @@ -145,7 +145,7 @@ namespace HotChocolate.Types.Pagination var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Identifies the total count of items in the connection."; + configuration.Description = GetDescription("Identifies the total count of items in the connection.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))); @@ -197,6 +197,10 @@ namespace HotChocolate.Types.Pagination return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } @@ -252,7 +256,7 @@ namespace HotChocolate.Types.Pagination var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "The item at the end of the edge."; + configuration.Description = GetDescription("The item at the end of the edge.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(global::TestNamespace.Product), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("global__TestNamespace_Product"))); @@ -273,7 +277,7 @@ namespace HotChocolate.Types.Pagination var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "A cursor for use in pagination."; + configuration.Description = GetDescription("A cursor for use in pagination.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(string), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("string"))); @@ -306,6 +310,10 @@ namespace HotChocolate.Types.Pagination return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/QueryContextConnectionAnalyzerTests.TypeMismatch_WithMutationType_RaisesError.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/QueryContextConnectionAnalyzerTests.TypeMismatch_WithMutationType_RaisesError.md index 98bcd87eb85..f45c2b038fd 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/QueryContextConnectionAnalyzerTests.TypeMismatch_WithMutationType_RaisesError.md +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/QueryContextConnectionAnalyzerTests.TypeMismatch_WithMutationType_RaisesError.md @@ -244,7 +244,7 @@ namespace HotChocolate.Types.Pagination var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "A list of edges."; + configuration.Description = GetDescription("A list of edges.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = typeInspector.GetTypeRef(typeof(global::HotChocolate.Types.ListType>), HotChocolate.Types.TypeContext.Output); configuration.ResultType = typeof(global::System.Collections.Generic.IReadOnlyList>); @@ -264,7 +264,7 @@ namespace HotChocolate.Types.Pagination var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "A flattened list of the nodes"; + configuration.Description = GetDescription("A flattened list of the nodes", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(global::TestNamespace.Product), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.ListTypeNode(new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("global__TestNamespace_Product")))); @@ -286,7 +286,7 @@ namespace HotChocolate.Types.Pagination var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Information to aid in pagination."; + configuration.Description = GetDescription("Information to aid in pagination.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(global::HotChocolate.Types.Pagination.PageInfo), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("global__HotChocolate_Types_Pagination_PageInfo"))); @@ -307,7 +307,7 @@ namespace HotChocolate.Types.Pagination var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Identifies the total count of items in the connection."; + configuration.Description = GetDescription("Identifies the total count of items in the connection.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))); @@ -359,6 +359,10 @@ namespace HotChocolate.Types.Pagination return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } @@ -414,7 +418,7 @@ namespace HotChocolate.Types.Pagination var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "The item at the end of the edge."; + configuration.Description = GetDescription("The item at the end of the edge.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(global::TestNamespace.Product), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("global__TestNamespace_Product"))); @@ -435,7 +439,7 @@ namespace HotChocolate.Types.Pagination var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "A cursor for use in pagination."; + configuration.Description = GetDescription("A cursor for use in pagination.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(string), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("string"))); @@ -468,6 +472,10 @@ namespace HotChocolate.Types.Pagination return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/QueryContextConnectionAnalyzerTests.TypeMismatch_WithObjectType_RaisesError.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/QueryContextConnectionAnalyzerTests.TypeMismatch_WithObjectType_RaisesError.md index 8f65f343169..d2f733fd6e5 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/QueryContextConnectionAnalyzerTests.TypeMismatch_WithObjectType_RaisesError.md +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/QueryContextConnectionAnalyzerTests.TypeMismatch_WithObjectType_RaisesError.md @@ -82,7 +82,7 @@ namespace HotChocolate.Types.Pagination var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "A list of edges."; + configuration.Description = GetDescription("A list of edges.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = typeInspector.GetTypeRef(typeof(global::HotChocolate.Types.ListType>), HotChocolate.Types.TypeContext.Output); configuration.ResultType = typeof(global::System.Collections.Generic.IReadOnlyList>); @@ -102,7 +102,7 @@ namespace HotChocolate.Types.Pagination var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "A flattened list of the nodes"; + configuration.Description = GetDescription("A flattened list of the nodes", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(global::TestNamespace.Product), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.ListTypeNode(new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("global__TestNamespace_Product")))); @@ -124,7 +124,7 @@ namespace HotChocolate.Types.Pagination var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Information to aid in pagination."; + configuration.Description = GetDescription("Information to aid in pagination.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(global::HotChocolate.Types.Pagination.PageInfo), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("global__HotChocolate_Types_Pagination_PageInfo"))); @@ -145,7 +145,7 @@ namespace HotChocolate.Types.Pagination var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Identifies the total count of items in the connection."; + configuration.Description = GetDescription("Identifies the total count of items in the connection.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))); @@ -197,6 +197,10 @@ namespace HotChocolate.Types.Pagination return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } @@ -252,7 +256,7 @@ namespace HotChocolate.Types.Pagination var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "The item at the end of the edge."; + configuration.Description = GetDescription("The item at the end of the edge.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(global::TestNamespace.Product), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("global__TestNamespace_Product"))); @@ -273,7 +277,7 @@ namespace HotChocolate.Types.Pagination var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "A cursor for use in pagination."; + configuration.Description = GetDescription("A cursor for use in pagination.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(string), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("string"))); @@ -306,6 +310,10 @@ namespace HotChocolate.Types.Pagination return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/QueryContextConnectionAnalyzerTests.TypeMismatch_WithQueryType_RaisesError.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/QueryContextConnectionAnalyzerTests.TypeMismatch_WithQueryType_RaisesError.md index ac21c2147c6..c25c0942e75 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/QueryContextConnectionAnalyzerTests.TypeMismatch_WithQueryType_RaisesError.md +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/QueryContextConnectionAnalyzerTests.TypeMismatch_WithQueryType_RaisesError.md @@ -87,7 +87,7 @@ namespace HotChocolate.Types.Pagination var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "A list of edges."; + configuration.Description = GetDescription("A list of edges.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = typeInspector.GetTypeRef(typeof(global::HotChocolate.Types.ListType>), HotChocolate.Types.TypeContext.Output); configuration.ResultType = typeof(global::System.Collections.Generic.IReadOnlyList>); @@ -107,7 +107,7 @@ namespace HotChocolate.Types.Pagination var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "A flattened list of the nodes"; + configuration.Description = GetDescription("A flattened list of the nodes", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(global::TestNamespace.Product), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.ListTypeNode(new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("global__TestNamespace_Product")))); @@ -129,7 +129,7 @@ namespace HotChocolate.Types.Pagination var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Information to aid in pagination."; + configuration.Description = GetDescription("Information to aid in pagination.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(global::HotChocolate.Types.Pagination.PageInfo), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("global__HotChocolate_Types_Pagination_PageInfo"))); @@ -150,7 +150,7 @@ namespace HotChocolate.Types.Pagination var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Identifies the total count of items in the connection."; + configuration.Description = GetDescription("Identifies the total count of items in the connection.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))); @@ -202,6 +202,10 @@ namespace HotChocolate.Types.Pagination return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } @@ -257,7 +261,7 @@ namespace HotChocolate.Types.Pagination var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "The item at the end of the edge."; + configuration.Description = GetDescription("The item at the end of the edge.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(global::TestNamespace.Product), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("global__TestNamespace_Product"))); @@ -278,7 +282,7 @@ namespace HotChocolate.Types.Pagination var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "A cursor for use in pagination."; + configuration.Description = GetDescription("A cursor for use in pagination.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(string), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("string"))); @@ -311,6 +315,10 @@ namespace HotChocolate.Types.Pagination return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/QueryContextConnectionAnalyzerTests.TypeMismatch_WithSubscriptionType_RaisesError.md b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/QueryContextConnectionAnalyzerTests.TypeMismatch_WithSubscriptionType_RaisesError.md index 11ebaf345e0..d2b8d73b29a 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/QueryContextConnectionAnalyzerTests.TypeMismatch_WithSubscriptionType_RaisesError.md +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/__snapshots__/QueryContextConnectionAnalyzerTests.TypeMismatch_WithSubscriptionType_RaisesError.md @@ -87,7 +87,7 @@ namespace HotChocolate.Types.Pagination var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "A list of edges."; + configuration.Description = GetDescription("A list of edges.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = typeInspector.GetTypeRef(typeof(global::HotChocolate.Types.ListType>), HotChocolate.Types.TypeContext.Output); configuration.ResultType = typeof(global::System.Collections.Generic.IReadOnlyList>); @@ -107,7 +107,7 @@ namespace HotChocolate.Types.Pagination var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "A flattened list of the nodes"; + configuration.Description = GetDescription("A flattened list of the nodes", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(global::TestNamespace.Product), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.ListTypeNode(new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("global__TestNamespace_Product")))); @@ -129,7 +129,7 @@ namespace HotChocolate.Types.Pagination var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Information to aid in pagination."; + configuration.Description = GetDescription("Information to aid in pagination.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(global::HotChocolate.Types.Pagination.PageInfo), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("global__HotChocolate_Types_Pagination_PageInfo"))); @@ -150,7 +150,7 @@ namespace HotChocolate.Types.Pagination var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "Identifies the total count of items in the connection."; + configuration.Description = GetDescription("Identifies the total count of items in the connection.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(int), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("int"))); @@ -202,6 +202,10 @@ namespace HotChocolate.Types.Pagination return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } } @@ -257,7 +261,7 @@ namespace HotChocolate.Types.Pagination var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "The item at the end of the edge."; + configuration.Description = GetDescription("The item at the end of the edge.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(global::TestNamespace.Product), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("global__TestNamespace_Product"))); @@ -278,7 +282,7 @@ namespace HotChocolate.Types.Pagination var bindingResolver = field.Context.ParameterBindingResolver; var naming = field.Context.Naming; - configuration.Description = "A cursor for use in pagination."; + configuration.Description = GetDescription("A cursor for use in pagination.", false, field.Context.Options.UseXmlDocumentation); configuration.Type = global::HotChocolate.Types.Descriptors.TypeReference.Create( typeInspector.GetTypeRef(typeof(string), HotChocolate.Types.TypeContext.Output), new global::HotChocolate.Language.NonNullTypeNode(new global::HotChocolate.Language.NamedTypeNode("string"))); @@ -311,6 +315,10 @@ namespace HotChocolate.Types.Pagination return result; } } + + [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static string? GetDescription(string value, bool isXmlDocumentation, bool useXmlDocumentation) + => !isXmlDocumentation || useXmlDocumentation ? value : null; } }