Skip to content

Commit 04ed38b

Browse files
russcamcodebrain
andauthored
Fix API generator (#4456)
This commit fixes the API generator and removes REST API specs ported from later version branches: 1. The collection of high level endpoints were being used in some of the low level generators 2. High level endpoints excluded need to be compared to the list by filename 3. Exclude new ML experimental APIs Co-authored-by: Stuart Cam <[email protected]>
1 parent 069445c commit 04ed38b

File tree

82 files changed

+492
-1683
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+492
-1683
lines changed

src/ApiGenerator/Configuration/CodeConfiguration.cs

+5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ public static class CodeConfiguration
1919
"indices.reload_search_analyzers.json",
2020
"rank_eval.json",
2121
"eql.search.json",
22+
"ml.delete_trained_model.json",
23+
"ml.get_trained_models.json",
24+
"ml.get_trained_models_stats.json",
25+
"ml.put_trained_model.json",
26+
"ml.explain_data_frame_analytics.json",
2227

2328
// Internal API,
2429
"monitoring.bulk.json",

src/ApiGenerator/Domain/RestApiSpec.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ public class RestApiSpec
2222

2323
public IDictionary<string, ApiEndpoint> Endpoints { get; set; }
2424

25-
public ImmutableSortedDictionary<string, ReadOnlyCollection<ApiEndpoint>> EndpointsPerNamespace =>
25+
public ImmutableSortedDictionary<string, ReadOnlyCollection<ApiEndpoint>> EndpointsPerNamespaceLowLevel =>
2626
Endpoints.Values.GroupBy(e=>e.CsharpNames.Namespace)
2727
.ToImmutableSortedDictionary(kv => kv.Key, kv => kv.ToList().AsReadOnly());
2828

2929
public ImmutableSortedDictionary<string, ReadOnlyCollection<ApiEndpoint>> EndpointsPerNamespaceHighLevel =>
3030
Endpoints.Values
31-
.Where(v => !CodeConfiguration.IgnoredApisHighLevel.Contains(v.Name))
31+
.Where(v => !CodeConfiguration.IgnoredApisHighLevel.Contains(v.FileName))
3232
.GroupBy(e => e.CsharpNames.Namespace)
3333
.ToImmutableSortedDictionary(kv => kv.Key, kv => kv.ToList().AsReadOnly());
3434

src/ApiGenerator/Generator/Razor/LowLevelClientImplementationGenerator.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public override async Task Generate(RestApiSpec spec, ProgressBar progressBar)
1717
var target = GeneratorLocations.LowLevel($"ElasticLowLevelClient.{CsharpNames.RootNamespace}.cs");
1818
await DoRazor(spec, view, target);
1919

20-
var namespaced = spec.EndpointsPerNamespaceHighLevel.Where(kv => kv.Key != CsharpNames.RootNamespace).ToList();
20+
var namespaced = spec.EndpointsPerNamespaceLowLevel.Where(kv => kv.Key != CsharpNames.RootNamespace).ToList();
2121
var namespacedView = ViewLocations.LowLevel("Client", "Implementation", "ElasticLowLevelClient.Namespace.cshtml");
2222
await DoRazorDependantFiles(progressBar, namespaced, namespacedView, kv => kv.Key,
2323
id => GeneratorLocations.LowLevel($"ElasticLowLevelClient.{id}.cs"));

src/ApiGenerator/Generator/Razor/RequestParametersGenerator.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public override async Task Generate(RestApiSpec spec, ProgressBar progressBar)
1515
var view = ViewLocations.LowLevel("RequestParameters", "RequestParameters.cshtml");
1616
string Target(string id) => GeneratorLocations.LowLevel("Api", "RequestParameters", $"RequestParameters.{id}.cs");
1717

18-
var namespaced = spec.EndpointsPerNamespaceHighLevel.ToList();
18+
var namespaced = spec.EndpointsPerNamespaceLowLevel.ToList();
1919
await DoRazorDependantFiles(progressBar, namespaced, view, kv => kv.Key, id => Target(id));
2020
}
2121
}

src/ApiGenerator/RestSpecification/Core/delete_by_query.json

+4
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@
4141
]
4242
},
4343
"params":{
44+
"analyzer": {
45+
"type" : "string",
46+
"description" : "The analyzer to use for the query string"
47+
},
4448
"analyze_wildcard": {
4549
"type" : "boolean",
4650
"description" : "Specify whether wildcard and prefix queries should be analyzed (default: false)"

src/ApiGenerator/RestSpecification/Core/msearch_template.json

+5
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@
7070
"type" : "boolean",
7171
"description" : "Indicates whether hits.total should be rendered as an integer or an object in the rest search response",
7272
"default" : false
73+
},
74+
"ccs_minimize_roundtrips": {
75+
"type" : "boolean",
76+
"description" : "Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution",
77+
"default" : "true"
7378
}
7479
},
7580
"body":{

src/ApiGenerator/RestSpecification/Core/root.html

+45-35
Large diffs are not rendered by default.

src/ApiGenerator/RestSpecification/Core/scripts_painless_context.json

-17
This file was deleted.

src/ApiGenerator/RestSpecification/Core/search_template.json

+5
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@
109109
"type":"boolean",
110110
"description":"Indicates whether hits.total should be rendered as an integer or an object in the rest search response",
111111
"default":false
112+
},
113+
"ccs_minimize_roundtrips": {
114+
"type" : "boolean",
115+
"description" : "Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution",
116+
"default" : "true"
112117
}
113118
},
114119
"body":{

src/ApiGenerator/RestSpecification/XPack/cat.ml.datafeeds.json

-72
This file was deleted.

src/ApiGenerator/RestSpecification/XPack/cat.ml.jobs.json

-89
This file was deleted.

src/ApiGenerator/RestSpecification/XPack/ccr.forget_follower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"ccr.forget_follower":{
33
"documentation":{
4-
"url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-forget-follower.html"
4+
"url":"http://www.elastic.co/guide/en/elasticsearch/reference/current"
55
},
66
"stability":"stable",
77
"url":{

src/ApiGenerator/RestSpecification/XPack/ccr.unfollow.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"ccr.unfollow":{
33
"documentation":{
4-
"url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-unfollow.html"
4+
"url":"http://www.elastic.co/guide/en/elasticsearch/reference/current"
55
},
66
"stability":"stable",
77
"url":{

src/ApiGenerator/RestSpecification/XPack/data_frame.delete_data_frame_transform.json

-31
This file was deleted.

src/ApiGenerator/RestSpecification/XPack/data_frame.get_data_frame_transform.json

-47
This file was deleted.

0 commit comments

Comments
 (0)