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

Handle gem annotations versioning #95

Closed
2 tasks done
Morriar opened this issue Aug 17, 2022 · 2 comments
Closed
2 tasks done

Handle gem annotations versioning #95

Morriar opened this issue Aug 17, 2022 · 2 comments
Labels
ci Change related to CI enhancement rbi Change related to RBI annotations

Comments

@Morriar
Copy link
Contributor

Morriar commented Aug 17, 2022

Problem

Available constants, methods and signatures may vary depending on the version of the gem.

  • rbi-central should provide a way to annotates specific versions of a gem
  • tapioca should pull only relevant annotations for the considered version of a gem

Possible solution

Annotate the annotations with the gem version concerned when we need to make a distinction between two versions:

module Foo
  # This annotation is defined in all versions
  def foo; end

  # This annotation is only available in versions > 1.0
  # @version > 1.0
  def bar(x); end

  # This annotation is only available in versions <= 1.0
  # @version <= 1.0
  def bar; end
end
@leifg
Copy link
Contributor

leifg commented Nov 2, 2022

sorbet-typed uses subfolders for versions and all for general definitions. See activerecord example

@KaanOzkan KaanOzkan added this to the Sorbet in all Ruby projects milestone Jan 18, 2023
@Morriar Morriar added rbi Change related to RBI annotations ci Change related to CI enhancement labels Mar 1, 2024
@KaanOzkan
Copy link
Contributor

A comment above method/constant definitions with the format # @version > x.y.z can be used to specify versions. tapioca annotations command will only pick applicable definitions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci Change related to CI enhancement rbi Change related to RBI annotations
Projects
None yet
Development

No branches or pull requests

3 participants