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

Add a gql!() generator macro. #358

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open

Add a gql!() generator macro. #358

wants to merge 18 commits into from

Conversation

Yatekii
Copy link

@Yatekii Yatekii commented Dec 30, 2021

Why are we making this change?

This PR introduces a new gql()! proc_macro, which allows the user to define adhoc queries, mutations and subscriptions like so:

cynic::gql! {
    mutation create_user($username: String!, $password: String!) {
        createUser(input: { username: $username, password: $password })
    }
}

This then generates a Rust function and all the necessary types & imports much like the cynic generator. Which then can automatically do the request for you.
This allows for very easy and smooth RPC call generation.

What effects does this change have?

  • Adds more precise error messages to the parser parts of cynic (needs a custom graphql-parser fork for now).
  • Adds a new gql!() macro to generate GraphQL RPC calls.

The code state is quite a mess yet I think and I am very glad about all input how we can make this a smooth sailing :)

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.

1 participant