Add SystemTextJsonMatchers (#1447)

* SystemTextJsonMatcher

* ,

* .

* new projectx

* Update test/WireMock.Net.Tests/Pact/PactTests.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update test/WireMock.Net.Tests/WebSockets/WebSocketIntegrationTests.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/WireMock.Net/WireMock.Net.csproj

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/WireMock.Net.Minimal/Properties/AssemblyInfo.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* .

* more tests

* .

* .

* x

* ...

* .

* fix tests

* 0.11.0

* .

* delete jsonutils.cs

* s

* fix findings

* Apply suggestions from code review

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

* Potential fix for pull request finding 'Missing Dispose call on local IDisposable'

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

* JsonConverter 0.12.0

* -- tools

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
This commit is contained in:
Stef Heyenrath
2026-05-29 20:19:51 +02:00
committed by GitHub
parent fed1c87663
commit 36b0a93a6c
68 changed files with 4202 additions and 976 deletions
@@ -1,6 +1,7 @@
// Copyright © WireMock.Net
using System.Collections;
using JsonConverter.Abstractions;
using WireMock.Extensions;
using WireMock.Util;
@@ -191,9 +192,9 @@ internal class SimpleSettingsParser
return GetValue(name, values => values.FirstOrDefault());
}
public T? GetObjectValueFromJson<T>(string name)
public T? GetObjectValueFromJson<T>(string name, IJsonConverter jsonConverter)
{
var value = GetValue(name, values => values.FirstOrDefault());
return string.IsNullOrWhiteSpace(value) ? default : JsonUtils.DeserializeObject<T>(value!);
return string.IsNullOrWhiteSpace(value) ? default : jsonConverter.Deserialize<T>(value!);
}
}
@@ -14,6 +14,7 @@ using WireMock.Logging;
using WireMock.Matchers;
using WireMock.Models;
using WireMock.RegularExpressions;
using WireMock.Transformers;
using WireMock.Types;
namespace WireMock.Settings;
@@ -362,11 +363,31 @@ public class WireMockServerSettings
/// Default is <see cref="NewtonsoftJsonConverter"/>.
/// </remarks>
[PublicAPI]
public IJsonConverter DefaultJsonSerializer { get; set; } = new NewtonsoftJsonConverter();
public IJsonConverter DefaultJsonSerializer { get; set; }
/// <summary>
/// Gets or sets the default JSON body transformer used for template-based JSON body transformations.
/// </summary>
/// <remarks>
/// Set this property to provide a custom implementation for transforming JSON and ProtoBuf body content.
/// Default is <see cref="NewtonsoftJsonBodyTransformer"/>.
/// </remarks>
[PublicAPI]
[JsonIgnore]
public IJsonBodyTransformer DefaultJsonBodyTransformer { get; set; }
/// <summary>
/// WebSocket settings.
/// </summary>
[PublicAPI]
public WebSocketSettings? WebSocketSettings { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="WireMockServerSettings"/> class.
/// </summary>
public WireMockServerSettings()
{
DefaultJsonSerializer = new NewtonsoftJsonConverter();
DefaultJsonBodyTransformer = new NewtonsoftJsonBodyTransformer(this);
}
}