File tree Expand file tree Collapse file tree 3 files changed +42
-0
lines changed
src/Types/Types/Descriptors/Conventions
Types.Tests.Documentation
Types.Tests/Types/Descriptors/Conventions Expand file tree Collapse file tree 3 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,8 @@ public class XmlDocumentationProvider : IDocumentationProvider
25
25
private const string _cref = "cref" ;
26
26
private const string _href = "href" ;
27
27
private const string _code = "code" ;
28
+ private const string _paramref = "paramref" ;
29
+ private const string _name = "name" ;
28
30
29
31
private readonly IXmlDocumentationFileResolver _fileResolver ;
30
32
private readonly ObjectPool < StringBuilder > _stringBuilderPool ;
@@ -164,6 +166,17 @@ private static void AppendText(
164
166
continue ;
165
167
}
166
168
169
+ if ( currentElement . Name == _paramref )
170
+ {
171
+ var nameAttribute = currentElement . Attribute ( _name ) ;
172
+
173
+ if ( nameAttribute != null )
174
+ {
175
+ description . Append ( nameAttribute . Value ) ;
176
+ continue ;
177
+ }
178
+ }
179
+
167
180
if ( currentElement . Name != _see )
168
181
{
169
182
description . Append ( currentElement . Value ) ;
Original file line number Diff line number Diff line change
1
+ namespace HotChocolate . Types . Descriptors
2
+ {
3
+ public class WithParamrefTagInXmlDoc
4
+ {
5
+ /// <summary>
6
+ /// This is a parameter reference to <paramref name="id"/>.
7
+ /// </summary>
8
+ public int Foo ( int id ) => id ;
9
+ }
10
+ }
Original file line number Diff line number Diff line change @@ -62,6 +62,25 @@ public void When_description_has_see_tag_then_it_is_converted()
62
62
description ) ;
63
63
}
64
64
65
+ [ Fact ]
66
+ public void When_description_has_paramref_tag_then_it_is_converted ( )
67
+ {
68
+ // arrange
69
+ var documentationProvider = new XmlDocumentationProvider (
70
+ new XmlDocumentationFileResolver ( ) ,
71
+ new NoOpStringBuilderPool ( ) ) ;
72
+
73
+ // act
74
+ var description = documentationProvider . GetDescription (
75
+ typeof ( WithParamrefTagInXmlDoc )
76
+ . GetMethod ( nameof ( WithParamrefTagInXmlDoc . Foo ) ) ! ) ;
77
+
78
+ // assert
79
+ Assert . Equal (
80
+ "This is a parameter reference to id." ,
81
+ description ) ;
82
+ }
83
+
65
84
[ Fact ]
66
85
public void When_description_has_generic_tags_then_it_is_converted ( )
67
86
{
You can’t perform that action at this time.
0 commit comments