Class GraphQlMockSchemaSource
- Namespace
- Kuestenlogik.Bowire.Protocol.GraphQL.Mock
- Assembly
- Kuestenlogik.Bowire.Protocol.GraphQL.dll
GraphQL plugin's contribution to the Bowire mock server's schema-only flow. Differs from the OpenAPI / Protobuf sources because GraphQL responses are selection-set-dependent — there's no way to pre-bake them into a static BowireRecording. Therefore BuildAsync(string, CancellationToken) returns an empty recording and the actual request handling lives in the companion IBowireMockLiveSchemaHandler implementation, which the mock server registers as middleware in front of the recording-replay pipeline.
public sealed class GraphQlMockSchemaSource : IBowireMockSchemaSource, IBowireMockLiveSchemaHandler
- Inheritance
-
GraphQlMockSchemaSource
- Implements
- Inherited Members
Constructors
GraphQlMockSchemaSource()
public GraphQlMockSchemaSource()
Properties
Kind
Schema kind id matching the CLI flag — "openapi" for
--schema, "protobuf" for --grpc-schema,
"graphql" for --graphql-schema.
public string Kind { get; }
Property Value
Methods
BuildAsync(string, CancellationToken)
Build a BowireRecording from the schema file at
path. Implementations may throw
InvalidDataException for malformed schemas — the
host catches and surfaces the message.
For schema kinds whose responses are dispatch-time-dependent (e.g. GraphQL — the response shape varies with the selection set), implementations may return an empty recording and rely on a companion middleware. See IBowireMockLiveSchemaHandler for that path.
public Task<BowireRecording> BuildAsync(string path, CancellationToken ct)
Parameters
pathstringctCancellationToken
Returns
LoadAsync(string, ILogger, CancellationToken)
Load schema state from path. Called once at
MockServer startup. Implementations should cache parsed schema
data on the instance for use by TryHandleAsync(HttpContext, CancellationToken).
public Task LoadAsync(string path, ILogger logger, CancellationToken ct)
Parameters
pathstringloggerILoggerctCancellationToken
Returns
TryHandleAsync(HttpContext, CancellationToken)
Handle the incoming request if it matches this schema kind.
Return true when handled (response written), false
to fall through to downstream middleware.
public Task<bool> TryHandleAsync(HttpContext ctx, CancellationToken ct)
Parameters
ctxHttpContextctCancellationToken