Interface IBowireUploadedSchemaReader
- Namespace
- Kuestenlogik.Bowire
- Assembly
- Kuestenlogik.Bowire.dll
A protocol plugin that imports schema documents core cannot read (#991, #994).
public interface IBowireUploadedSchemaReader
Remarks
Core stores what the workbench uploads and merges it into discovery, so
the workbench, bowire discover and the MCP tool agree on what a URL
offers. For a .proto it can do the reading itself. Every other
format belongs to the plugin that speaks its protocol: a compiled
descriptor set needs the protobuf runtime, GraphQL SDL a GraphQL parser,
an EDMX document the OData model library. Core references none of them
and should not start to, because every host that embeds Bowire would
carry them.
So a plugin declares the kinds it imports, and core asks through this interface: once when a document is uploaded, to refuse one that is not what its name says, and again when discovery lists what is stored. The upload endpoint routes a file to a kind by the extensions declared here; the file picker accepts what the loaded plugins declare.
Properties
UploadedSchemaKinds
The schema kinds this plugin imports.
IReadOnlyList<BowireUploadedSchemaKind> UploadedSchemaKinds { get; }
Property Value
Methods
LooksLikeUploadedSchema(string, ReadOnlyMemory<byte>)
Whether document looks like a document of
kind.
bool LooksLikeUploadedSchema(string kind, ReadOnlyMemory<byte> document)
Parameters
kindstringdocumentReadOnlyMemory<byte>
Returns
Remarks
Asked only when the file name does not settle the kind: several kinds
declare the extension (.json is OpenAPI, AsyncAPI and OpenRPC),
or none does. A cheap look at the head of the document is enough, e.g.
its top-level key or root element; the full read happens in
ReadUploadedSchema(string, ReadOnlyMemory<byte>, string). The default says no, which suits a
kind whose extensions are its own.
ReadUploadedSchema(string, ReadOnlyMemory<byte>, string)
The services one document of kind describes, in the
shape the plugin's own discovery returns them.
IReadOnlyList<BowireServiceInfo> ReadUploadedSchema(string kind, ReadOnlyMemory<byte> document, string sourceName)
Parameters
kindstringOne of UploadedSchemaKinds.
documentReadOnlyMemory<byte>The document as it was uploaded.
sourceNamestringThe file name it was uploaded under.
Returns
Exceptions
- FormatException
The bytes are not a document of this kind.