Skip to content

Commit bdabdfc

Browse files
committed
make provisions for unions
1 parent 3d7a34d commit bdabdfc

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

src/ApiGenerator/Domain/Specification/QueryParameters.cs

+11-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ public class QueryParameters
1111
{
1212
"fields", "_source_includes", "_source_excludes",
1313
};
14-
14+
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/Elasticsearch.Net/Api/RequestParameters/RequestParameters.NoNamespace.cs

+6-6
Original file line numberDiff line numberDiff line change
@@ -494,9 +494,9 @@ public SearchType? SearchType
494494
}
495495

496496
///<summary>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`.</summary>
497-
public number |string Slices
497+
public long? Slices
498498
{
499-
get => Q < number | string > ("slices");
499+
get => Q<long? >("slices");
500500
set => Q("slices", value);
501501
}
502502

@@ -1471,9 +1471,9 @@ public TimeSpan Scroll
14711471
}
14721472

14731473
///<summary>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`.</summary>
1474-
public number |string Slices
1474+
public long? Slices
14751475
{
1476-
get => Q < number | string > ("slices");
1476+
get => Q<long? >("slices");
14771477
set => Q("slices", value);
14781478
}
14791479

@@ -2259,9 +2259,9 @@ public SearchType? SearchType
22592259
}
22602260

22612261
///<summary>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`.</summary>
2262-
public number |string Slices
2262+
public long? Slices
22632263
{
2264-
get => Q < number | string > ("slices");
2264+
get => Q<long? >("slices");
22652265
set => Q("slices", value);
22662266
}
22672267

0 commit comments

Comments
 (0)