Class OpenApiDocumentBuilder

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

Inverse of the IBowireOpenApiAdapter's discovery path: emit an OpenAPI 3.0 document from a Bowire discovery result. Sibling to AsyncApiDocumentBuilder — same pure-builder shape, no IO, no wire-plugin lookup. Lets the workbench, the CLI, or a future MCP tool turn a discovered REST surface back into a portable schema artefact teams can check into their docs repo or feed back into Bowire as a discovery source.

public static class OpenApiDocumentBuilder
Inheritance
OpenApiDocumentBuilder
Inherited Members

Remarks

Mapping BowireServiceInfo → OpenAPI:

  • servers[0] ← the serverUrl argument verbatim.
  • paths[<HttpPath>][<httpVerb>] ← one entry per method; operationId = method name, summary / description / deprecated ride through.
  • parameters[] ← path placeholders detected as {name} segments in HttpPath, plus any BowireFieldInfo whose Source{path, query, header}.
  • requestBody ← body fields synthesised into a JSON-Schema property map. POST / PUT / PATCH get a body; GET / DELETE / HEAD don't (heuristic — matches the OpenAPI convention).
  • responses["200"].content.application/json.schema ← output-type fields, same JSON-Schema synthesis.

When a BowireRecording is supplied the exporter stamps each operation with an x-bowire-coverage extension reporting whether the recording carries at least one captured step for this (httpVerb, httpPath) pair, plus the captured step count. That's the coverage layer your mock-as-stand-in needs: consumers see the full contract the original advertised (because the mock serves back the recording's SourceSchema verbatim) and exactly which slice of it this recording can replay deterministically vs. which slice would have to fall back to schema-generated samples.

Methods

Build(string, IReadOnlyList<BowireServiceInfo>, BowireRecording?, OpenApiExportOptions?)

Build the OpenAPI document.

public static string Build(string serverUrl, IReadOnlyList<BowireServiceInfo> services, BowireRecording? recording = null, OpenApiExportOptions? options = null)

Parameters

serverUrl string

URL the discovery ran against; lands on servers[0].url.

services IReadOnlyList<BowireServiceInfo>

Services returned by BowireRestProtocol.DiscoverAsync.

recording BowireRecording

Optional recording — when supplied, every operation gets an x-bowire-coverage entry from the recording's step list.

options OpenApiExportOptions

Output format / title / version knobs.

Returns

string