Skip to content

Commit 1fdf980

Browse files
committed
manual backport of fixes made in master for #2115, better xmldocs for generated Indices/Types related methods
1 parent 0a7d076 commit 1fdf980

File tree

7 files changed

+11377
-11368
lines changed

7 files changed

+11377
-11368
lines changed

src/CodeGeneration/ApiGenerator/Domain/ApiUrlPart.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,19 @@ public class ApiUrlPart
66
{
77
public string Name { get; set; }
88
public string Type { get; set; }
9-
public string Description { get; set; }
9+
10+
private string _description;
11+
public string Description { get { return _description; } set { _description = CleanUpDescription(value); } }
12+
1013
public bool Required { get; set; }
1114
public IEnumerable<string> Options { get; set; }
1215

16+
private string CleanUpDescription(string value)
17+
{
18+
if (string.IsNullOrWhiteSpace(value)) return value;
19+
return value.Replace("use `_all` or empty string", "use the special string `_all` or Indices.All");
20+
}
21+
1322
public string ClrTypeName
1423
{
1524
get

src/CodeGeneration/ApiGenerator/Domain/CsharpMethod.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,19 +252,19 @@ public IEnumerable<FluentRouteSetter> GetFluentRouteSetters()
252252
{
253253
code = $"public {returnType} {p.InterfaceName}<TOther>() where TOther : class ";
254254
code += $"=> Assign(a=>a.RouteValues.{routeSetter}(\"{p.Name}\", ({p.ClrTypeName})typeof(TOther)));";
255-
xmlDoc = $"///<summary>{p.Description}</summary>";
255+
xmlDoc = $"///<summary>a shortcut into calling {p.InterfaceName}(typeof(TOther))</summary>";
256256
setters.Add(new FluentRouteSetter { Code = code, XmlDoc = xmlDoc });
257257
}
258258
if (paramName == "index" && p.Type == "list")
259259
{
260260
code = $"public {returnType} AllIndices() => this.Index(Indices.All);";
261-
xmlDoc = $"///<summary>{p.Description}</summary>";
261+
xmlDoc = $"///<summary>A shortcut into calling Index(Indices.All)</summary>";
262262
setters.Add(new FluentRouteSetter { Code = code, XmlDoc = xmlDoc });
263263
}
264264
if (paramName == "type" && p.Type == "list")
265265
{
266266
code = $"public {returnType} AllTypes() => this.Type(Types.All);";
267-
xmlDoc = $"///<summary>{p.Description}</summary>";
267+
xmlDoc = $"///<summary>a shortcut into calling Type(Types.All)</summary>";
268268
setters.Add(new FluentRouteSetter { Code = code, XmlDoc = xmlDoc });
269269
}
270270
if (paramName == "fields" && p.Type == "list")

0 commit comments

Comments
 (0)