diff --git a/PiBox.Hosting/Abstractions/src/PiBox.Hosting.Abstractions/Extensions/SerializationExtensions.cs b/PiBox.Hosting/Abstractions/src/PiBox.Hosting.Abstractions/Extensions/SerializationExtensions.cs index be65108..c209edf 100644 --- a/PiBox.Hosting/Abstractions/src/PiBox.Hosting.Abstractions/Extensions/SerializationExtensions.cs +++ b/PiBox.Hosting/Abstractions/src/PiBox.Hosting.Abstractions/Extensions/SerializationExtensions.cs @@ -25,6 +25,7 @@ public static class SerializationExtensions private static readonly IDeserializer _deserializer = new DeserializerBuilder() .WithNamingConvention(CamelCaseNamingConvention.Instance) + .IgnoreUnmatchedProperties() .WithDuplicateKeyChecking() .WithTypeConverter(new ValueObjectYamlTypeConverter()) .Build(); diff --git a/PiBox.Hosting/Abstractions/test/PiBox.Hosting.Abstractions.Tests/Extensions/SerializationExtensionTests.cs b/PiBox.Hosting/Abstractions/test/PiBox.Hosting.Abstractions.Tests/Extensions/SerializationExtensionTests.cs index ded3654..a0725a3 100644 --- a/PiBox.Hosting/Abstractions/test/PiBox.Hosting.Abstractions.Tests/Extensions/SerializationExtensionTests.cs +++ b/PiBox.Hosting/Abstractions/test/PiBox.Hosting.Abstractions.Tests/Extensions/SerializationExtensionTests.cs @@ -32,9 +32,12 @@ public void CanSerializeAndDeserializeYaml() { var sample = new Sample { HealthCheckTag = HealthCheckTag.Liveness, Name = "test" }; var serialized = sample.Serialize(SerializationMethod.Yaml); + var withSchema = "$schema: bla.json" + Environment.NewLine + serialized; var deserialized = serialized.Deserialize(SerializationMethod.Yaml); + var deserializedWithSchema = withSchema.Deserialize(SerializationMethod.Yaml); deserialized.Should().BeEquivalentTo(sample); + deserializedWithSchema.Should().BeEquivalentTo(sample); var obj = serialized.Deserialize(typeof(Sample), SerializationMethod.Yaml); obj.Should().BeOfType();