| Crates.io | reinhardt-graphql-macros |
| lib.rs | reinhardt-graphql-macros |
| version | 0.1.0-alpha.1 |
| created_at | 2026-01-23 02:37:16.008279+00 |
| updated_at | 2026-01-23 02:37:16.008279+00 |
| description | Procedural macros for GraphQL schema generation |
| homepage | |
| repository | https://github.com/kent8192/reinhardt-rs |
| max_upload_size | |
| id | 2063214 |
| size | 35,835 |
Derive macros for GraphQL-gRPC integration in Reinhardt framework
reinhardt-graphql-macros provides procedural macros to simplify the integration between gRPC and GraphQL in the Reinhardt framework. These macros automatically generate conversion code and subscription implementations to reduce boilerplate.
This is an internal subcrate of reinhardt-graphql. Users should depend on reinhardt (the parent crate) instead of this crate directly.
# ✅ Correct - use the reinhardt parent crate
[dependencies]
reinhardt = { version = "0.1.0-alpha.1", features = ["graphql"] }
# Or use a preset:
# reinhardt = { version = "0.1.0-alpha.1", features = ["standard"] } # Recommended
# reinhardt = { version = "0.1.0-alpha.1", features = ["full"] } # All features
# ❌ Incorrect - don't depend on this crate directly
[dependencies]
reinhardt-graphql-macros = "0.1.0-alpha.1"
The macros are automatically re-exported by reinhardt::graphql:
// ✅ Correct - import from the reinhardt parent crate
use reinhardt::graphql::{GrpcGraphQLConvert, GrpcSubscription};
// Or use the macros module
use reinhardt::graphql::macros::{GrpcGraphQLConvert, GrpcSubscription};
GrpcGraphQLConvert - Automatic type conversion between Protobuf and GraphQL types
From<proto::T> for T and From<T> for proto::T#[graphql(rename_all = "camelCase")]#[graphql(skip_if = "...")]#[proto(...)] attributesGrpcSubscription - Automatic GraphQL subscription from gRPC streams
#[grpc(service = "...", method = "...")]#[graphql(filter = "...")]use reinhardt::graphql::GrpcGraphQLConvert;
#[derive(GrpcGraphQLConvert)]
#[graphql(rename_all = "camelCase")]
struct User {
id: String,
name: String,
#[graphql(skip_if = "Option::is_none")]
email: Option<String>,
}
This generates:
From<proto::User> for UserFrom<User> for proto::Useruse reinhardt::graphql::GrpcSubscription;
#[derive(GrpcSubscription)]
#[grpc(service = "UserEventsServiceClient", method = "subscribe_user_events")]
#[graphql(filter = "event_type == Created")]
struct UserCreatedSubscription;
This automatically generates a GraphQL subscription implementation that:
#[graphql(rename_all = "...")] - Rename all fields (camelCase, snake_case, PascalCase)#[graphql(skip_if = "...")] - Skip field if predicate is true#[proto(type = "...")] - Specify custom protobuf type#[proto(rename = "...")] - Rename field in protobuf#[grpc(service = "...")] - gRPC service client name#[grpc(method = "...")] - gRPC method name#[graphql(filter = "...")] - Filter expression for eventsLicensed under either of Apache License, Version 2.0 or MIT license at your option.