Ship RBS type signatures under sig/#151
Open
satoryu wants to merge 1 commit into
Open
Conversation
Provide type information to users of this gem by bundling RBS signatures. - Generate sig/ mirroring lib/ via `rbs prototype rb`, then refine the public API (configure/Configuration, Resource, SearchResult, Response, AllProxy, Client, Error hierarchy, GenreInformation, Ichiba::Item). - Add sig/manifest.yaml declaring json/uri so consumers resolving these types via `rbs collection` pick up the default-gem dependencies. - Add rbs (~> 4.0) as a development dependency. - Add a CI job running `rbs validate`. - Bump version to 1.17.0 and update CHANGELOG. Dynamically defined `attribute` accessors cannot be expressed statically in RBS, so per-attribute readers are accessed through `#[]` (untyped). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
This gem currently ships no type information, so users who type-check their
code (Steep / TypeProf / tapioca) see this gem's API as
untyped. This PRbundles RBS signatures under
sig/and distributes them via RubyGems so thatconsumers can resolve the gem's types (e.g. through
rbs collection).What
sig/**/*.rbs— generated withrbs prototype rbmirroringlib/, thenhand-refined for the public API:
RakutenWebService.configure/Configuration,Resource,SearchResult,Response,AllProxy,Client, theErrorhierarchy,GenreInformation,BaseGenre, andIchiba::Item.sig/manifest.yaml— declares the default-gem dependencies (json,uri) so consumers resolving these types pick them up too.rakuten_web_service.gemspec— addsrbs (~> 4.0)as a developmentdependency. (
sig/is distributed automatically sincespec.filesusesgit ls-files.).github/workflows/ci.yml— adds a job runningrbs validate.1.17.0; CHANGELOG updated.Note on dynamic accessors
Resource subclasses declare fields via the
attributeDSL, which definesreader methods (and
*?predicates) dynamically at load time. These cannot beexpressed statically in RBS, so per-attribute access is typed through
#[](returning
untyped); each affected class documents this in a comment.Verification
bundle exec rbs -r uri -r json -I sig validate→ passesbundle exec rake spec→ 217 examples, 0 failures (no runtime behavior change)bundle exec rake build→ confirmed allsig/files are included in thebuilt gem
🤖 Generated with Claude Code