Allow JsonSerializerOptions parameters for user-defined and inputs and hardcode everything else to the source generator. (#182)
* Allow user-defined JsonSerializerOptions for user-defined and inputs and hardcode everything else to the source generator. * Add validation for user-defined JsonSerializerOptions. * Remove out of date comment. * Address feedback and add tests
This commit is contained in:
parent
4b38d3e71b
commit
f1af251c32
1 changed files with 632 additions and 372 deletions
|
|
@ -75,6 +75,7 @@ public static partial class McpJsonUtilities
|
|||
(JsonTypeInfo<T>)options.GetTypeInfo(typeof(T));
|
||||
|
||||
internal static JsonElement DefaultMcpToolSchema { get; } = ParseJsonElement("""{"type":"object"}"""u8);
|
||||
internal static object? AsObject(this JsonElement element) => element.ValueKind is JsonValueKind.Null ? null : element;
|
||||
|
||||
internal static bool IsValidMcpToolSchema(JsonElement element)
|
||||
{
|
||||
|
|
@ -151,6 +152,7 @@ public static partial class McpJsonUtilities
|
|||
[JsonSerializable(typeof(SubscribeRequestParams))]
|
||||
[JsonSerializable(typeof(UnsubscribeFromResourceRequestParams))]
|
||||
[JsonSerializable(typeof(UnsubscribeRequestParams))]
|
||||
[JsonSerializable(typeof(IReadOnlyDictionary<string, object>))]
|
||||
|
||||
[ExcludeFromCodeCoverage]
|
||||
internal sealed partial class JsonContext : JsonSerializerContext;
|
||||
|
|
|
|||
Loading…
Reference in a new issue