Shopify / Shopify/tapioca

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

Open
#1,232 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
873
Forks
164
Avg merge
4d 27m
Merged PRs (30d)
9

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with GraphQL.parse in lib/graphql.rb, the tapioca graphql_type_helper at lib/tapioca/dsl/helpers/graphql_type_helper.rb, and the GraphQL::Client#parse and #query entry points. Trace how parsed queries and GraphQL types could be combined, then define the RBI output needed to type query inputs and results. Done means generated RBI types are usable with graphql-client queries.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, ruby
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.