tapioca icon indicating copy to clipboard operation
tapioca copied to clipboard

Feature request: generating types from a graphql.schema file for use with graphql-client

Open snoble opened this issue 3 years ago • 2 comments

It would be really nice to be able to have types for inputs and results for graphql-client and it feels like it just requires gluing together some existing pieces of code.

A file of graphql queries can be parsed into a Document with GraphQL.parse. https://github.com/rmosolgo/graphql-ruby/blob/a08c86f097395e27272fdead5037d7b3ef03401e/lib/graphql.rb#L45

And then the tapioca graphq_type_helper can be used to map the graphql types to sorbet types. https://github.com/Shopify/tapioca/blob/main/lib/tapioca/dsl/helpers/graphql_type_helper.rb

And then you'd want to produce an rbi file that will provide types for the queries produced by GraphQL::Client#parse to be used with GraphQL::Client#query.

snoble avatar Oct 18 '22 20:10 snoble

https://github.com/github/graphql-client/pull/305 might be of interest!

bdewater-thatch avatar Jan 11 '23 19:01 bdewater-thatch

The above link is dead. Should it point somewhere else now? Edit: Looks like this: https://github.com/github-community-projects/graphql-client/pull/7

qubyte avatar Mar 12 '24 14:03 qubyte