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 athemql-coreResolvercall.GraphqlResolverBridgeImpl— concrete bridge wrappingArc<dyn themql_core::Resolver>.QueryRoot,MutationRoot,SubscriptionRoot— async-graphql root objects with real fields that delegate to the bridge.GraphqlSchemaImpl— holds a builtasync_graphql::Schema<QueryRoot, MutationRoot, SubscriptionRoot>.serve_graphql— axumRoutermounting the GraphQL endpoint at/graphql(POST for query/mutation, GET with WebSocket upgrade for subscription).
Structs§
- Dispatch
Bridge Impl - Concrete
DispatchBridgewrappingArc<dyn themql_core::MessageHandler>. - Graphql
Resolver Bridge Impl - Concrete
GraphqlResolverBridgewrappingArc<dyn themql_core::Resolver>. - Graphql
Schema Impl - Concrete
GraphqlSchemaholding a builtasync_graphql::Schema<QueryRoot, MutationRoot, SubscriptionRoot>. - Mutation
Root - GraphQL
Mutationroot. Delegates command dispatch to athemql_core::MessageHandlerviaDispatchBridge. - Query
Root - GraphQL
Queryroot. Each field delegates to athemql-coreResolverviaGraphqlResolverBridge. - Role
Guard - GraphQL field guard that requires a minimum
AuthRole. The role is read fromasync_graphql::Context::data::<AuthRole>(). - Subscription
Root - GraphQL
Subscriptionroot. Maps tothemql-messagestreams via the SSE bridge.
Enums§
- Auth
Role - User role for authorization. Per
specs/auth.toml [authz]. - Graphql
Error - Errors raised by the GraphQL adapter.
Traits§
- Dispatch
Bridge - Bridge that maps a GraphQL mutation dispatch to a
themql-coreMessageHandlercall. Dyn-compatible. - Graphql
Resolver Bridge - Bridge that maps a GraphQL field resolution to a
themql-coreResolvercall. Implementations are domain-specific. - Graphql
Schema - Built
async-graphqlschema, ready to serve. Implementations hold a constructedasync_graphql::Schema<QueryRoot, MutationRoot, SubscriptionRoot>and return a reference to it. - Graphql
Subscription Source - A source of live event streams keyed by subject. Implementations are
typically backed by
themql-sse’sTokioSsePublisher(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::Routermounting the GraphQL endpoint at/graphql:
Type Aliases§
- Json
Value Stream - A boxed, pinned stream of JSON values used by subscription sources.