Class BowireBodyMatcher

Namespace
Kuestenlogik.Bowire.Mocking
Assembly
Kuestenlogik.Bowire.dll

A request-body match predicate (mock matcher, #403). Exactly one mode applies, in this precedence:

  1. JsonPath set → navigate into the JSON body and apply the text op (EqualTo / Contains / Matches) to the value there, or — with no op — assert the path is present (or, with present:false, absent).
  2. EqualToJson set → semantic JSON equality against the whole body (order- and whitespace-insensitive), honouring IgnoreExtraElements and IgnoreArrayOrder.
  3. otherwise → the text op applies to the raw body string.

XPath and JSON-schema body matching are not yet implemented (tracked as a follow-up on #403).

public sealed class BowireBodyMatcher
Inheritance
BowireBodyMatcher
Inherited Members

Constructors

BowireBodyMatcher()

public BowireBodyMatcher()

Properties

CaseInsensitive

Case-insensitive comparison for the text ops.

[JsonPropertyName("caseInsensitive")]
public bool CaseInsensitive { get; init; }

Property Value

bool

Contains

Substring match (raw body, or the JsonPath value).

[JsonPropertyName("contains")]
public string? Contains { get; init; }

Property Value

string

EqualTo

Exact match (raw body, or the JsonPath value).

[JsonPropertyName("equals")]
public string? EqualTo { get; init; }

Property Value

string

EqualToJson

Expected JSON (as text) for semantic whole-body equality.

[JsonPropertyName("equalToJson")]
public string? EqualToJson { get; init; }

Property Value

string

IgnoreArrayOrder

For EqualToJson: compare arrays as multisets (order-independent).

[JsonPropertyName("ignoreArrayOrder")]
public bool IgnoreArrayOrder { get; init; }

Property Value

bool

IgnoreExtraElements

For EqualToJson: allow the actual body to carry properties the expected doesn't.

[JsonPropertyName("ignoreExtraElements")]
public bool IgnoreExtraElements { get; init; }

Property Value

bool

JsonPath

JSONPath into the body, e.g. \(.user.id</code> or <code>\).items[0].sku (also accepts the dotted user.id form).

[JsonPropertyName("jsonPath")]
public string? JsonPath { get; init; }

Property Value

string

Matches

Regex match (raw body, or the JsonPath value).

[JsonPropertyName("matches")]
public string? Matches { get; init; }

Property Value

string

Present

For JsonPath with no text op: true = path must exist, false = must NOT exist.

[JsonPropertyName("present")]
public bool? Present { get; init; }

Property Value

bool?