Skip to content

Commit 81c7a62

Browse files
committed
client generation
1 parent 3bd946f commit 81c7a62

File tree

6 files changed

+394
-339
lines changed

6 files changed

+394
-339
lines changed

build/generate-raw-client/Views/IRawElasticClient.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ namespace Nest
3333
{
3434
<text>@Raw("///<param name=\""+part.Name+"\">")@part.Description@Raw("</param>")</text>
3535
}
36-
@Raw(method.ReturnType) @(method.FullName)(@method.Arguments);
36+
@Raw(method.ReturnType) @(method.FullName)(@Raw(method.Arguments));
3737
</text>
3838
}
3939
}

build/generate-raw-client/api.csx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ public class ApiEndpoint {
3030
return Extensions.DistinctBy(this.CsharpMethods.ToList(), m=> m.ReturnType + "--" + m.FullName + "--" + m.Arguments);
3131
}
3232

33+
public IDictionary<string>
34+
3335
public IEnumerable<CsharpMethod> CsharpMethods {
3436
get
3537
{
@@ -120,6 +122,7 @@ public class CsharpMethod {
120122
public string Path { get; set; }
121123
public string Arguments { get; set; }
122124
public IEnumerable<ApiUrlPart> Parts { get; set; }
125+
public ApiUrl Url { get; set; }
123126
}
124127
public class ApiBody {
125128
public string Description { get; set; }
@@ -147,8 +150,10 @@ public static class ApiGenerator
147150
{
148151
private readonly static string _listingUrl = "https://github.com/elasticsearch/elasticsearch-rest-api-spec/tree/master/api";
149152
private readonly static string _rawUrlPrefix = "https://raw.github.com/elasticsearch/elasticsearch-rest-api-spec/master/api/";
153+
private readonly static string _nestFolder = @"..\..\src\Nest\";
150154
private readonly static RazorMachine _razorMachine = new RazorMachine();
151155

156+
152157
static ApiGenerator() {
153158
}
154159
public static string PascalCase(string s)
@@ -216,14 +221,14 @@ public static class ApiGenerator
216221

217222
public static void GenerateClientInterface(RestApiSpec model)
218223
{
219-
var targetFile = @"..\Nest\IRawElasticClient.cs";
224+
var targetFile =_nestFolder + @"IRawElasticClient.cs";
220225
var source = _razorMachine.Execute(File.ReadAllText(@"Views\IRawElasticClient.cshtml"), model).ToString();
221226
File.WriteAllText(targetFile, source);
222227
}
223228

224229
public static void GenerateQueryStringParameters(RestApiSpec model)
225230
{
226-
var targetFile = @"..\Nest\QueryStringParameters\GeneratedQueryStringParameters.cs";
231+
var targetFile = _nestFolder + @"QueryStringParameters\GeneratedQueryStringParameters.cs";
227232
var source = _razorMachine.Execute(File.ReadAllText(@"Views\GeneratedQueryStringParameters.cshtml"), model).ToString();
228233
File.WriteAllText(targetFile, source);
229234
}

0 commit comments

Comments
 (0)