Skip to content

Commit 08159fe

Browse files
committed
Special case serialization of V1Patch
1 parent 722f21c commit 08159fe

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/KubernetesClient.Aot/KubernetesJson.cs

+6-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,12 @@ public static TValue Deserialize<TValue>(Stream json, JsonSerializerOptions json
9191

9292
public static string Serialize(object value, JsonSerializerOptions jsonSerializerOptions = null)
9393
{
94-
var info = SourceGenerationContext.Default.GetTypeInfo(value.GetType());
94+
if (value is V1Patch { Content: string jsonValue })
95+
{
96+
return jsonValue;
97+
}
98+
99+
var info = SourceGenerationContext.Default.GetTypeInfo(value.GetType()) ?? LocalSgContext.Default.GetTypeInfo(value.GetType());
95100
return JsonSerializer.Serialize(value, info);
96101
}
97102
}

0 commit comments

Comments
 (0)