Skip to content

Commit

Permalink
Add primitive types to InsightsJsonSerializerContext that may be used…
Browse files Browse the repository at this point in the history
… with ProblemDetails.Extensions
  • Loading branch information
mburumaxwell committed May 16, 2024
1 parent 9fa1f74 commit 468f3d4
Showing 1 changed file with 31 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,7 +1,37 @@
using System.Text.Json.Serialization;
using System.Text.Json.Nodes;
using System.Text.Json;
using System.Text.Json.Serialization;

namespace Tingle.AspNetCore.ApplicationInsights;

[JsonSerializable(typeof(IDictionary<string, string[]>))]
[JsonSerializable(typeof(IDictionary<string, object?>))]
// These primitive types are declared for common types that may be used with ProblemDetails.Extensions.
[JsonSerializable(typeof(bool))]
[JsonSerializable(typeof(byte))]
[JsonSerializable(typeof(sbyte))]
[JsonSerializable(typeof(short))]
[JsonSerializable(typeof(ushort))]
[JsonSerializable(typeof(int))]
[JsonSerializable(typeof(uint))]
[JsonSerializable(typeof(long))]
[JsonSerializable(typeof(ulong))]
[JsonSerializable(typeof(float))]
[JsonSerializable(typeof(double))]
[JsonSerializable(typeof(decimal))]
[JsonSerializable(typeof(char))]
[JsonSerializable(typeof(string))]
[JsonSerializable(typeof(DateTime))]
[JsonSerializable(typeof(DateTimeOffset))]
[JsonSerializable(typeof(TimeSpan))]
[JsonSerializable(typeof(JsonArray))]
[JsonSerializable(typeof(JsonObject))]
[JsonSerializable(typeof(JsonDocument))]
[JsonSerializable(typeof(DateOnly))]
[JsonSerializable(typeof(TimeOnly))]
#if NET8_0_OR_GREATER
[JsonSerializable(typeof(Half))]
[JsonSerializable(typeof(Int128))]
[JsonSerializable(typeof(UInt128))]
#endif
internal partial class InsightsJsonSerializerContext : JsonSerializerContext { }

0 comments on commit 468f3d4

Please sign in to comment.