diff --git a/src/serialization/IParseNode.cs b/src/serialization/IParseNode.cs index 422ef532..3f9f3f56 100644 --- a/src/serialization/IParseNode.cs +++ b/src/serialization/IParseNode.cs @@ -95,22 +95,22 @@ public interface IParseNode /// Gets the collection of primitive values of the node. /// /// The collection of primitive values. - IEnumerable GetCollectionOfPrimitiveValues(); + IEnumerable? GetCollectionOfPrimitiveValues(); /// /// Gets the collection of enum values of the node. /// /// The collection of enum values. #if NET5_0_OR_GREATER - IEnumerable GetCollectionOfEnumValues<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields)] T>() where T : struct, Enum; + IEnumerable? GetCollectionOfEnumValues<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields)] T>() where T : struct, Enum; #else - IEnumerable GetCollectionOfEnumValues() where T : struct, Enum; + IEnumerable? GetCollectionOfEnumValues() where T : struct, Enum; #endif /// /// Gets the collection of model objects values of the node. /// /// The factory to use to create the model object. /// The collection of model objects values. - IEnumerable GetCollectionOfObjectValues(ParsableFactory factory) where T : IParsable; + IEnumerable? GetCollectionOfObjectValues(ParsableFactory factory) where T : IParsable; /// /// Gets the enum value of the node. /// diff --git a/src/serialization/KiotaJsonSerializer.Deserialization.cs b/src/serialization/KiotaJsonSerializer.Deserialization.cs index 27ac6817..62c001f2 100644 --- a/src/serialization/KiotaJsonSerializer.Deserialization.cs +++ b/src/serialization/KiotaJsonSerializer.Deserialization.cs @@ -55,23 +55,23 @@ public static partial class KiotaJsonSerializer /// /// The stream to deserialize. /// The factory to create the object. - public static IEnumerable DeserializeCollection(Stream stream, ParsableFactory parsableFactory) where T : IParsable + public static IEnumerable? DeserializeCollection(Stream stream, ParsableFactory parsableFactory) where T : IParsable => KiotaSerializer.DeserializeCollection(_jsonContentType, stream, parsableFactory); /// /// Deserializes the given stream into a collection of objects based on the content type. /// /// The serialized representation of the objects. /// The factory to create the object. - public static IEnumerable DeserializeCollection(string serializedRepresentation, ParsableFactory parsableFactory) where T : IParsable + public static IEnumerable? DeserializeCollection(string serializedRepresentation, ParsableFactory parsableFactory) where T : IParsable => KiotaSerializer.DeserializeCollection(_jsonContentType, serializedRepresentation, parsableFactory); /// /// Deserializes the given stream into a collection of objects based on the content type. /// /// The stream to deserialize. #if NET5_0_OR_GREATER - public static IEnumerable DeserializeCollection<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] T>(Stream stream) where T : IParsable + public static IEnumerable? DeserializeCollection<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] T>(Stream stream) where T : IParsable #else - public static IEnumerable DeserializeCollection(Stream stream) where T : IParsable + public static IEnumerable? DeserializeCollection(Stream stream) where T : IParsable #endif => KiotaSerializer.DeserializeCollection(_jsonContentType, stream); /// @@ -79,9 +79,9 @@ public static IEnumerable DeserializeCollection(Stream stream) where T : I /// /// The serialized representation of the object. #if NET5_0_OR_GREATER - public static IEnumerable DeserializeCollection<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] T>(string serializedRepresentation) where T : IParsable + public static IEnumerable? DeserializeCollection<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] T>(string serializedRepresentation) where T : IParsable #else - public static IEnumerable DeserializeCollection(string serializedRepresentation) where T : IParsable + public static IEnumerable? DeserializeCollection(string serializedRepresentation) where T : IParsable #endif => KiotaSerializer.DeserializeCollection(_jsonContentType, serializedRepresentation); } \ No newline at end of file diff --git a/src/serialization/KiotaSerializer.Deserialization.cs b/src/serialization/KiotaSerializer.Deserialization.cs index 6f265af8..72ff4a7e 100644 --- a/src/serialization/KiotaSerializer.Deserialization.cs +++ b/src/serialization/KiotaSerializer.Deserialization.cs @@ -92,7 +92,7 @@ private static ParsableFactory GetFactoryFromType() where T : IParsable /// The content type of the stream. /// The stream to deserialize. /// The factory to create the object. - public static IEnumerable DeserializeCollection(string contentType, Stream stream, ParsableFactory parsableFactory) where T : IParsable + public static IEnumerable? DeserializeCollection(string contentType, Stream stream, ParsableFactory parsableFactory) where T : IParsable { if(string.IsNullOrEmpty(contentType)) throw new ArgumentNullException(nameof(contentType)); if(stream == null) throw new ArgumentNullException(nameof(stream)); @@ -106,7 +106,7 @@ public static IEnumerable DeserializeCollection(string contentType, Stream /// The content type of the stream. /// The serialized representation of the objects. /// The factory to create the object. - public static IEnumerable DeserializeCollection(string contentType, string serializedRepresentation, ParsableFactory parsableFactory) where T : IParsable + public static IEnumerable? DeserializeCollection(string contentType, string serializedRepresentation, ParsableFactory parsableFactory) where T : IParsable { if(string.IsNullOrEmpty(serializedRepresentation)) throw new ArgumentNullException(nameof(serializedRepresentation)); using var stream = GetStreamFromString(serializedRepresentation); @@ -118,9 +118,9 @@ public static IEnumerable DeserializeCollection(string contentType, string /// The content type of the stream. /// The stream to deserialize. #if NET5_0_OR_GREATER - public static IEnumerable DeserializeCollection<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] T>(string contentType, Stream stream) where T : IParsable + public static IEnumerable? DeserializeCollection<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] T>(string contentType, Stream stream) where T : IParsable #else - public static IEnumerable DeserializeCollection(string contentType, Stream stream) where T : IParsable + public static IEnumerable? DeserializeCollection(string contentType, Stream stream) where T : IParsable #endif => DeserializeCollection(contentType, stream, GetFactoryFromType()); /// @@ -129,9 +129,9 @@ public static IEnumerable DeserializeCollection(string contentType, Stream /// The content type of the stream. /// The serialized representation of the object. #if NET5_0_OR_GREATER - public static IEnumerable DeserializeCollection<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] T>(string contentType, string serializedRepresentation) where T : IParsable + public static IEnumerable? DeserializeCollection<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] T>(string contentType, string serializedRepresentation) where T : IParsable #else - public static IEnumerable DeserializeCollection(string contentType, string serializedRepresentation) where T : IParsable + public static IEnumerable? DeserializeCollection(string contentType, string serializedRepresentation) where T : IParsable #endif => DeserializeCollection(contentType, serializedRepresentation, GetFactoryFromType()); } \ No newline at end of file