Skip to content

Commit 00ad035

Browse files
authored
Seal union types for consistency (#7016)
* Seal union types for consistency * Update release notes
1 parent 8b712cf commit 00ad035

20 files changed

+57
-22
lines changed

docs/release-notes/release-notes-8.0.1.asciidoc

+38-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,14 @@
44
[discrete]
55
=== Bug fixes
66

7-
- Fix MultiSearchTemplateRequest serialization (issue:
7+
- Fix MultiSearchTemplateRequest body serialization (issue:
88
https://github.com/elastic/elasticsearch-net/issues/7006[#7006])
99

10+
[discrete]
11+
=== Enhancements
12+
13+
- Seal union types for consistency
14+
1015
[discrete]
1116
=== Breaking changes
1217

@@ -28,9 +33,39 @@ original code-generated type not functioning correctly and therefore we have
2833
determined that this should ship ASAP.
2934

3035
[discrete]
31-
=== MultiSearch type changes
36+
==== MultiSearch type changes
3237

3338
The `Core.MSearch.SearchRequestItem` type has been sealed for consistency with
3439
the design choices in the rest of the client. While technically breaking, we
3540
have decided that this should be included in this release before any potential
36-
derived types may exist in consuming applications.
41+
derived types may exist in consuming applications.
42+
43+
[discrete]
44+
==== Sealing union types
45+
46+
Code-generated types derived from `Union<T1, T2>` where incorrectly unsealed.
47+
While technically breaking, we have decided that these should be sealed in this
48+
patch release before any potential derived types may exist in consuming
49+
applications. Sealing types by default aligns with our broader design choices
50+
and this decision is described in the <<release-notes-8.0.0,8.0.0 release notes>>.
51+
52+
Affected types:
53+
- `Aggregations.Buckets`
54+
- `Aggregations.FieldDateMatch`
55+
- `Aggregations.Percentiles`
56+
- `Analysis.CharFilter`
57+
- `Analysis.TokenFilter`
58+
- `Analysis.Tokenizer`
59+
- `ByteSize`
60+
- `Fuzziness`
61+
- `GeoHashPrecision`
62+
- `MultiGetResponseItem`
63+
- `MultiSearchResponseItem`
64+
- `QueryDsl.Like`
65+
- `QueryDsl.TermsQueryField`
66+
- `Script`
67+
- `Slices`
68+
- `SourceConfig`
69+
- `SourceConfigParam`
70+
- `Tasks.TaskInfos`
71+
- `TrackHits`

src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/Buckets.g.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
#nullable restore
2828
namespace Elastic.Clients.Elasticsearch.Aggregations;
29-
public partial class Buckets<TBucket> : Union<Dictionary<string, TBucket>, IReadOnlyCollection<TBucket>>
29+
public sealed partial class Buckets<TBucket> : Union<Dictionary<string, TBucket>, IReadOnlyCollection<TBucket>>
3030
{
3131
public Buckets(Dictionary<string, TBucket> dictionary) : base(dictionary)
3232
{

src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/FieldDateMath.g.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
#nullable restore
2828
namespace Elastic.Clients.Elasticsearch.Aggregations;
29-
public partial class FieldDateMath : Union<Elastic.Clients.Elasticsearch.DateMath, double>
29+
public sealed partial class FieldDateMath : Union<Elastic.Clients.Elasticsearch.DateMath, double>
3030
{
3131
public FieldDateMath(Elastic.Clients.Elasticsearch.DateMath expr) : base(expr)
3232
{

src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/Percentiles.g.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
#nullable restore
2828
namespace Elastic.Clients.Elasticsearch.Aggregations;
29-
public partial class Percentiles : Union<Dictionary<string, object>, IReadOnlyCollection<Elastic.Clients.Elasticsearch.Aggregations.ArrayPercentilesItem>>
29+
public sealed partial class Percentiles : Union<Dictionary<string, object>, IReadOnlyCollection<Elastic.Clients.Elasticsearch.Aggregations.ArrayPercentilesItem>>
3030
{
3131
public Percentiles(Dictionary<string, object> dictionary) : base(dictionary)
3232
{

src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/CharFilter.g.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
#nullable restore
2828
namespace Elastic.Clients.Elasticsearch.Analysis;
29-
public partial class CharFilter : Union<string, Elastic.Clients.Elasticsearch.Analysis.CharFilterDefinitions>
29+
public sealed partial class CharFilter : Union<string, Elastic.Clients.Elasticsearch.Analysis.CharFilterDefinitions>
3030
{
3131
public CharFilter(string name) : base(name)
3232
{

src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/TokenFilter.g.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
#nullable restore
2828
namespace Elastic.Clients.Elasticsearch.Analysis;
29-
public partial class TokenFilter : Union<string, Elastic.Clients.Elasticsearch.Analysis.TokenFilterDefinitions>
29+
public sealed partial class TokenFilter : Union<string, Elastic.Clients.Elasticsearch.Analysis.TokenFilterDefinitions>
3030
{
3131
public TokenFilter(string name) : base(name)
3232
{

src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/Tokenizer.g.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
#nullable restore
2828
namespace Elastic.Clients.Elasticsearch.Analysis;
29-
public partial class Tokenizer : Union<string, Elastic.Clients.Elasticsearch.Analysis.TokenizerDefinitions>
29+
public sealed partial class Tokenizer : Union<string, Elastic.Clients.Elasticsearch.Analysis.TokenizerDefinitions>
3030
{
3131
public Tokenizer(string name) : base(name)
3232
{

src/Elastic.Clients.Elasticsearch/_Generated/Types/ByteSize.g.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
#nullable restore
2828
namespace Elastic.Clients.Elasticsearch;
29-
public partial class ByteSize : Union<long, string>
29+
public sealed partial class ByteSize : Union<long, string>
3030
{
3131
public ByteSize(long byteSize) : base(byteSize)
3232
{

src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/MultiGetResponseItem.g.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
#nullable restore
2828
namespace Elastic.Clients.Elasticsearch.Core.MGet;
29-
public partial class MultiGetResponseItem<TDocument> : Union<Elastic.Clients.Elasticsearch.Core.Get.GetResult<TDocument>, Elastic.Clients.Elasticsearch.Core.MGet.MultiGetError>
29+
public sealed partial class MultiGetResponseItem<TDocument> : Union<Elastic.Clients.Elasticsearch.Core.Get.GetResult<TDocument>, Elastic.Clients.Elasticsearch.Core.MGet.MultiGetError>
3030
{
3131
public MultiGetResponseItem(Elastic.Clients.Elasticsearch.Core.Get.GetResult<TDocument> result) : base(result)
3232
{

src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/MultiSearchResponseItem.g.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
#nullable restore
2828
namespace Elastic.Clients.Elasticsearch.Core.MSearch;
29-
public partial class MultiSearchResponseItem<TDocument> : Union<Elastic.Clients.Elasticsearch.Core.MSearch.MultiSearchItem<TDocument>, Elastic.Clients.Elasticsearch.ErrorResponseBase>
29+
public sealed partial class MultiSearchResponseItem<TDocument> : Union<Elastic.Clients.Elasticsearch.Core.MSearch.MultiSearchItem<TDocument>, Elastic.Clients.Elasticsearch.ErrorResponseBase>
3030
{
3131
public MultiSearchResponseItem(Elastic.Clients.Elasticsearch.Core.MSearch.MultiSearchItem<TDocument> result) : base(result)
3232
{

src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/SourceConfig.g.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
#nullable restore
2828
namespace Elastic.Clients.Elasticsearch.Core.Search;
29-
public partial class SourceConfig : Union<bool, Elastic.Clients.Elasticsearch.Core.Search.SourceFilter>
29+
public sealed partial class SourceConfig : Union<bool, Elastic.Clients.Elasticsearch.Core.Search.SourceFilter>
3030
{
3131
public SourceConfig(bool fetch) : base(fetch)
3232
{

src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/SourceConfigParam.g.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
#nullable restore
2828
namespace Elastic.Clients.Elasticsearch.Core.Search;
29-
public partial class SourceConfigParam : Union<bool, Elastic.Clients.Elasticsearch.Fields>
29+
public sealed partial class SourceConfigParam : Union<bool, Elastic.Clients.Elasticsearch.Fields>
3030
{
3131
public SourceConfigParam(bool fetch) : base(fetch)
3232
{

src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/TrackHits.g.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
#nullable restore
2828
namespace Elastic.Clients.Elasticsearch.Core.Search;
29-
public partial class TrackHits : Union<bool, int>
29+
public sealed partial class TrackHits : Union<bool, int>
3030
{
3131
public TrackHits(bool enabled) : base(enabled)
3232
{

src/Elastic.Clients.Elasticsearch/_Generated/Types/Fuzziness.g.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
#nullable restore
2828
namespace Elastic.Clients.Elasticsearch;
29-
public partial class Fuzziness : Union<string, int>
29+
public sealed partial class Fuzziness : Union<string, int>
3030
{
3131
public Fuzziness(string fuzziness) : base(fuzziness)
3232
{

src/Elastic.Clients.Elasticsearch/_Generated/Types/GeoHashPrecision.g.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
#nullable restore
2828
namespace Elastic.Clients.Elasticsearch;
29-
public partial class GeoHashPrecision : Union<double, string>
29+
public sealed partial class GeoHashPrecision : Union<double, string>
3030
{
3131
public GeoHashPrecision(double geohash_length) : base(geohash_length)
3232
{

src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/Like.g.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
#nullable restore
2828
namespace Elastic.Clients.Elasticsearch.QueryDsl;
29-
public partial class Like : Union<string, Elastic.Clients.Elasticsearch.QueryDsl.LikeDocument>
29+
public sealed partial class Like : Union<string, Elastic.Clients.Elasticsearch.QueryDsl.LikeDocument>
3030
{
3131
public Like(string text) : base(text)
3232
{

src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermsQueryField.g.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
#nullable restore
2828
namespace Elastic.Clients.Elasticsearch.QueryDsl;
29-
public partial class TermsQueryField : Union<IReadOnlyCollection<Elastic.Clients.Elasticsearch.FieldValue>, Elastic.Clients.Elasticsearch.QueryDsl.TermsLookup>
29+
public sealed partial class TermsQueryField : Union<IReadOnlyCollection<Elastic.Clients.Elasticsearch.FieldValue>, Elastic.Clients.Elasticsearch.QueryDsl.TermsLookup>
3030
{
3131
public TermsQueryField(IReadOnlyCollection<Elastic.Clients.Elasticsearch.FieldValue> value) : base(value)
3232
{

src/Elastic.Clients.Elasticsearch/_Generated/Types/Script.g.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
#nullable restore
2828
namespace Elastic.Clients.Elasticsearch;
29-
public partial class Script : Union<Elastic.Clients.Elasticsearch.InlineScript, Elastic.Clients.Elasticsearch.StoredScriptId>
29+
public sealed partial class Script : Union<Elastic.Clients.Elasticsearch.InlineScript, Elastic.Clients.Elasticsearch.StoredScriptId>
3030
{
3131
public Script(Elastic.Clients.Elasticsearch.InlineScript inline) : base(inline)
3232
{

src/Elastic.Clients.Elasticsearch/_Generated/Types/Slices.g.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
#nullable restore
2828
namespace Elastic.Clients.Elasticsearch;
29-
public partial class Slices : Union<int, Elastic.Clients.Elasticsearch.SlicesCalculation>
29+
public sealed partial class Slices : Union<int, Elastic.Clients.Elasticsearch.SlicesCalculation>
3030
{
3131
public Slices(int value) : base(value)
3232
{

src/Elastic.Clients.Elasticsearch/_Generated/Types/Tasks/TaskInfos.g.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
#nullable restore
2828
namespace Elastic.Clients.Elasticsearch.Tasks;
29-
public partial class TaskInfos : Union<IReadOnlyCollection<Elastic.Clients.Elasticsearch.Tasks.TaskInfo>, Dictionary<string, Elastic.Clients.Elasticsearch.Tasks.ParentTaskInfo>>
29+
public sealed partial class TaskInfos : Union<IReadOnlyCollection<Elastic.Clients.Elasticsearch.Tasks.TaskInfo>, Dictionary<string, Elastic.Clients.Elasticsearch.Tasks.ParentTaskInfo>>
3030
{
3131
public TaskInfos(IReadOnlyCollection<Elastic.Clients.Elasticsearch.Tasks.TaskInfo> flat) : base(flat)
3232
{

0 commit comments

Comments
 (0)