-
-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JsonPartialMatcher - support Regex (#771)
* JsonPartialMatcher - support Regex * . * . * more tests * . * .
- Loading branch information
Showing
20 changed files
with
1,726 additions
and
1,578 deletions.
There are no files selected for viewing
94 changes: 49 additions & 45 deletions
94
src/WireMock.Net.Abstractions/Admin/Mappings/MatcherModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,52 @@ | ||
namespace WireMock.Admin.Mappings | ||
namespace WireMock.Admin.Mappings; | ||
|
||
/// <summary> | ||
/// MatcherModel | ||
/// </summary> | ||
[FluentBuilder.AutoGenerateBuilder] | ||
public class MatcherModel | ||
{ | ||
/// <summary> | ||
/// MatcherModel | ||
/// </summary> | ||
[FluentBuilder.AutoGenerateBuilder] | ||
public class MatcherModel | ||
{ | ||
/// <summary> | ||
/// Gets or sets the name. | ||
/// </summary> | ||
public string Name { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the pattern. Can be a string (default) or an object. | ||
/// </summary> | ||
public object? Pattern { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the patterns. Can be array of strings (default) or an array of objects. | ||
/// </summary> | ||
public object[]? Patterns { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the pattern as a file. | ||
/// </summary> | ||
public string? PatternAsFile { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the ignore case. | ||
/// </summary> | ||
public bool? IgnoreCase { get; set; } | ||
|
||
/// <summary> | ||
/// Reject on match. | ||
/// </summary> | ||
public bool? RejectOnMatch { get; set; } | ||
|
||
/// <summary> | ||
/// The Operator to use when multiple patterns are defined. Optional. | ||
/// - null = Same as "or". | ||
/// - "or" = Only one pattern should match. | ||
/// - "and" = All patterns should match. | ||
/// - "average" = The average value from all patterns. | ||
/// </summary> | ||
public string? MatchOperator { get; set; } | ||
} | ||
/// Gets or sets the name. | ||
/// </summary> | ||
public string Name { get; set; } = null!; | ||
|
||
/// <summary> | ||
/// Gets or sets the pattern. Can be a string (default) or an object. | ||
/// </summary> | ||
public object? Pattern { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the patterns. Can be array of strings (default) or an array of objects. | ||
/// </summary> | ||
public object[]? Patterns { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the pattern as a file. | ||
/// </summary> | ||
public string? PatternAsFile { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the ignore case. | ||
/// </summary> | ||
public bool? IgnoreCase { get; set; } | ||
|
||
/// <summary> | ||
/// Reject on match. | ||
/// </summary> | ||
public bool? RejectOnMatch { get; set; } | ||
|
||
/// <summary> | ||
/// The Operator to use when multiple patterns are defined. Optional. | ||
/// - null = Same as "or". | ||
/// - "or" = Only one pattern should match. | ||
/// - "and" = All patterns should match. | ||
/// - "average" = The average value from all patterns. | ||
/// </summary> | ||
public string? MatchOperator { get; set; } | ||
|
||
/// <summary> | ||
/// Support Regex, only used for JsonPartialMatcher. | ||
/// </summary> | ||
public bool? Regex { get; set; } | ||
} |
27 changes: 12 additions & 15 deletions
27
src/WireMock.Net.Abstractions/Matchers/Request/IRequestMatcher.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,17 @@ | ||
using JetBrains.Annotations; | ||
namespace WireMock.Matchers.Request; | ||
|
||
namespace WireMock.Matchers.Request | ||
/// <summary> | ||
/// The RequestMatcher interface. | ||
/// </summary> | ||
public interface IRequestMatcher | ||
{ | ||
/// <summary> | ||
/// The RequestMatcher interface. | ||
/// Determines whether the specified RequestMessage is match. | ||
/// </summary> | ||
public interface IRequestMatcher | ||
{ | ||
/// <summary> | ||
/// Determines whether the specified RequestMessage is match. | ||
/// </summary> | ||
/// <param name="requestMessage">The RequestMessage.</param> | ||
/// <param name="requestMatchResult">The RequestMatchResult.</param> | ||
/// <returns> | ||
/// A value between 0.0 - 1.0 of the similarity. | ||
/// </returns> | ||
double GetMatchingScore(IRequestMessage requestMessage, IRequestMatchResult requestMatchResult); | ||
} | ||
/// <param name="requestMessage">The RequestMessage.</param> | ||
/// <param name="requestMatchResult">The RequestMatchResult.</param> | ||
/// <returns> | ||
/// A value between 0.0 - 1.0 of the similarity. | ||
/// </returns> | ||
double GetMatchingScore(IRequestMessage requestMessage, IRequestMatchResult requestMatchResult); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.