Skip to content

Commit afa9791

Browse files
authored
Feature/7.6/code gen (#4386)
* make provisions for unions (cherry picked from commit bdabdfc) * Low level code gen for 7.6 * move to 7.6-SNAPSHOT on our 7.6 branch * Apply suggestions from code review * make sure we generate https:// even if the source says http://
1 parent 98c6cf5 commit afa9791

File tree

76 files changed

+519
-578
lines changed

Some content is hidden

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

76 files changed

+519
-578
lines changed

src/ApiGenerator/Domain/Specification/Documentation.cs

+7-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,13 @@ namespace ApiGenerator.Domain.Specification
88
public class Documentation
99
{
1010
public string Description { get; set; }
11-
public string Url { get; set; }
11+
12+
private string _url;
13+
public string Url
14+
{
15+
get => _url;
16+
set => _url = value?.Replace("http://", "https://");
17+
}
1218
}
1319

1420
public class DocumentationConverter : JsonConverter

src/ApiGenerator/Domain/Specification/QueryParameters.cs

+10-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public class QueryParameters
1212
"fields", "_source_includes", "_source_excludes",
1313
};
1414

15+
1516
public bool Skip { get; set; }
1617

1718
public string ClsArgumentName => ClsName.ToCamelCase();
@@ -72,7 +73,15 @@ public IEnumerable<string> DescriptionHighLevel
7273

7374
public string SetterLowLevel => "value";
7475

75-
public string Type { get; set; }
76+
private string _type;
77+
public string Type
78+
{
79+
// TODO support unions
80+
get => !_type.Contains("|")
81+
? _type
82+
: _type.Split('|', StringSplitOptions.RemoveEmptyEntries).First().Trim();
83+
set => _type = value;
84+
}
7685

7786
public string TypeHighLevel
7887
{
@@ -127,7 +136,6 @@ public string TypeLowLevel
127136
}
128137
}
129138

130-
131139
public string InitializerGenerator(string @namespace, string type, string name, string key, string setter, params string[] doc) =>
132140
CodeGenerator.Property(@namespace, type, name, key, setter, Obsolete, doc);
133141
}

src/ApiGenerator/RestSpecification/Core/delete_by_query.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,9 @@
178178
"description": "The throttle for this request in sub-requests per second. -1 means no throttle."
179179
},
180180
"slices": {
181-
"type": "number|string",
181+
"type": "number",
182182
"default": 1,
183-
"description": "The number of slices this task should be divided into. Defaults to 1, meaning the task isn't sliced into subtasks. Can be set to `auto`."
183+
"description": "The number of slices this task should be divided into. Defaults to 1 meaning the task isn't sliced into subtasks."
184184
}
185185
},
186186
"body":{

src/ApiGenerator/RestSpecification/Core/root.html

+171-170
Large diffs are not rendered by default.

src/ApiGenerator/RestSpecification/XPack/enrich.delete_policy.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
{
22
"enrich.delete_policy": {
3-
"documentation": {
4-
"url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-enrich-policy-api.html"
5-
},
3+
"documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-delete-policy.html",
64
"stability" : "stable",
75
"url": {
86
"paths": [

src/ApiGenerator/RestSpecification/XPack/enrich.execute_policy.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
{
22
"enrich.execute_policy": {
3-
"documentation": {
4-
"url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/execute-enrich-policy-api.html"
5-
},
3+
"documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-execute-policy.html",
64
"stability" : "stable",
75
"url": {
86
"paths": [

src/ApiGenerator/RestSpecification/XPack/enrich.get_policy.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
{
22
"enrich.get_policy": {
3-
"documentation": {
4-
"url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/get-enrich-policy-api.html"
5-
},
3+
"documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-get-policy.html",
64
"stability" : "stable",
75
"url": {
86
"paths": [

src/ApiGenerator/RestSpecification/XPack/enrich.put_policy.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
{
22
"enrich.put_policy": {
3-
"documentation": {
4-
"url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/put-enrich-policy-api.html"
5-
},
3+
"documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-put-policy.html",
64
"stability" : "stable",
75
"url": {
86
"paths": [

src/ApiGenerator/RestSpecification/XPack/enrich.stats.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
{
22
"enrich.stats": {
3-
"documentation": {
4-
"url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-stats-api.html"
5-
},
3+
"documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-stats.html",
64
"stability" : "stable",
75
"url": {
86
"paths": [

src/ApiGenerator/RestSpecification/XPack/migration.deprecations.json

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

src/ApiGenerator/RestSpecification/XPack/ml.close_job.json

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

src/ApiGenerator/RestSpecification/XPack/ml.delete_data_frame_analytics.json

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

src/ApiGenerator/RestSpecification/XPack/ml.delete_datafeed.json

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

src/ApiGenerator/RestSpecification/XPack/ml.delete_forecast.json

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

src/ApiGenerator/RestSpecification/XPack/ml.delete_job.json

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

src/ApiGenerator/RestSpecification/XPack/ml.delete_model_snapshot.json

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

src/ApiGenerator/RestSpecification/XPack/ml.evaluate_data_frame.json

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

src/ApiGenerator/RestSpecification/XPack/ml.find_file_structure.json

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

src/ApiGenerator/RestSpecification/XPack/ml.flush_job.json

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

src/ApiGenerator/RestSpecification/XPack/ml.get_buckets.json

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

src/ApiGenerator/RestSpecification/XPack/ml.get_categories.json

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

src/ApiGenerator/RestSpecification/XPack/ml.get_data_frame_analytics.json

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

src/ApiGenerator/RestSpecification/XPack/ml.get_data_frame_analytics_stats.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"ml.get_data_frame_analytics_stats":{
33
"documentation":{
4-
"url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/get-dfanalytics-stats.html"
4+
"url":"http://www.elastic.co/guide/en/elasticsearch/reference/current/get-dfanalytics-stats.html"
55
},
66
"stability":"experimental",
77
"url":{

src/ApiGenerator/RestSpecification/XPack/ml.get_datafeed_stats.json

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

src/ApiGenerator/RestSpecification/XPack/ml.get_datafeeds.json

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

src/ApiGenerator/RestSpecification/XPack/ml.get_influencers.json

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

src/ApiGenerator/RestSpecification/XPack/ml.get_job_stats.json

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

src/ApiGenerator/RestSpecification/XPack/ml.get_jobs.json

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

src/ApiGenerator/RestSpecification/XPack/ml.get_model_snapshots.json

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

src/ApiGenerator/RestSpecification/XPack/ml.get_overall_buckets.json

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

src/ApiGenerator/RestSpecification/XPack/ml.get_records.json

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

src/ApiGenerator/RestSpecification/XPack/ml.get_trained_models.json

-7
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,14 @@
4646
"description": "Should the model definition be decompressed into valid JSON or returned in a custom compressed format. Defaults to true."
4747
},
4848
"from":{
49-
"required": false,
5049
"type":"int",
5150
"description":"skips a number of trained models",
5251
"default":0
5352
},
5453
"size":{
55-
"required": false,
5654
"type":"int",
5755
"description":"specifies a max number of trained models to get",
5856
"default":100
59-
},
60-
"tags": {
61-
"required": false,
62-
"type":"list",
63-
"description":"A comma-separated list of tags that the model must have."
6457
}
6558
}
6659
}

src/ApiGenerator/RestSpecification/XPack/ml.open_job.json

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

src/ApiGenerator/RestSpecification/XPack/ml.post_data.json

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

src/ApiGenerator/RestSpecification/XPack/ml.preview_datafeed.json

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

src/ApiGenerator/RestSpecification/XPack/ml.put_data_frame_analytics.json

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

src/ApiGenerator/RestSpecification/XPack/ml.put_datafeed.json

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

src/ApiGenerator/RestSpecification/XPack/ml.put_job.json

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

src/ApiGenerator/RestSpecification/XPack/ml.revert_model_snapshot.json

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

0 commit comments

Comments
 (0)