Skip to content

Commit d62e095

Browse files
committed
Fix compiler warnings
1 parent 4501da2 commit d62e095

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

src/CodeGeneration/ApiGenerator/Views/Enums.Generated.cshtml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,20 @@ namespace Elasticsearch.Net
103103
}
104104
<text> var list = new @(Raw("List<string>()"));
105105
</text>
106+
var g = GlobalOverrides.ObsoleteEnumMembers.TryGetValue(e.Name, out var d);
106107
foreach (var option in e.Options.Where(o => o != "_all"))
107108
{
108-
<text> if ((enumValue & @(e.Name).@(GetEnumValue(e.Name, option))) != 0) list.Add("@(option)");
109+
var value = GetEnumValue(e.Name, option);
110+
if (g && d.TryGetValue(option, out var obsolete)) {
111+
<text>#pragma warning disable 618
112+
if ((enumValue & @(e.Name).@(value)) != 0) list.Add("@(option)");
113+
#pragma warning restore 618
114+
</text>
115+
}
116+
else {
117+
<text> if ((enumValue & @(e.Name).@(value)) != 0) list.Add("@(option)");
109118
</text>
119+
}
110120
}
111121
<text> return string.Join(",", list);
112122
}</text>

src/Elasticsearch.Net/Domain/Enums.Generated.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,9 @@ public static string GetStringValue(this IndicesStatsMetric enumValue)
464464
if ((enumValue & IndicesStatsMetric.Segments) != 0) list.Add("segments");
465465
if ((enumValue & IndicesStatsMetric.Store) != 0) list.Add("store");
466466
if ((enumValue & IndicesStatsMetric.Warmer) != 0) list.Add("warmer");
467+
#pragma warning disable 618
467468
if ((enumValue & IndicesStatsMetric.Suggest) != 0) list.Add("suggest");
469+
#pragma warning restore 618
468470
return string.Join(",", list);
469471
}
470472
public static string GetStringValue(this NodesInfoMetric enumValue)
@@ -515,7 +517,9 @@ public static string GetStringValue(this NodesStatsIndexMetric enumValue)
515517
if ((enumValue & NodesStatsIndexMetric.Segments) != 0) list.Add("segments");
516518
if ((enumValue & NodesStatsIndexMetric.Store) != 0) list.Add("store");
517519
if ((enumValue & NodesStatsIndexMetric.Warmer) != 0) list.Add("warmer");
520+
#pragma warning disable 618
518521
if ((enumValue & NodesStatsIndexMetric.Suggest) != 0) list.Add("suggest");
522+
#pragma warning restore 618
519523
return string.Join(",", list);
520524
}
521525
public static string GetStringValue(this NodesUsageMetric enumValue)

src/Nest/Document/Multiple/BulkAll/BulkAllObservable.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ private async Task<IBulkAllResponse> BulkAsync(IList<T> buffer, long page, int b
107107
if (r.BufferToBulk != null) r.BufferToBulk(s, buffer);
108108
else s.IndexMany(buffer);
109109
if (!string.IsNullOrEmpty(r.Pipeline)) s.Pipeline(r.Pipeline);
110+
#pragma warning disable 618
110111
if (r.Refresh.HasValue) s.Refresh(r.Refresh.Value);
112+
#pragma warning restore 618
111113
if (r.Routing != null) s.Routing(r.Routing);
112114
if (r.WaitForActiveShards.HasValue) s.WaitForActiveShards(r.WaitForActiveShards.ToString());
113115

0 commit comments

Comments
 (0)