Skip to content

Commit 210501a

Browse files
authored
Mark IsValid obsolete for get and delete responses to warn about the behavioral change in #2367 (#2678)
1 parent 72f058f commit 210501a

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

src/Nest/Document/Single/Delete/DeleteResponse.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Newtonsoft.Json;
1+
using System;
2+
using Newtonsoft.Json;
23

34
namespace Nest
45
{
@@ -40,14 +41,19 @@ public class DeleteResponse : ResponseBase, IDeleteResponse
4041

4142
[JsonProperty("_type")]
4243
public string Type { get; internal set; }
43-
44+
4445
[JsonProperty("_id")]
4546
public string Id { get; internal set; }
46-
47+
4748
[JsonProperty("_version")]
4849
public string Version { get; internal set; }
49-
50+
5051
[JsonProperty("found")]
5152
public bool Found { get; internal set; }
53+
54+
[Obsolete(@"WARNING: IsValid behavior has changed to align with 1.x and 5.x onwards.
55+
It now returns true for 404 responses (document not found), where previously it returned
56+
false. Please use .Found to check whether the document was actually found.")]
57+
public override bool IsValid => base.IsValid;
5258
}
5359
}

src/Nest/Document/Single/Get/GetResponse.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Linq.Expressions;
42
using Newtonsoft.Json;
5-
using System.Linq;
63

74
namespace Nest
85
{
@@ -56,5 +53,10 @@ public class GetResponse<T> : ResponseBase, IGetResponse<T> where T : class
5653
public string Routing { get; private set; }
5754
public long? Timestamp { get; private set; }
5855
public long? Ttl { get; private set; }
56+
57+
[Obsolete(@"WARNING: IsValid behavior has changed to align with 1.x and 5.x onwards.
58+
It now returns true for 404 responses (document not found), where previously it returned
59+
false. Please use .Found to check whether the document was actually found.")]
60+
public override bool IsValid => base.IsValid;
5961
}
6062
}

0 commit comments

Comments
 (0)