Skip to content

Commit

Permalink
Removes obsolete attribute on functions taking non-stream content
Browse files Browse the repository at this point in the history
  • Loading branch information
MihaMarkic committed Apr 24, 2024
1 parent b50ddb2 commit 225bc05
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
4 changes: 0 additions & 4 deletions src/serialization/KiotaJsonSerializer.Deserialization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public static partial class KiotaJsonSerializer
/// </summary>
/// <param name="parsableFactory">The factory to create the object.</param>
/// <param name="serializedRepresentation">The serialized representation of the object.</param>
[Obsolete("Use DeserializeAsync instead")]
public static T? Deserialize<T>(string serializedRepresentation, ParsableFactory<T> parsableFactory) where T : IParsable
=> KiotaSerializer.Deserialize(_jsonContentType, serializedRepresentation, parsableFactory);
/// <summary>
Expand All @@ -50,7 +49,6 @@ public static partial class KiotaJsonSerializer
/// Deserializes the given stream into an object.
/// </summary>
/// <param name="serializedRepresentation">The serialized representation of the object.</param>
[Obsolete("Use DeserializeAsync instead")]
#if NET5_0_OR_GREATER
public static T? Deserialize<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] T>(string serializedRepresentation) where T : IParsable
#else
Expand All @@ -70,7 +68,6 @@ public static partial class KiotaJsonSerializer
/// </summary>
/// <param name="serializedRepresentation">The serialized representation of the objects.</param>
/// <param name="parsableFactory">The factory to create the object.</param>
[Obsolete("Use DeserializeCollectionAsync instead")]
public static IEnumerable<T> DeserializeCollection<T>(string serializedRepresentation, ParsableFactory<T> parsableFactory) where T : IParsable
=> KiotaSerializer.DeserializeCollection(_jsonContentType, serializedRepresentation, parsableFactory);
/// <summary>
Expand All @@ -88,7 +85,6 @@ public static partial class KiotaJsonSerializer
/// Deserializes the given stream into a collection of objects based on the content type.
/// </summary>
/// <param name="serializedRepresentation">The serialized representation of the object.</param>
[Obsolete("Use DeserializeCollectionAsync instead")]
#if NET5_0_OR_GREATER
public static IEnumerable<T> DeserializeCollection<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] T>(string serializedRepresentation) where T : IParsable
#else
Expand Down
9 changes: 5 additions & 4 deletions src/serialization/KiotaSerializer.Deserialization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ public static partial class KiotaSerializer
/// <param name="contentType">The content type of the stream.</param>
/// <param name="parsableFactory">The factory to create the object.</param>
/// <param name="serializedRepresentation">The serialized representation of the object.</param>
[Obsolete("Use DeserializeAsync instead")]
//[Obsolete("Use DeserializeAsync instead")]
public static T? Deserialize<T>(string contentType, string serializedRepresentation, ParsableFactory<T> parsableFactory) where T : IParsable
{
if(string.IsNullOrEmpty(serializedRepresentation)) throw new ArgumentNullException(nameof(serializedRepresentation));
using var stream = GetStreamFromString(serializedRepresentation);
#pragma warning disable CS0618 // Type or member is obsolete
return Deserialize(contentType, stream, parsableFactory);
#pragma warning restore CS0618 // Type or member is obsolete
}
private static Stream GetStreamFromString(string source)
{
Expand Down Expand Up @@ -85,7 +87,6 @@ private static Stream GetStreamFromString(string source)
/// </summary>
/// <param name="contentType">The content type of the stream.</param>
/// <param name="serializedRepresentation">The serialized representation of the object.</param>
[Obsolete("Use DeserializeAsync instead")]
#if NET5_0_OR_GREATER
public static T? Deserialize<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] T>(string contentType, string serializedRepresentation) where T : IParsable
#else
Expand Down Expand Up @@ -114,12 +115,13 @@ private static Stream GetStreamFromString(string source)
/// <param name="contentType">The content type of the stream.</param>
/// <param name="serializedRepresentation">The serialized representation of the objects.</param>
/// <param name="parsableFactory">The factory to create the object.</param>
[Obsolete("Use DeserializeCollectionAsync instead")]
public static IEnumerable<T> DeserializeCollection<T>(string contentType, string serializedRepresentation, ParsableFactory<T> parsableFactory) where T : IParsable
{
if(string.IsNullOrEmpty(serializedRepresentation)) throw new ArgumentNullException(nameof(serializedRepresentation));
using var stream = GetStreamFromString(serializedRepresentation);
#pragma warning disable CS0618 // Type or member is obsolete
return DeserializeCollection(contentType, stream, parsableFactory);
#pragma warning restore CS0618 // Type or member is obsolete
}
/// <summary>
/// Deserializes the given stream into a collection of objects based on the content type.
Expand All @@ -138,7 +140,6 @@ private static Stream GetStreamFromString(string source)
/// </summary>
/// <param name="contentType">The content type of the stream.</param>
/// <param name="serializedRepresentation">The serialized representation of the object.</param>
[Obsolete("Use DeserializeCollectionAsync instead")]
#if NET5_0_OR_GREATER
public static IEnumerable<T> DeserializeCollection<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] T>(string contentType, string serializedRepresentation) where T : IParsable
#else
Expand Down

0 comments on commit 225bc05

Please sign in to comment.