Class OpenApi2Adapter
- Namespace
- Kuestenlogik.Bowire.Protocol.Rest.OpenApi2
- Assembly
- Kuestenlogik.Bowire.Protocol.Rest.OpenApi2.dll
IBowireOpenApiAdapter implementation backed by
Microsoft.OpenApi 2.x — the .NET 10 ecosystem default
(ASP.NET Core 10's AddOpenApi() pins this line). Embedded
hosts that mix Bowire's REST plugin with their own ASP.NET OpenAPI
pipeline should reference this package instead of
Kuestenlogik.Bowire.Protocol.Rest.OpenApi3 to keep a single
Microsoft.OpenApi.dll version in the process.
public sealed class OpenApi2Adapter : IBowireOpenApiAdapter
- Inheritance
-
OpenApi2Adapter
- Implements
- Inherited Members
Constructors
OpenApi2Adapter()
public OpenApi2Adapter()
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
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
pathstringctCancellationToken
Returns
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
docUrlstringhttpHttpClientctCancellationToken
Returns
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
contentstringVerbatim document body — JSON or YAML.
sourceLabelstringDisplay label for the document; surfaces in caches and recordings.
ctCancellationTokenCancellation token.