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

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

Open
snoble opened this issue Oct 18, 2022 · 2 comments

Comments

@snoble
Copy link

snoble commented Oct 18, 2022

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.

@bdewater-thatch
Copy link
Contributor

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

@qubyte
Copy link

qubyte commented Mar 12, 2024

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

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

No branches or pull requests

3 participants