diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Conventions/XmlDocumentationProvider.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Conventions/XmlDocumentationProvider.cs index d031938dd6f..7815dd56b5f 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Conventions/XmlDocumentationProvider.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Conventions/XmlDocumentationProvider.cs @@ -25,6 +25,8 @@ public class XmlDocumentationProvider : IDocumentationProvider private const string _cref = "cref"; private const string _href = "href"; private const string _code = "code"; + private const string _paramref = "paramref"; + private const string _name = "name"; private readonly IXmlDocumentationFileResolver _fileResolver; private readonly ObjectPool _stringBuilderPool; @@ -164,6 +166,17 @@ private static void AppendText( continue; } + if (currentElement.Name == _paramref) + { + var nameAttribute = currentElement.Attribute(_name); + + if (nameAttribute != null) + { + description.Append(nameAttribute.Value); + continue; + } + } + if (currentElement.Name != _see) { description.Append(currentElement.Value); diff --git a/src/HotChocolate/Core/test/Types.Tests.Documentation/WithParamrefTagInXmlDoc.cs b/src/HotChocolate/Core/test/Types.Tests.Documentation/WithParamrefTagInXmlDoc.cs new file mode 100644 index 00000000000..77c7cecd6ab --- /dev/null +++ b/src/HotChocolate/Core/test/Types.Tests.Documentation/WithParamrefTagInXmlDoc.cs @@ -0,0 +1,10 @@ +namespace HotChocolate.Types.Descriptors +{ + public class WithParamrefTagInXmlDoc + { + /// + /// This is a parameter reference to . + /// + public int Foo(int id) => id; + } +} diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/Conventions/XmlDocumentationProviderTests.cs b/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/Conventions/XmlDocumentationProviderTests.cs index 84864ff1147..1a95d6e778d 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/Conventions/XmlDocumentationProviderTests.cs +++ b/src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/Conventions/XmlDocumentationProviderTests.cs @@ -62,6 +62,25 @@ public void When_description_has_see_tag_then_it_is_converted() description); } + [Fact] + public void When_description_has_paramref_tag_then_it_is_converted() + { + // arrange + var documentationProvider = new XmlDocumentationProvider( + new XmlDocumentationFileResolver(), + new NoOpStringBuilderPool()); + + // act + var description = documentationProvider.GetDescription( + typeof(WithParamrefTagInXmlDoc) + .GetMethod(nameof(WithParamrefTagInXmlDoc.Foo))!); + + // assert + Assert.Equal( + "This is a parameter reference to id.", + description); + } + [Fact] public void When_description_has_generic_tags_then_it_is_converted() {