Skip to main content

Crate themql_graphql

Crate themql_graphql 

Source
Expand description

§themql-graphql

GraphQL projection of theMQL’s core query model. async-graphql is the sole GraphQL implementation. GraphQL types are generated from or mapped to themql-core / themql-query types; GraphQL-specific types must not escape this crate.

See specs/graphql.toml for the authoritative specification.

This crate provides:

  • GraphqlResolverBridge — dyn-compatible trait mapping a GraphQL field resolution to a themql-core Resolver call.
  • GraphqlResolverBridgeImpl — concrete bridge wrapping Arc<dyn themql_core::Resolver>.
  • QueryRoot, MutationRoot, SubscriptionRoot — async-graphql root objects with real fields that delegate to the bridge.
  • GraphqlSchemaImpl — holds a built async_graphql::Schema<QueryRoot, MutationRoot, SubscriptionRoot>.
  • serve_graphql — axum Router mounting the GraphQL endpoint at /graphql (POST for query/mutation, GET with WebSocket upgrade for subscription).

Structs§

DispatchBridgeImpl
Concrete DispatchBridge wrapping Arc<dyn themql_core::MessageHandler>.
GraphqlResolverBridgeImpl
Concrete GraphqlResolverBridge wrapping Arc<dyn themql_core::Resolver>.
GraphqlSchemaImpl
Concrete GraphqlSchema holding a built async_graphql::Schema<QueryRoot, MutationRoot, SubscriptionRoot>.
MutationRoot
GraphQL Mutation root. Delegates command dispatch to a themql_core::MessageHandler via DispatchBridge.
QueryRoot
GraphQL Query root. Each field delegates to a themql-core Resolver via GraphqlResolverBridge.
RoleGuard
GraphQL field guard that requires a minimum AuthRole. The role is read from async_graphql::Context::data::<AuthRole>().
SubscriptionRoot
GraphQL Subscription root. Maps to themql-message streams via the SSE bridge.

Enums§

AuthRole
User role for authorization. Per specs/auth.toml [authz].
GraphqlError
Errors raised by the GraphQL adapter.

Traits§

DispatchBridge
Bridge that maps a GraphQL mutation dispatch to a themql-core MessageHandler call. Dyn-compatible.
GraphqlResolverBridge
Bridge that maps a GraphQL field resolution to a themql-core Resolver call. Implementations are domain-specific.
GraphqlSchema
Built async-graphql schema, ready to serve. Implementations hold a constructed async_graphql::Schema<QueryRoot, MutationRoot, SubscriptionRoot> and return a reference to it.
GraphqlSubscriptionSource
A source of live event streams keyed by subject. Implementations are typically backed by themql-sse’s TokioSsePublisher (broadcast channel) but any transport that can produce a stream of JSON values for a given subject can implement this trait.

Functions§

serve_graphql
Build an axum::Router mounting the GraphQL endpoint at /graphql:

Type Aliases§

JsonValueStream
A boxed, pinned stream of JSON values used by subscription sources.