Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow using #[derive(GraphQLQuery)] without depending on serde #487

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Commits on May 30, 2024

  1. Allow using #[derive(GraphQLQuery)] without depending on serde

    This PR makes the serde derives emitted by `#[derive(GraphQLQuery)]` use
    a private re-export of the serde crate instead of relying on users of
    this crate having added serde to their `Cargo.toml`.
    
    Serde allows you to add an annotation
    
        #[serde(crate = "<path to crate>")]
    
    for exactly this reason so most of this PR is just plumbing the correct
    path through the codegen crate to the correct annotation.
    
    Details
    -------
    - There is a new `#[doc(hidden)] mod _private` declaration in the
      `graphql_client` crate. All re-exports (which is just serde) have been
       placed there.
    - I have added a new `serde_path` field to `GraphQLCodegenOptions` which
      defaults to `::serde`. This means that the code generated by the CLI
      should remain effectively unchanged.
    - The rest is just applying `#[serde(crate = ...)]` annotations where
      appropriate.
    
    Fixes graphql-rust#427
    swlynch99 committed May 30, 2024
    Configuration menu
    Copy the full SHA
    830d890 View commit details
    Browse the repository at this point in the history