Skip to content

Add a gql!() generator macro.#358

Open
Yatekii wants to merge 18 commits intoobmarg:mainfrom
Yatekii:merge-fix
Open

Add a gql!() generator macro.#358
Yatekii wants to merge 18 commits intoobmarg:mainfrom
Yatekii:merge-fix

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