From 36a02046439d01f1256aed4e5071cb7f1b57d6eb Mon Sep 17 00:00:00 2001 From: Ivan Josipovic <9521987+IvanJosipovic@users.noreply.github.com> Date: Sun, 11 Aug 2024 13:21:59 -0700 Subject: [PATCH] feat: yamldotnet 16 support (#1574) * feat: yamldotnet 16 support * update yamldotnet * fix interface * update Vecc.YamlDotNet.Analyzers.StaticGenerator --- Directory.Packages.props | 4 ++-- src/KubernetesClient.Aot/KubernetesYaml.cs | 4 ++-- src/KubernetesClient/KubernetesYaml.cs | 4 ++-- src/KubernetesClient/Models/IntOrStringYamlConverter.cs | 4 ++-- src/KubernetesClient/Models/ResourceQuantityYamlConverter.cs | 5 ++--- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 72014a9a6..67df46d62 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -28,11 +28,11 @@ - + - + diff --git a/src/KubernetesClient.Aot/KubernetesYaml.cs b/src/KubernetesClient.Aot/KubernetesYaml.cs index a017d1050..069b1c12e 100644 --- a/src/KubernetesClient.Aot/KubernetesYaml.cs +++ b/src/KubernetesClient.Aot/KubernetesYaml.cs @@ -45,7 +45,7 @@ public bool Accepts(Type type) return type == typeof(byte[]); } - public object ReadYaml(IParser parser, Type type) + public object ReadYaml(IParser parser, Type type, ObjectDeserializer rootDeserializer) { if (parser?.Current is Scalar scalar) { @@ -67,7 +67,7 @@ public object ReadYaml(IParser parser, Type type) throw new InvalidOperationException(parser.Current?.ToString()); } - public void WriteYaml(IEmitter emitter, object value, Type type) + public void WriteYaml(IEmitter emitter, object value, Type type, ObjectSerializer serializer) { var obj = (byte[])value; emitter?.Emit(new Scalar(Encoding.UTF8.GetString(obj))); diff --git a/src/KubernetesClient/KubernetesYaml.cs b/src/KubernetesClient/KubernetesYaml.cs index 803c2bb64..7f677a3f2 100644 --- a/src/KubernetesClient/KubernetesYaml.cs +++ b/src/KubernetesClient/KubernetesYaml.cs @@ -67,7 +67,7 @@ public bool Accepts(Type type) return type == typeof(byte[]); } - public object ReadYaml(IParser parser, Type type) + public object ReadYaml(IParser parser, Type type, ObjectDeserializer rootDeserializer) { if (parser?.Current is Scalar scalar) { @@ -89,7 +89,7 @@ public object ReadYaml(IParser parser, Type type) throw new InvalidOperationException(parser.Current?.ToString()); } - public void WriteYaml(IEmitter emitter, object value, Type type) + public void WriteYaml(IEmitter emitter, object value, Type type, ObjectSerializer serializer) { var obj = (byte[])value; emitter?.Emit(new Scalar(Encoding.UTF8.GetString(obj))); diff --git a/src/KubernetesClient/Models/IntOrStringYamlConverter.cs b/src/KubernetesClient/Models/IntOrStringYamlConverter.cs index 125ea5f93..49116bd6c 100644 --- a/src/KubernetesClient/Models/IntOrStringYamlConverter.cs +++ b/src/KubernetesClient/Models/IntOrStringYamlConverter.cs @@ -10,7 +10,7 @@ public bool Accepts(Type type) return type == typeof(IntstrIntOrString); } - public object ReadYaml(IParser parser, Type type) + public object ReadYaml(IParser parser, Type type, ObjectDeserializer rootDeserializer) { if (parser?.Current is YamlDotNet.Core.Events.Scalar scalar) { @@ -32,7 +32,7 @@ public object ReadYaml(IParser parser, Type type) throw new InvalidOperationException(parser?.Current?.ToString()); } - public void WriteYaml(IEmitter emitter, object value, Type type) + public void WriteYaml(IEmitter emitter, object value, Type type, ObjectSerializer serializer) { var obj = (IntstrIntOrString)value; emitter?.Emit(new YamlDotNet.Core.Events.Scalar(obj?.Value)); diff --git a/src/KubernetesClient/Models/ResourceQuantityYamlConverter.cs b/src/KubernetesClient/Models/ResourceQuantityYamlConverter.cs index ef274bf81..ce0ec8e54 100644 --- a/src/KubernetesClient/Models/ResourceQuantityYamlConverter.cs +++ b/src/KubernetesClient/Models/ResourceQuantityYamlConverter.cs @@ -10,7 +10,7 @@ public bool Accepts(Type type) return type == typeof(ResourceQuantity); } - public object ReadYaml(IParser parser, Type type) + public object ReadYaml(IParser parser, Type type, ObjectDeserializer rootDeserializer) { if (parser?.Current is YamlDotNet.Core.Events.Scalar scalar) { @@ -32,8 +32,7 @@ public object ReadYaml(IParser parser, Type type) throw new InvalidOperationException(parser?.Current?.ToString()); } - - public void WriteYaml(IEmitter emitter, object value, Type type) + public void WriteYaml(IEmitter emitter, object value, Type type, ObjectSerializer serializer) { var obj = (ResourceQuantity)value; emitter?.Emit(new YamlDotNet.Core.Events.Scalar(obj?.ToString()));