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

Lines changed: 7 additions & 1 deletion
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

Lines changed: 10 additions & 2 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 171 additions & 170 deletions
Large diffs are not rendered by default.

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

Lines changed: 1 addition & 3 deletions
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

Lines changed: 1 addition & 3 deletions
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

Lines changed: 1 addition & 3 deletions
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

Lines changed: 1 addition & 3 deletions
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

Lines changed: 1 addition & 3 deletions
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

Lines changed: 1 addition & 1 deletion
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":{

0 commit comments

Comments
 (0)