Class SourceSchemaCache

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

Process-wide cache of source-schema documents the wire plugins captured at discovery time, keyed by the server URL the discovery ran against. Lets the recording-save endpoint stamp SourceSchema automatically when the workbench writes a new recording, without the JS recorder having to know which plugin owns which URL.

public static class SourceSchemaCache
Inheritance
SourceSchemaCache
Inherited Members

Remarks

Population: each wire plugin writes one entry per call to its DiscoverAsync that successfully loaded a source schema — REST writes the verbatim OpenAPI text (JSON or YAML) keyed by the URL the user pointed Bowire at; AsyncAPI writes the NormalisedYaml the loader already preserves. Plugins that have no source schema (gRPC, SignalR, the wire-driven MQTT/NATS/ Kafka discovery paths) simply don't write — the cache stays empty for those URLs and the recording endpoint silently leaves SourceSchema null.

Lookup: BowireRecordingEndpoints takes the first step's ServerUrl from each recording being saved and consults this cache. Found → stamp the recording's SourceSchema; missing → no-op.

Lifetime: process-wide, lives for the workbench host's runtime. Cleared by Clear() in tests; in production a fresh discovery call simply overwrites the existing entry, which keeps the cache consistent with the latest schema fetch.

Methods

Clear()

Drop every entry. Test-only; production callers shouldn't need this — a fresh discovery overwrites in place.

public static void Clear()

Get(string?)

Look up the source-schema entry for serverUrl. Returns null when the URL hasn't been seen — recording enrichment treats that as "no schema available" and leaves SourceSchema untouched.

public static RecordingSourceSchema? Get(string? serverUrl)

Parameters

serverUrl string

Returns

RecordingSourceSchema

Set(string, RecordingSourceSchema)

Store a source-schema entry for serverUrl. Called by wire plugins during DiscoverAsync. Overwrites any prior entry for the same URL — the most recent discovery wins.

public static void Set(string serverUrl, RecordingSourceSchema schema)

Parameters

serverUrl string
schema RecordingSourceSchema