docs: add Cargo.toml dependency snippet to Getting Started#567
Open
alexchenai wants to merge 1 commit intographql-rust:mainfrom
Open
docs: add Cargo.toml dependency snippet to Getting Started#567alexchenai wants to merge 1 commit intographql-rust:mainfrom
alexchenai wants to merge 1 commit intographql-rust:mainfrom
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Cargo.tomlexample snippet to the Getting Started section showing required dependencies (graphql_client,serde,serde_json, and optionalreqwest)serdewith thederivefeature is needed alongsidegraphql_client, since the generated code derivesserde::Deserializeandserde::SerializeCloses #332
Context
As reported in #332, users new to GraphQL in Rust may not realize that
serdeis a required companion dependency. The generated code from the#[derive(GraphQLQuery)]macro produces types that derive serde traits, so havingserdewith thederivefeature in the user'sCargo.tomlis necessary. Adding a clear dependency snippet in the README's Getting Started section removes this friction for newcomers.Changes
README.md: Added aCargo.tomlcode 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)