$ graphql_client

v0.15.0MAJOR UPDATE

Typed GraphQL requests and responses

Downloads: 19.8M
Recent: 2.6M
Versions: 18
Updated: December 8, 2025

Latest Update Summary

Crate

Name: graphql_client New version: 0.15.0 Release date: 2025-12-08T16:51:44.082687Z

Crate readme

Short description A typed GraphQL client library for Rust.

Long description graphql_client is a typed GraphQL client for Rust, providing precise types for query variables and responses, supports WebAssembly, subscriptions, and custom scalars. It allows for multiple operations per query and ensures type safety with deprecated field checks.

Features • Precise types for query variables and responses. • Supports GraphQL fragments, objects, unions, inputs, enums, custom scalars and input objects. • Works in the browser (WebAssembly). • Subscriptions support (serialization-deserialization only at the moment). • Copies documentation from the GraphQL schema to the generated Rust code. • Arbitrary custom scalars. • Supports multiple operations per query document. • Supports setting GraphQL fields as deprecated and having the Rust compiler check their use. • Optional reqwest-based client for boilerplate-free API calls from browsers. • Implicit and explicit null support.

Code Examples Basic usage

 use graphql_client::GraphQLQuery;

#[derive(GraphQLQuery)]
#[graphql(
    schema_path = "tests/unions/union_schema.graphql",
    query_path = "tests/unions/union_query.graphql",
)]
pub struct UnionQuery;

Performing a query

 async fn perform_my_query(variables: union_query::Variables) -> Result<(), Box<dyn Error>> {
    let request_body = UnionQuery::build_query(variables);
    let client = reqwest::Client::new();
    let mut res = client.post("/graphql").json(&request_body).send().await?;
    let response_body: Response<union_query::ResponseData> = res.json().await?;
    println!("{:?#?}", response_body);
    Ok(())
}

Linkshttps://graphql.org/https://github.com/graphql-rust/graphql-client/tree/main/graphql_client_clihttps://github.com/graphql-rust/graphql-client/tree/main/examples/githubhttps://github.com/graphql-rust/graphql-client/tree/main/examples

https://api.github.com/repos/graphql-rust/graphql-client/releases/268407274

Release info

Release version:

Release description

Code Examples

Minor update: 0.14.0 → 0.15.0

$ DOWNLOADS TREND

18.1M19.8M

$ VERSION HISTORY

v0.15.0December 8, 2025
v0.14.0March 26, 2024

$ LINKS

$ INSTALL

cargo add graphql_client

Or add to Cargo.toml: graphql_client = "0.15.0"