Skip to content

Commit

Permalink
Add primitive types to SwaggerJsonSerializerContext that may be used …
Browse files Browse the repository at this point in the history
…with ReDocConfig.AdditionalItems
  • Loading branch information
mburumaxwell committed May 16, 2024
1 parent 5ae7e6a commit 9fa1f74
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion src/Tingle.AspNetCore.Swagger/SwaggerJsonSerializerContext.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,35 @@
using System.Text.Json.Serialization;
using System.Text.Json.Nodes;
using System.Text.Json;
using System.Text.Json.Serialization;
using Tingle.AspNetCore.Swagger.ReDoc;

namespace Tingle.AspNetCore.Swagger;

[JsonSerializable(typeof(ReDocConfig))]
// These primitive types are declared for common types that may be used with ReDocConfig.AdditionalItems.
[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))]
[JsonSerializable(typeof(Half))]
[JsonSerializable(typeof(Int128))]
[JsonSerializable(typeof(UInt128))]
internal partial class SwaggerJsonSerializerContext : JsonSerializerContext { }

0 comments on commit 9fa1f74

Please sign in to comment.