Class MockConfigApplier
- Namespace
- Kuestenlogik.Bowire.Mocking
- Assembly
- Kuestenlogik.Bowire.dll
Applies a MockConfiguration's per-field overrides onto a
(schema-synthesised or recorded) BowireRecording at
generation time (#558). For every step whose service/method
an override targets, the step's JSON response is parsed, the value at the
override's path is set, and the response is written back.
public static class MockConfigApplier
- Inheritance
-
MockConfigApplier
- Inherited Members
Remarks
Apply(BowireRecording, MockConfiguration?) evaluates FieldOverrides at generation time (#558). ApplyToStubs(IReadOnlyList<BowireRecordingStep>, MockConfiguration?) (#561) additionally compiles ConditionalRules into extra higher-priority stubs so the existing mock matcher serves a response variant when the request predicate matches — no new serve-time path.
The applier lives in the shared Mocking namespace so the standalone
MockServer, the workbench mock host, and the runtime config-apply
endpoint all reuse one copy.
Methods
Apply(BowireRecording, MockConfiguration?)
Return recording with every applicable per-field
override applied to its steps' responses. Mutates the passed
recording in place (and returns it) so callers can inline the call.
A null / override-free config, an unparseable step response, or a
path that does not resolve leaves the step untouched.
public static BowireRecording Apply(BowireRecording recording, MockConfiguration? config)
Parameters
recordingBowireRecordingconfigMockConfiguration
Returns
ApplyToStubs(IReadOnlyList<BowireRecordingStep>, MockConfiguration?)
#561: apply a configuration onto a fresh copy of a mock's baseline
stubs and return the new stub set — used to re-apply the config to a
RUNNING mock. Never mutates baseline (the caller's
stubs share instances with the mock's restore baseline): every step is
cloned first. Field overrides mutate the clones' responses; each
conditional rule is compiled into an additional stub that rides the
matching base stub's route, carries the rule's request predicate as a
higher-priority match, and serves the rule's response variant.
public static IReadOnlyList<BowireRecordingStep> ApplyToStubs(IReadOnlyList<BowireRecordingStep> baseline, MockConfiguration? config)
Parameters
baselineIReadOnlyList<BowireRecordingStep>configMockConfiguration