Skip to content

Commit ac089d6

Browse files
committed
Merge branch 'enhancement/2.x-update-by-query' into 2.x
2 parents b9ac63a + 4719fe5 commit ac089d6

File tree

7 files changed

+11210
-11172
lines changed

7 files changed

+11210
-11172
lines changed

src/CodeGeneration/ApiGenerator/Domain/CsharpMethod.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,17 @@ public IEnumerable<Constructor> DescriptorConstructors()
191191
{
192192
doc += "\r\n" + string.Join("\t\t\r\n", cp.Select(p => $"///<param name=\"{p.Key}\"> this parameter is required</param>"));
193193
}
194-
var c = new Constructor { Generated = $"public {m}({par}) : base({routing}){{}}", Description = doc };
194+
195+
var generated = $"public {m}({par}) : base({routing}){{}}";
196+
197+
// Add typeof(T) as the default type when only index specified
198+
if ((m == "UpdateByQueryDescriptor") && cp.Count() == 1 && !string.IsNullOrEmpty(this.RequestTypeGeneric))
199+
{
200+
var generic = this.RequestTypeGeneric.Replace("<", "").Replace(">", "");
201+
generated = $"public {m}({par}) : base({routing}.Required(\"type\", (Types)typeof({generic}))){{}}";
202+
}
203+
204+
var c = new Constructor { Generated = generated, Description = doc };
195205
ctors.Add(c);
196206
}
197207
if (IsDocumentPath && !string.IsNullOrEmpty(this.DescriptorTypeGeneric))

0 commit comments

Comments
 (0)