Shopify / Shopify/tapioca

RBIs generated for a Struct should include `type_member` redefinitions

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

Nobody has claimed this yet.

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

Description

For this piece of gem code:

class DescribeCertificateRequest < Struct.new(
    :certificate_arn)
    SENSITIVE = []
    include Aws::Structure
  end

We generate

# sorbet/rbi/gems/aws-sdk-acm@1.51.0.rbi
class Aws::ACM::Types::DescribeCertificateRequest < ::Struct
  include ::Aws::Structure
end

Which results in a Type Elem declared by parent Struct must be re-declared in Aws::ACM::Types::DescribeCertificateResponse error when redefining the class for an annotation:

# rbi/annotations/aws-sdk-acm.rbi
class Aws::ACM::Types::DescribeCertificateResponse
  include ::Aws::Structure

  sig { returns(Aws::ACM::Types::CertificateDetail) }
  def certificate; end
end

https://github.com/Shopify/rbi-central/runs/7503701436?check_suite_focus=true#step:4:39

Given annotations are a part of Tapioca and the bad user experience I think this can be Tapioca's responsibility instead of cluttering the annotations with type declarations.

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 by reproducing the Struct example from gems/aws-sdk-acm/lib/aws-sdk-acm/types.rb and inspect the generated sorbet/rbi/gems/aws-sdk-acm@1.51.0.rbi alongside rbi/annotations/aws-sdk-acm.rbi. Trace the RBI generation path for Struct subclasses and verify that the generated RBI declares the needed type members so the annotation no longer produces the Sorbet error.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.