Skip to content

Commit 9c762be

Browse files
committed
NCBC-4039: Add JsonIgnore to public fields in BucketConfig
Motivation ---------- The Get-only public fields (LINQ helpers for zone-aware read from replica) were automatically pulled by the json serializer, which could cause serialization errors. Changes ------- Added JsonIgnore attributes to each so they don't get included in serialization. Change-Id: I10a694585ebaf8834c2ee7e1715bc1ec1851c198 Reviewed-on: https://review.couchbase.org/c/couchbase-net-client/+/229588 Tested-by: Build Bot <build@couchbase.com> Reviewed-by: Jeffry Morris <jeffrymorris@gmail.com>
1 parent 69e9bf5 commit 9c762be

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/Couchbase/Core/Configuration/Server/BucketConfig.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,7 @@ public Dictionary<string, IEnumerable<string>> ClusterCapabilities
437437
/// Maps each Hostname to its index in <see cref="VBucketServerMap"/>'s ServerList.
438438
/// Example: { "10.0.0.1": 0, "10.0.0.2": 1, ... }
439439
/// </summary>
440+
[JsonIgnore]
440441
public Dictionary<string, int> HostnamesAndIndex => VBucketServerMap.ServerList
441442
.Select((hostname, index) => new { hostname, index })
442443
.ToDictionary(item => item.hostname.Split(':')[0], item => item.index);
@@ -445,6 +446,7 @@ public Dictionary<string, IEnumerable<string>> ClusterCapabilities
445446
/// Maps each Hostname to which ServerGroup it belongs to.
446447
/// Example: { "10.0.0.1": "group_1", "10.0.0.2": "group_1", ... }
447448
/// </summary>
449+
[JsonIgnore]
448450
public Dictionary<string, string> HostnameAndServerGroup => NodesExt
449451
.Where(nodeExt => !string.IsNullOrEmpty(nodeExt.ServerGroup))
450452
.Select(nodeExt => new { nodeExt.Hostname, nodeExt.ServerGroup })
@@ -454,6 +456,7 @@ public Dictionary<string, IEnumerable<string>> ClusterCapabilities
454456
/// Maps each unique ServerGroup to the indexes of the nodes it contains, in <see cref="VBucketServerMap"/>'s ServerList.
455457
/// Example: { "group_1": [0, 1, 2], "group_2": [3, 4, 5], ... }
456458
/// </summary>
459+
[JsonIgnore]
457460
public Dictionary<string, int[]> ServerGroupNodeIndexes =>
458461
HostnameAndServerGroup
459462
.GroupBy(x => x.Value)

0 commit comments

Comments
 (0)