Shopify / Shopify/tapioca

DSL compiler for `GraphQL::Schema::ObjectType`

Open
#1,920 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

When using field in GraphQL object types, new methods are created in the class dynamically. In certain occasions, like in batch loading, we need to be able to refer to those methods and avoid type checking errors.

class MyType < GraphQL::Schema::Object
  field "foo", type: String

  class << self
    extend T::Sig

    sig { params(objects: T::Array[MyType]).void }
    def load_foo(objects)
      objects.each { |obj| obj.foo = "hello!" }
                              # ^ error: foo doesn't exist on MyType
    end
  end
end

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 the GraphQL::Schema::Object example in the issue and inspect how Tapioca currently handles DSL compilers. Determine how dynamically defined field methods should be represented for Sorbet, then verify that batch-loading code can refer to obj.foo without a type error.

Written by the indexing model from the issue text.

Assessment

Tech stack
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.