Skip to content
This repository was archived by the owner on Mar 29, 2026. It is now read-only.

Add a gql!() generator macro.#358

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

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

Conversation

@Yatekii
Copy link
Copy Markdown

@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 :)

@obmarg
Copy link
Copy Markdown
Owner

obmarg commented Mar 29, 2026

1 similar comment
@obmarg
Copy link
Copy Markdown
Owner

obmarg commented Mar 29, 2026

@obmarg obmarg closed this Mar 29, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants