graphql-client icon indicating copy to clipboard operation
graphql-client copied to clipboard

Generate a rust struct for a GraphQL type?

Open antholeole opened this issue 2 years ago • 3 comments

I have a type like so:

type AuthenticationOutput {
  access_token: String!
  admin: Boolean!
  refresh_token: String!
}

and I'd like to generate a Rust struct for it. The use case is that Hasura allows you to define web hooks, and defines the inputs / outputs of the web hooks as GraphQL types. Is there a way to generate the struct for this type? or does the type have to be attached to a query? Thanks!

antholeole avatar Jan 03 '23 18:01 antholeole

Did you have any luck with this? I'm just now going to look into the graphql_client_codegen crate and see what I can do.

banool avatar Jul 31 '23 08:07 banool

I did not, sorry. Best of luck.

antholeole avatar Jul 31 '23 13:07 antholeole

For anyone else who comes along, I got pretty far by forking this repo instead: https://github.com/banool/async-graphql-reverse/.

banool avatar Jul 31 '23 14:07 banool