Class RestMockHostingExtension

Namespace
Kuestenlogik.Bowire.Protocol.Rest.Mock
Assembly
Kuestenlogik.Bowire.Protocol.Rest.dll

REST plugin's mock-host extension. Serves the recording's verbatim SourceSchema back under the conventional OpenAPI endpoints so peer Bowire discovery against the mock returns the full contract the original target advertised, not just the slice this recording happens to replay.

public sealed class RestMockHostingExtension : IBowireMockHostingExtension
Inheritance
RestMockHostingExtension
Implements
Inherited Members

Remarks

Endpoints mapped (only when the recording carries an OpenAPI RecordingSourceSchema):

  • GET /openapi.json — content negotiated to JSON. YAML sources are converted to JSON via the OpenAPI reader so the downstream consumer doesn't have to depend on a YAML parser.
  • GET /openapi.yaml + GET /openapi.yml — verbatim text when the source was YAML; serialised to YAML when the source was JSON.
  • GET /swagger.json — alias for /openapi.json; a lot of legacy clients hardcode this path.

Picked up via assembly-scan (IBowirePluginLoader.EnumerateServices<IBowireMockHostingExtension>) at mock-server startup — same discovery pattern gRPC uses for its reflection-service mapping. Recordings without an OpenAPI source schema (gRPC-only, AsyncAPI-only, or pre-v1.7 captures that pre-date the sidecar) silently no-op.

Constructors

RestMockHostingExtension()

public RestMockHostingExtension()

Properties

Id

Stable id, lower-case, matching the protocol the extension belongs to (e.g. "grpc"). Surfaced in logs only — the host never dispatches by id, it always asks each extension in turn.

public string Id { get; }

Property Value

string

Methods

MapEndpoints(IEndpointRouteBuilder, BowireRecording)

Map protocol-specific endpoints. Called inside the mock host's UseEndpoints block, after the recording-replay middleware is mounted. gRPC uses this to map the reflection service so peer workbenches can auto-discover.

public void MapEndpoints(IEndpointRouteBuilder endpoints, BowireRecording recording)

Parameters

endpoints IEndpointRouteBuilder
recording BowireRecording