Skip to content

Commit 9f95085

Browse files
committed
refactor: remove JsonPropertyName attribute from IntOrString and add ToInt method; update V1Patch constructor for clarity
1 parent 0bd43e4 commit 9f95085

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

src/KubernetesClient/Models/IntOrString.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ namespace k8s.Models
33
[JsonConverter(typeof(IntOrStringJsonConverter))]
44
public struct IntOrString
55
{
6-
[JsonPropertyName("value")]
76
public string Value { get; private init; }
87

98
public static implicit operator IntOrString(int v)
@@ -30,5 +29,10 @@ public override string ToString()
3029
{
3130
return Value;
3231
}
32+
33+
public int ToInt()
34+
{
35+
return int.Parse(Value);
36+
}
3337
}
3438
}

src/KubernetesClient/Models/V1Patch.cs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,13 @@ public enum PatchType
3939

4040
public V1Patch(object body, PatchType type)
4141
{
42-
Content = body;
43-
Type = type;
44-
45-
if (Content == null)
42+
if (type == PatchType.Unknown)
4643
{
47-
throw new ArgumentNullException(nameof(Content), "object must be set");
44+
throw new ArgumentException("patch type must be set", nameof(type));
4845
}
4946

50-
if (Type == PatchType.Unknown)
51-
{
52-
throw new ArgumentException("patch type must be set", nameof(Type));
53-
}
47+
Content = body ?? throw new ArgumentNullException(nameof(body), "object must be set");
48+
Type = type;
5449
}
5550
}
5651
}

src/KubernetesClient/Models/V1Status.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace k8s.Models
44
{
5-
public partial record class V1Status
5+
public partial record V1Status
66
{
77
/// <summary>Converts a <see cref="V1Status"/> object into a short description of the status.</summary>
88
/// <returns>string description of the status</returns>

0 commit comments

Comments
 (0)