mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 22:30:41 +01:00
Update WireMockOpenApiParserSettings
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -111,12 +111,15 @@ namespace WireMock.Net.OpenApiParser.Mappers
|
||||
return null;
|
||||
}
|
||||
|
||||
var requestBodyModel = new BodyModel();
|
||||
requestBodyModel.Matcher = new MatcherModel();
|
||||
requestBodyModel.Matcher.Name = "JsonMatcher";
|
||||
requestBodyModel.Matcher.Pattern = JsonConvert.SerializeObject(requestBody, Formatting.Indented);
|
||||
requestBodyModel.Matcher.IgnoreCase = _settings.IgnoreCaseRequestBody;
|
||||
return requestBodyModel;
|
||||
return new BodyModel
|
||||
{
|
||||
Matcher = new MatcherModel
|
||||
{
|
||||
Name = "JsonMatcher",
|
||||
Pattern = JsonConvert.SerializeObject(requestBody, Formatting.Indented),
|
||||
IgnoreCase = _settings.RequestBodyIgnoreCase
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private bool TryGetContent(IDictionary<string, OpenApiMediaType> contents, out OpenApiMediaType openApiMediaType, out string contentType)
|
||||
@@ -328,7 +331,7 @@ namespace WireMock.Net.OpenApiParser.Mappers
|
||||
.Select(qp => new ParamModel
|
||||
{
|
||||
Name = qp.Name,
|
||||
IgnoreCase = _settings.IgnoreCaseQueryParams,
|
||||
IgnoreCase = _settings.QueryParameterPatternIgnoreCase,
|
||||
Matchers = new[]
|
||||
{
|
||||
GetExampleMatcherModel(qp.Schema, _settings.QueryParameterPatternToUse)
|
||||
@@ -346,7 +349,7 @@ namespace WireMock.Net.OpenApiParser.Mappers
|
||||
.Select(qp => new HeaderModel
|
||||
{
|
||||
Name = qp.Name,
|
||||
IgnoreCase = _settings.IgnoreCaseHeaders,
|
||||
IgnoreCase = _settings.HeaderPatternIgnoreCase,
|
||||
Matchers = new[]
|
||||
{
|
||||
GetExampleMatcherModel(qp.Schema, _settings.HeaderPatternToUse)
|
||||
|
||||
@@ -28,33 +28,37 @@ namespace WireMock.Net.OpenApiParser.Settings
|
||||
public ExampleValueType QueryParameterPatternToUse { get; set; } = ExampleValueType.Value;
|
||||
|
||||
/// <summary>
|
||||
/// The example values to use
|
||||
/// The example values to use.
|
||||
///
|
||||
/// Default implementations are:
|
||||
/// - <see cref="WireMockOpenApiParserExampleValues"/>
|
||||
/// - <see cref="WireMockOpenApiParserDynamicExampleValues"/>
|
||||
/// </summary>
|
||||
public IWireMockOpenApiParserExampleValues ExampleValues { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Are examples generated dynamically?
|
||||
/// Is a Header match case insensitive? (default is true).
|
||||
/// </summary>
|
||||
public bool DynamicExamples { get; set; } = false;
|
||||
public bool HeaderPatternIgnoreCase { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Is headers case sensitive? (default is true).
|
||||
/// Is a Query Parameter match case insensitive? (default is true).
|
||||
/// </summary>
|
||||
public bool IgnoreCaseHeaders { get; set; } = true;
|
||||
public bool QueryParameterPatternIgnoreCase { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Is query params case sensitive? (default is true).
|
||||
/// Is a Request Body match case insensitive? (default is true).
|
||||
/// </summary>
|
||||
public bool IgnoreCaseQueryParams { get; set; } = true;
|
||||
public bool RequestBodyIgnoreCase { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Is request body case sensitive? (default is true).
|
||||
/// </summary>
|
||||
public bool IgnoreCaseRequestBody { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Are example values case sensitive? (default is true).
|
||||
/// Is a ExampleValue match case insensitive? (default is true).
|
||||
/// </summary>
|
||||
public bool IgnoreCaseExampleValues { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Are examples generated dynamically? (default is false).
|
||||
/// </summary>
|
||||
public bool DynamicExamples { get; set; } = false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user