Skip to content

Commit

Permalink
Merge pull request #65 from microsoft/feature/nrt-composed
Browse files Browse the repository at this point in the history
- relaxes nullability tolerance when merging objects for composed types
  • Loading branch information
baywet authored Jan 27, 2023
2 parents 3934d3d + 97601d0 commit 40b7b5d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.Kiota.Abstractions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<Deterministic>true</Deterministic>
<VersionPrefix>1.0.0</VersionPrefix>
<VersionSuffix>rc.5</VersionSuffix>
<VersionSuffix>rc.6</VersionSuffix>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<SignAssembly>false</SignAssembly>
<DelaySign>false</DelaySign>
Expand Down
2 changes: 1 addition & 1 deletion src/serialization/ISerializationWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public interface ISerializationWriter : IDisposable
/// <param name="key">The key to be used for the written value. May be null.</param>
/// <param name="value">The model object to be written.</param>
/// <param name="additionalValuesToMerge">The additional values to merge to the main value when serializing an intersection wrapper.</param>
void WriteObjectValue<T>(string? key, T? value, params IParsable[] additionalValuesToMerge) where T : IParsable;
void WriteObjectValue<T>(string? key, T? value, params IParsable?[] additionalValuesToMerge) where T : IParsable;
/// <summary>
/// Writes the specified enum value to the stream with an optional given key.
/// </summary>
Expand Down
5 changes: 3 additions & 2 deletions src/serialization/ParseNodeHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public static class ParseNodeHelper {
/// Merges the given fields deserializers for an intersection type into a single collection.
/// </summary>
/// <param name="targets">The collection of deserializers to merge.</param>
public static IDictionary<string, Action<IParseNode>> MergeDeserializersForIntersectionWrapper(params IParsable[] targets) {
public static IDictionary<string, Action<IParseNode>> MergeDeserializersForIntersectionWrapper(params IParsable?[] targets) {
if (targets == null)
{
throw new ArgumentNullException(nameof(targets));
Expand All @@ -26,7 +26,8 @@ public static IDictionary<string, Action<IParseNode>> 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);
Expand Down

0 comments on commit 40b7b5d

Please sign in to comment.