Skip to content

Commit b7b0b80

Browse files
authored
Update API REST specs to 7.2.0 (#3979)
* Update REST specs to 7.2.0 * Update ApiGenerator - Add stability field - Exclude new APIs - Add XML comments for Beta / Experimental stability
1 parent 827aa6b commit b7b0b80

File tree

337 files changed

+3653
-5987
lines changed

Some content is hidden

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

337 files changed

+3653
-5987
lines changed

src/CodeGeneration/ApiGenerator/Configuration/CodeConfiguration.cs

+9
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@ public static class CodeConfiguration
1717

1818
// these APIs are not ready for primetime yet
1919
"rank_eval.json",
20+
"data_frame.delete_data_frame_transform.json",
21+
"data_frame.get_data_frame_transform.json",
22+
"data_frame.get_data_frame_transform_stats.json",
23+
"data_frame.preview_data_frame_transform.json",
24+
"data_frame.put_data_frame_transform.json",
25+
"data_frame.start_data_frame_transform.json",
26+
"data_frame.stop_data_frame_transform.json",
27+
28+
"scripts_painless_context.json",
2029

2130
// these APIs are new and need to be mapped
2231
"ml.set_upgrade_mode.json",

src/CodeGeneration/ApiGenerator/Domain/Code/HighLevel/Requests/RequestPartialImplementation.cs

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
using ApiGenerator.Configuration;
33
using ApiGenerator.Domain.Specification;
44

5-
namespace ApiGenerator.Domain.Code.HighLevel.Requests
5+
namespace ApiGenerator.Domain.Code.HighLevel.Requests
66
{
77
public class RequestPartialImplementation
88
{
99
public CsharpNames CsharpNames { get; set; }
1010
public string OfficialDocumentationLink { get; set; }
11+
public Stability Stability { get; set; }
1112
public IReadOnlyCollection<UrlPart> Parts { get; set; }
1213
public IReadOnlyCollection<UrlPath> Paths { get; set; }
1314
public IReadOnlyCollection<QueryParameters> Params { get; set; }
@@ -20,7 +21,7 @@ public class RequestPartialImplementation
2021
public bool NeedsGenericImplementation => !GenerateOnlyGenericInterface && !string.IsNullOrWhiteSpace(CsharpNames.GenericsDeclaredOnRequest);
2122

2223
public string Name => CsharpNames.GenericOrNonGenericRequestPreference;
23-
24+
2425
public string InterfaceName => CsharpNames.GenericOrNonGenericInterfacePreference;
2526
}
26-
}
27+
}

src/CodeGeneration/ApiGenerator/Domain/Code/LowLevel/LowLevelClientMethod.cs

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ public class LowLevelClientMethod
1111

1212
public string Arguments { get; set; }
1313
public string OfficialDocumentationLink { get; set; }
14+
15+
public Stability Stability { get; set; }
1416
public string PerPathMethodName { get; set; }
1517
public string HttpMethod { get; set; }
1618

src/CodeGeneration/ApiGenerator/Domain/Specification/ApiEndpoint.cs

+23-16
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,41 @@
66
using ApiGenerator.Domain.Code.HighLevel.Requests;
77
using ApiGenerator.Domain.Code.LowLevel;
88
using Newtonsoft.Json;
9+
using Newtonsoft.Json.Converters;
910

1011
namespace ApiGenerator.Domain.Specification
1112
{
1213
public class ApiEndpoint
1314
{
1415
/// <summary> The filename of the spec describing the api endpoint </summary>
1516
public string FileName { get; set; }
16-
17+
1718
/// <summary> The original name as declared in the spec </summary>
1819
public string Name { get; set; }
19-
20+
2021
/// <summary> The original namespace as declared in the spec </summary>
2122
public string Namespace { get; set; }
22-
23+
2324
/// <summary> The original method name as declared in the spec </summary>
2425
public string MethodName { get; set; }
25-
26+
2627
/// <summary> Computed Csharp identifier names </summary>
27-
public CsharpNames CsharpNames { get; set; }
28-
28+
public CsharpNames CsharpNames { get; set; }
29+
30+
[JsonConverter(typeof(StringEnumConverter))]
31+
[JsonProperty("stability")]
32+
public Stability Stability { get; set; }
33+
2934
[JsonProperty("documentation")]
3035
public string OfficialDocumentationLink { get; set; }
31-
36+
3237
public UrlInformation Url { get; set; }
33-
38+
3439
public Body Body { get; set; }
3540

3641
[JsonProperty("methods")]
3742
public IReadOnlyCollection<string> HttpMethods { get; set; }
38-
43+
3944
public IEndpointOverrides Overrides { get; internal set; }
4045

4146
public RequestInterface RequestInterface => new RequestInterface
@@ -45,30 +50,31 @@ public class ApiEndpoint
4550
PartialParameters = Body == null ? Enumerable.Empty<QueryParameters>().ToList() : Url.Params.Values.Where(p=>p.RenderPartial && !p.Skip).ToList(),
4651
OfficialDocumentationLink = OfficialDocumentationLink
4752
};
48-
53+
4954
public RequestPartialImplementation RequestPartialImplementation => new RequestPartialImplementation
5055
{
5156
CsharpNames = CsharpNames,
5257
OfficialDocumentationLink = OfficialDocumentationLink,
58+
Stability = Stability,
5359
Paths = Url.Paths,
5460
Parts = Url.Parts,
5561
Params = Url.Params.Values.Where(p=>!p.Skip).ToList(),
5662
Constructors = Constructor.RequestConstructors(CsharpNames, Url, inheritsFromPlainRequestBase: true).ToList(),
5763
GenericConstructors = Constructor.RequestConstructors(CsharpNames, Url, inheritsFromPlainRequestBase: false).ToList(),
5864
HasBody = Body != null,
5965
};
60-
66+
6167
public DescriptorPartialImplementation DescriptorPartialImplementation => new DescriptorPartialImplementation
6268
{
63-
CsharpNames = CsharpNames,
69+
CsharpNames = CsharpNames,
6470
OfficialDocumentationLink = OfficialDocumentationLink,
6571
Constructors = Constructor.DescriptorConstructors(CsharpNames, Url).ToList(),
6672
Paths = Url.Paths,
6773
Parts = Url.Parts,
6874
Params = Url.Params.Values.Where(p=>!p.Skip).ToList(),
6975
HasBody = Body != null,
7076
};
71-
77+
7278
public RequestParameterImplementation RequestParameterImplementation => new RequestParameterImplementation
7379
{
7480
CsharpNames = CsharpNames,
@@ -89,7 +95,7 @@ public string PreferredHttpMethod
8995
}
9096

9197
public string HighLevelMethodXmlDocDescription => $"<c>{PreferredHttpMethod}</c> request to the <c>{Name}</c> API, read more about this API online:";
92-
98+
9399
public HighLevelModel HighLevelModel => new HighLevelModel
94100
{
95101
CsharpNames = CsharpNames,
@@ -132,15 +138,16 @@ public IReadOnlyCollection<LowLevelClientMethod> LowLevelClientMethods
132138
.Select(p => p.Argument)
133139
.Concat(new[] { CsharpNames.ParametersName + " requestParameters = null" })
134140
.ToList();
135-
141+
136142
var apiMethod = new LowLevelClientMethod
137143
{
138144
Arguments = string.Join(", ", args),
139145
CsharpNames = CsharpNames,
140146
PerPathMethodName = methodName,
141147
HttpMethod = httpMethod,
142148
OfficialDocumentationLink = OfficialDocumentationLink,
143-
DeprecatedPath = path.Deprecation,
149+
Stability = Stability,
150+
DeprecatedPath = path.Deprecation,
144151
Path = path.Path,
145152
Parts = parts,
146153
Url = Url,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using System.Runtime.Serialization;
2+
3+
namespace ApiGenerator.Domain.Specification
4+
{
5+
public enum Stability
6+
{
7+
/// <summary>
8+
/// Highly likely to break in the near future (minor/path), no BWC guarantees. Possibly removed in the future.
9+
/// </summary>
10+
[EnumMember(Value = "experimental")]
11+
Experimental,
12+
13+
/// <summary>
14+
/// Less likely to break or be removed but still reserve the right to do so.
15+
/// </summary>
16+
[EnumMember(Value = "beta")]
17+
Beta,
18+
19+
/// <summary>
20+
/// No backwards breaking changes in a minor.
21+
/// </summary>
22+
[EnumMember(Value = "stable")]
23+
Stable
24+
}
25+
}

src/CodeGeneration/ApiGenerator/Generator/ApiGenerator.cs

+9-3
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ public static async Task Generate(string downloadBranch, params string[] folders
4848
}
4949
}
5050

51+
// Check if there are any non-Stable endpoints present.
52+
foreach (var endpoint in spec.Endpoints)
53+
{
54+
if (endpoint.Value.Stability != Stability.Stable)
55+
{
56+
Warnings.Add($"Endpoint {endpoint.Value.Name} is not marked as Stable ({endpoint.Value.Stability})");
57+
}
58+
}
59+
5160
if (Warnings.Count == 0) return;
5261

5362
Console.ForegroundColor = ConsoleColor.Yellow;
@@ -106,7 +115,6 @@ private static RestApiSpec CreateRestApiSpecModel(string downloadBranch, string[
106115
var isIgnored = CodeConfiguration.IgnoredApis.Contains($"{value}.json");
107116
if (isIgnored) Warnings.Add($"{value} uses MapsApi: {key} ignored in ${nameof(CodeConfiguration)}.{nameof(CodeConfiguration.IgnoredApis)}");
108117
else Warnings.Add($"{value} uses MapsApi: {key} which does not exist");
109-
110118
}
111119

112120
return new RestApiSpec { Endpoints = endpoints, Commit = downloadBranch };
@@ -119,7 +127,5 @@ private static SortedDictionary<string, QueryParameters> CreateCommonApiQueryPar
119127
var commonParameters = jobject.Property("params").Value.ToObject<Dictionary<string, QueryParameters>>();
120128
return ApiQueryParametersPatcher.Patch(null, commonParameters, null, false);
121129
}
122-
123-
124130
}
125131
}

src/CodeGeneration/ApiGenerator/Generator/CodeGenerator.cs

-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ void A(string s)
4444
}
4545
}
4646

47-
4847
private static IEnumerable<string> RenderDocumentation(params string[] doc)
4948
{
5049
doc = (doc?.SelectMany(WrapDocumentation) ?? Enumerable.Empty<string>()).ToArray();

src/CodeGeneration/ApiGenerator/RestSpecification/Core/bulk.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"bulk": {
33
"documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-bulk.html",
4+
"stability": "stable",
45
"methods": ["POST", "PUT"],
56
"url": {
6-
"path": "/_bulk",
77
"paths": ["/_bulk", "/{index}/_bulk", "/{index}/{type}/_bulk"],
88
"parts": {
99
"index": {

src/CodeGeneration/ApiGenerator/RestSpecification/Core/cat.aliases.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"cat.aliases": {
33
"documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-alias.html",
4+
"stability": "stable",
45
"methods": ["GET"],
56
"url": {
6-
"path": "/_cat/aliases",
77
"paths": ["/_cat/aliases", "/_cat/aliases/{name}"],
88
"parts": {
99
"name": {

src/CodeGeneration/ApiGenerator/RestSpecification/Core/cat.allocation.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"cat.allocation": {
33
"documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-allocation.html",
4+
"stability": "stable",
45
"methods": ["GET"],
56
"url": {
6-
"path": "/_cat/allocation",
77
"paths": ["/_cat/allocation", "/_cat/allocation/{node_id}"],
88
"parts": {
99
"node_id": {

src/CodeGeneration/ApiGenerator/RestSpecification/Core/cat.count.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"cat.count": {
33
"documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-count.html",
4+
"stability": "stable",
45
"methods": ["GET"],
56
"url": {
6-
"path": "/_cat/count",
77
"paths": ["/_cat/count", "/_cat/count/{index}"],
88
"parts": {
99
"index": {

src/CodeGeneration/ApiGenerator/RestSpecification/Core/cat.fielddata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"cat.fielddata": {
33
"documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-fielddata.html",
4+
"stability": "stable",
45
"methods": ["GET"],
56
"url": {
6-
"path": "/_cat/fielddata",
77
"paths": ["/_cat/fielddata", "/_cat/fielddata/{fields}"],
88
"parts": {
99
"fields": {

src/CodeGeneration/ApiGenerator/RestSpecification/Core/cat.health.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"cat.health": {
33
"documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-health.html",
4+
"stability": "stable",
45
"methods": ["GET"],
56
"url": {
6-
"path": "/_cat/health",
77
"paths": ["/_cat/health"],
88
"parts": {
99
},

src/CodeGeneration/ApiGenerator/RestSpecification/Core/cat.help.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"cat.help": {
33
"documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/cat.html",
4+
"stability": "stable",
45
"methods": ["GET"],
56
"url": {
6-
"path": "/_cat",
77
"paths": ["/_cat"],
88
"parts": {
99
},

src/CodeGeneration/ApiGenerator/RestSpecification/Core/cat.indices.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"cat.indices": {
33
"documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-indices.html",
4+
"stability": "stable",
45
"methods": ["GET"],
56
"url": {
6-
"path": "/_cat/indices",
77
"paths": ["/_cat/indices", "/_cat/indices/{index}"],
88
"parts": {
99
"index": {
@@ -57,6 +57,11 @@
5757
"type": "boolean",
5858
"description": "Verbose mode. Display column headers",
5959
"default": false
60+
},
61+
"include_unloaded_segments": {
62+
"type": "boolean",
63+
"description": "If set to true segment stats will include stats for segments that are not currently loaded into memory",
64+
"default": false
6065
}
6166
}
6267
},

src/CodeGeneration/ApiGenerator/RestSpecification/Core/cat.master.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"cat.master": {
33
"documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-master.html",
4+
"stability": "stable",
45
"methods": ["GET"],
56
"url": {
6-
"path": "/_cat/master",
77
"paths": ["/_cat/master"],
88
"parts": {
99
},

src/CodeGeneration/ApiGenerator/RestSpecification/Core/cat.nodeattrs.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"cat.nodeattrs": {
33
"documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-nodeattrs.html",
4+
"stability": "stable",
45
"methods": ["GET"],
56
"url": {
6-
"path": "/_cat/nodeattrs",
77
"paths": ["/_cat/nodeattrs"],
88
"parts": {
99
},

src/CodeGeneration/ApiGenerator/RestSpecification/Core/cat.nodes.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"cat.nodes": {
33
"documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-nodes.html",
4+
"stability": "stable",
45
"methods": ["GET"],
56
"url": {
6-
"path": "/_cat/nodes",
77
"paths": ["/_cat/nodes"],
88
"parts": {
99
},

src/CodeGeneration/ApiGenerator/RestSpecification/Core/cat.pending_tasks.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"cat.pending_tasks": {
33
"documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-pending-tasks.html",
4+
"stability": "stable",
45
"methods": ["GET"],
56
"url": {
6-
"path": "/_cat/pending_tasks",
77
"paths": ["/_cat/pending_tasks"],
88
"parts": {
99
},

src/CodeGeneration/ApiGenerator/RestSpecification/Core/cat.plugins.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"cat.plugins": {
33
"documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-plugins.html",
4+
"stability": "stable",
45
"methods": ["GET"],
56
"url": {
6-
"path": "/_cat/plugins",
77
"paths": ["/_cat/plugins"],
88
"params": {
99
"format": {

src/CodeGeneration/ApiGenerator/RestSpecification/Core/cat.recovery.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"cat.recovery": {
33
"documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-recovery.html",
4+
"stability": "stable",
45
"methods": ["GET"],
56
"url": {
6-
"path": "/_cat/recovery",
77
"paths": ["/_cat/recovery", "/_cat/recovery/{index}"],
88
"parts": {
99
"index": {

0 commit comments

Comments
 (0)