Skip to content

docs: add Cargo.toml dependency snippet to Getting Started#567

Open
alexchenai wants to merge 1 commit intographql-rust:mainfrom
alexchenai:fix/add-cargo-toml-getting-started
Open

docs: add Cargo.toml dependency snippet to Getting Started#567
alexchenai wants to merge 1 commit intographql-rust:mainfrom
alexchenai:fix/add-cargo-toml-getting-started

Conversation

@alexchenai
Copy link

Summary

  • Adds a Cargo.toml example snippet to the Getting Started section showing required dependencies (graphql_client, serde, serde_json, and optional reqwest)
  • Helps new users understand that serde with the derive feature is needed alongside graphql_client, since the generated code derives serde::Deserialize and serde::Serialize

Closes #332

Context

As reported in #332, users new to GraphQL in Rust may not realize that serde is a required companion dependency. The generated code from the #[derive(GraphQLQuery)] macro produces types that derive serde traits, so having serde with the derive feature in the user's Cargo.toml is necessary. Adding a clear dependency snippet in the README's Getting Started section removes this friction for newcomers.

Changes

  • README.md: Added a Cargo.toml code block between the GraphQL introduction bullet point and the query file instructions, showing:
    • graphql_client = "0.16"
    • serde = { version = "1", features = ["derive"] }
    • serde_json = "1"
    • reqwest (commented as optional)

Adds a Cargo.toml example showing the required dependencies
(graphql_client, serde, serde_json) to the Getting Started section of
the README. This helps new users who may not realize that serde is
needed alongside graphql_client.

Closes graphql-rust#332

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show required serde dependency in README

1 participant