1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
//! GraphQL support for Reinhardt framework
//!
//! This crate provides GraphQL API support for the Reinhardt framework.
//!
//! # Features
//!
//! - **graphql-grpc**: GraphQL facade over gRPC for Query/Mutation
//! - **subscription**: gRPC-based Subscriptions (Rust 2024 compatible)
//! - **di**: Dependency injection support for GraphQL resolvers
//! - **full**: All features enabled
//!
//! # GraphQL over gRPC
//!
//! Each RPC accepts only its advertised query, mutation, or subscription operation.
//! The adapter returns gRPC `INVALID_ARGUMENT` for malformed documents, invalid or
//! ambiguous operation selections, and operation-class mismatches before execution.
//! Documents with multiple operations require an exact operation name. A single
//! operation may omit the name or pass an empty name. Schema validation and resolver
//! authorization still apply after this transport-level check. Subscription errors
//! are delivered through the response stream.
//!
//! Build custom gRPC schemas with `GraphQLGrpcService::schema_builder` instead of
//! `Schema::build` / `Schema::new`. This installs the operation guard before user
//! extensions, so preparation limits and document rewrites run in their normal
//! order. `GraphQLGrpcService::new` panics for unguarded schemas. The built-in
//! `create_schema` helpers install the guard when `graphql-grpc` is enabled.
//!
//! # Dependency Injection
//!
//! Enable the `di` feature to use dependency injection in GraphQL resolvers:
//!
//! ```toml
//! [dependencies]
//! reinhardt-graphql = { version = "0.1", features = ["di"] }
//! ```
//!
//! Then use the `#[graphql_handler]` macro:
//!
//! ```rust,no_run
//! # use async_graphql::{Context, Object, Result, ID, SimpleObject};
//! # use reinhardt_graphql::{graphql_handler, GraphQLContextExt};
//! # use reinhardt_di::{InjectionContext, Injectable, DiResult};
//! # use async_trait::async_trait;
//! #
//! # #[derive(Clone, SimpleObject)]
//! # struct User {
//! # id: ID,
//! # name: String,
//! # }
//! #
//! # #[derive(Clone)]
//! # struct DatabaseConnection;
//! #
//! # #[async_trait]
//! # impl Injectable for DatabaseConnection {
//! # async fn inject(_ctx: &InjectionContext) -> DiResult<Self> {
//! # Ok(DatabaseConnection)
//! # }
//! # }
//! #
//! # impl DatabaseConnection {
//! # async fn fetch_user(&self, id: &ID) -> Result<User> {
//! # Ok(User { id: id.clone(), name: "Test User".to_string() })
//! # }
//! # }
//! #
//! # struct Query;
//! #
//! #[Object]
//! impl Query {
//! async fn user(&self, ctx: &Context<'_>, id: ID) -> Result<User> {
//! user_impl(ctx, id).await
//! }
//! }
//!
//! #[graphql_handler]
//! async fn user_impl(
//! ctx: &Context<'_>,
//! id: ID,
//! #[inject] db: DatabaseConnection,
//! ) -> Result<User> {
//! // db is automatically resolved
//! db.fetch_user(&id).await
//! }
//! ```
/// GraphQL execution context and data loaders.
/// Resolver implementations for queries and mutations.
/// Schema definition, query limits, and built-in types.
/// Real-time GraphQL subscriptions with event broadcasting.
/// GraphQL scalar and input type definitions.
/// Dependency injection integration for GraphQL handlers.
/// GraphQL-over-gRPC service adapter.
pub use ;
pub use ;
pub use ;
pub use GraphQLGrpcService;
// gRPC integration: re-export of adapter traits and derive macros
pub use ;
pub use ;
// DI support: re-export extension traits and macro
pub use ;
pub use graphql_handler;
// Re-export async_graphql base types for facade pattern.
// These types are commonly needed by user code to define GraphQL schemas,
// resolvers, and error handling without depending on async_graphql directly.
pub use ;
/// Re-export of `async_graphql::http` module for HTTP integration utilities
/// such as `playground_source` and `GraphQLPlaygroundConfig`.
pub use http;