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:
Eirik Tsarpalis 2025-04-02 18:43:54 +01:00 • committed by GitHub
commit f1af251c32
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -8,6 +8,7 @@ using ModelContextProtocol.Utils.Json;
using System.IO.Pipelines;
using System.Text;
using System.Text.Json;
using System.Text.Json.Nodes;
namespace ModelContextProtocol.Tests.Transport;
@ -153,10 +154,10 @@ public class StdioServerTransportTests : LoggedTest
{
Method = "test",
Id = new RequestId(44),
Params = new Dictionary<string, JsonElement>
Params = new JsonObject
{
["text"] = JsonSerializer.SerializeToElement(chineseText)
}
["text"] = chineseText
},
};
// Clear output and send message
@ -175,10 +176,10 @@ public class StdioServerTransportTests : LoggedTest
{
Method = "test",
Id = new RequestId(45),
Params = new Dictionary<string, JsonElement>
Params = new JsonObject
{
["text"] = JsonSerializer.SerializeToElement(emojiText)
}
["text"] = emojiText
},
};
// Clear output and send message