From 97601d088802d6e13d389c3851bb4c30b5001421 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 26 Jan 2023 15:35:14 -0500 Subject: [PATCH] - relaxes nullability tolerance when merging objects for composed types Signed-off-by: Vincent Biret --- CHANGELOG.md | 6 ++++++ src/Microsoft.Kiota.Abstractions.csproj | 2 +- src/serialization/ISerializationWriter.cs | 2 +- src/serialization/ParseNodeHelper.cs | 5 +++-- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fef7bc1c..d034eb6f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +## [1.0.0-rc.6] - 2023-01-27 + +### Changed + +- Relaxed nullability tolerance when merging objects for composed types. + ## [1.0.0-rc.5] - 2023-01-26 ### Changed diff --git a/src/Microsoft.Kiota.Abstractions.csproj b/src/Microsoft.Kiota.Abstractions.csproj index 90b0d252..f87b6e4e 100644 --- a/src/Microsoft.Kiota.Abstractions.csproj +++ b/src/Microsoft.Kiota.Abstractions.csproj @@ -14,7 +14,7 @@ true true 1.0.0 - rc.5 + rc.6 true false false diff --git a/src/serialization/ISerializationWriter.cs b/src/serialization/ISerializationWriter.cs index f6ae0b41..015bacac 100644 --- a/src/serialization/ISerializationWriter.cs +++ b/src/serialization/ISerializationWriter.cs @@ -127,7 +127,7 @@ public interface ISerializationWriter : IDisposable /// The key to be used for the written value. May be null. /// The model object to be written. /// The additional values to merge to the main value when serializing an intersection wrapper. - void WriteObjectValue(string? key, T? value, params IParsable[] additionalValuesToMerge) where T : IParsable; + void WriteObjectValue(string? key, T? value, params IParsable?[] additionalValuesToMerge) where T : IParsable; /// /// Writes the specified enum value to the stream with an optional given key. /// diff --git a/src/serialization/ParseNodeHelper.cs b/src/serialization/ParseNodeHelper.cs index 73f24e75..9859795f 100644 --- a/src/serialization/ParseNodeHelper.cs +++ b/src/serialization/ParseNodeHelper.cs @@ -16,7 +16,7 @@ public static class ParseNodeHelper { /// Merges the given fields deserializers for an intersection type into a single collection. /// /// The collection of deserializers to merge. - public static IDictionary> MergeDeserializersForIntersectionWrapper(params IParsable[] targets) { + public static IDictionary> MergeDeserializersForIntersectionWrapper(params IParsable?[] targets) { if (targets == null) { throw new ArgumentNullException(nameof(targets)); @@ -26,7 +26,8 @@ public static IDictionary> MergeDeserializersForInter throw new ArgumentException("At least one target must be provided.", nameof(targets)); } - return targets.SelectMany(static x => x.GetFieldDeserializers()) + return targets.Where(static x => x != null) + .SelectMany(static x => x!.GetFieldDeserializers()) .GroupBy(static x => x.Key) .Select(static x => x.First()) .ToDictionary(static x => x.Key, static x => x.Value);