Skip to content

Commit 82ef780

Browse files
committed
Fix links for arrays
1 parent 6f0e6a9 commit 82ef780

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

SchemaDocumentationGenerator/SchemaDocumentationGenerator/TypeGeneration/DocumentationLink.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ private static string GetNameAsLink(this Type type, bool isTypeStructure, string
2020
{
2121
if (type.IsGenericTypeParameter)
2222
{
23-
if(isTypeStructure && !string.IsNullOrEmpty(owner))
23+
if (isTypeStructure && !string.IsNullOrEmpty(owner))
2424
return $"[{type.Name}]({owner}#{type.Name.ToLower()})"; //for a T type, link to the definition on the same page
2525
else
2626
return $"[{type.Name}](#{type.Name.ToLower()})"; //for a T type, link to the definition on the same page
@@ -38,6 +38,10 @@ private static string GetNameAsLink(this Type type, bool isTypeStructure, string
3838

3939
return $"{genType}&lt;{string.Join(", ", args)}&gt;"; //&lt; is the same as < and &gt; is the same as >. If simply typing < it will be treated as html and cause issues.
4040
}
41+
else if (type.IsArray)
42+
{
43+
return $"{type.GetElementType().GetNameAsLink(false, "")}[{string.Join("", Enumerable.Repeat(',', type.GetArrayRank() - 1))}]";
44+
}
4145
else
4246
{
4347
return type.GetNameAsLinkNonGeneric(isTypeStructure);

0 commit comments

Comments
 (0)