fix some warnings

This commit is contained in:
Stef Heyenrath
2026-03-08 09:07:34 +01:00
parent 1efaaf6af5
commit de3578b58e
4 changed files with 20 additions and 10 deletions

View File

@@ -1,8 +1,5 @@
// Copyright © WireMock.Net
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using JsonConverter.Abstractions;
using ProtoBufJsonConverter;
using ProtoBufJsonConverter.Models;

View File

@@ -82,11 +82,13 @@ public class ProxyAndRecordSettings : HttpClientSettings
[PublicAPI]
public ProxyUrlReplaceSettings? ReplaceSettings { get; set; }
/*
/// <summary>
/// Prefer the Proxy Mapping over the saved Mapping (in case SaveMapping is set to <c>true</c>).
/// </summary>
//[PublicAPI]
//public bool PreferProxyMapping { get; set; }
*/
/// <summary>
/// When SaveMapping is set to <c>true</c>, this setting can be used to control the behavior of the generated request matchers for the new mapping.

View File

@@ -1,9 +1,6 @@
// Copyright © WireMock.Net
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using WireMock.Extensions;
using WireMock.Util;
@@ -197,6 +194,6 @@ internal class SimpleSettingsParser
public T? GetObjectValueFromJson<T>(string name)
{
var value = GetValue(name, values => values.FirstOrDefault());
return string.IsNullOrWhiteSpace(value) ? default : JsonUtils.DeserializeObject<T>(value);
return string.IsNullOrWhiteSpace(value) ? default : JsonUtils.DeserializeObject<T>(value!);
}
}

View File

@@ -1,8 +1,5 @@
// Copyright © WireMock.Net
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using JsonConverter.Abstractions;
using WireMock.ResponseBuilders;
@@ -13,7 +10,24 @@ namespace WireMock.Util;
/// </summary>
public interface IProtoBufUtils
{
/// <summary>
/// Converts a JSON-like object to a ProtoBuf message including the length header.
/// </summary>
/// <param name="protoDefinitions">The Proto definition content used to resolve message types.</param>
/// <param name="messageType">The fully qualified ProtoBuf message type name to serialize to.</param>
/// <param name="value">The source object to convert.</param>
/// <param name="jsonConverter">Optional JSON converter used during serialization.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The serialized ProtoBuf payload with header, or an empty byte array when input is invalid.</returns>
Task<byte[]> GetProtoBufMessageWithHeaderAsync(IReadOnlyList<string>? protoDefinitions, string? messageType, object? value, IJsonConverter? jsonConverter = null, CancellationToken cancellationToken = default);
/// <summary>
/// Updates the response builder to return a ProtoBuf body using method-level or mapping-level proto definitions.
/// </summary>
/// <param name="responseBuilder">The response builder to update.</param>
/// <param name="protoBufMessageType">The ProtoBuf message type for the response body.</param>
/// <param name="bodyAsJson">The response body object represented as JSON-like data.</param>
/// <param name="protoDefinitions">Optional Proto definitions for this call; when omitted, mapping/server-level definitions are used.</param>
/// <returns>The updated response builder.</returns>
IResponseBuilder UpdateResponseBuilder(IResponseBuilder responseBuilder, string protoBufMessageType, object bodyAsJson, params string[] protoDefinitions);
}