Class OpenApi3Adapter

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

IBowireOpenApiAdapter implementation backed by Microsoft.OpenApi 3.x. Bridges the version-agnostic Bowire REST plugin to the modern OpenAPI library API. Found automatically by BowireOpenApiAdapterRegistry when this assembly is loaded; embedded hosts that want to pin a different Microsoft.OpenApi line reference Kuestenlogik.Bowire.Protocol.Rest.OpenApi2 instead.

public sealed class OpenApi3Adapter : IBowireOpenApiAdapter
Inheritance
OpenApi3Adapter
Implements
Inherited Members

Constructors

OpenApi3Adapter()

public OpenApi3Adapter()

Properties

OpenApiLibraryMajorVersion

Major version of the Microsoft.OpenApi library this adapter is built against. Used by BowireOpenApiAdapterRegistry to pick the right implementation when more than one adapter package is loaded (rare — typically only when a sideloaded plugin pulls in a second adapter). The registry prefers the adapter whose OpenApiLibraryMajorVersion matches the Microsoft.OpenApi assembly already loaded into the process; falls back to the lowest-numbered candidate when no match is available.

public int OpenApiLibraryMajorVersion { get; }

Property Value

int

Methods

BuildMockRecordingFromFileAsync(string, CancellationToken)

Read an OpenAPI document from disk and synthesise a BowireRecording with one step per operation + schema-generated example responses. Drives bowire mock --schema <path>.

public Task<BowireRecording> BuildMockRecordingFromFileAsync(string path, CancellationToken ct)

Parameters

path string
ct CancellationToken

Returns

Task<BowireRecording>

FetchAndDiscoverAsync(string, HttpClient, CancellationToken)

Fetch the OpenAPI document at docUrl via http and convert it into a list of Bowire services + the API base URL the workbench should fire requests at. Returns null when the URL isn't reachable, returns non-OpenAPI content, or the parse otherwise fails — the REST plugin treats null as "this URL isn't an OpenAPI doc" and lets sibling protocol plugins try the same URL.

public Task<BowireOpenApiDiscoveryResult?> FetchAndDiscoverAsync(string docUrl, HttpClient http, CancellationToken ct)

Parameters

docUrl string
http HttpClient
ct CancellationToken

Returns

Task<BowireOpenApiDiscoveryResult>

ParseAndDiscoverAsync(string, string, CancellationToken)

Parse OpenAPI/Swagger document text (JSON or YAML) without an HTTP fetch. Used for documents uploaded via the workbench's schema upload surface or pasted into the discovery prompt.

public Task<BowireOpenApiDiscoveryResult?> ParseAndDiscoverAsync(string content, string sourceLabel, CancellationToken ct)

Parameters

content string

Verbatim document body — JSON or YAML.

sourceLabel string

Display label for the document; surfaces in caches and recordings.

ct CancellationToken

Cancellation token.

Returns

Task<BowireOpenApiDiscoveryResult>