openapi_parser
openapi_parser copied to clipboard
Add gem_rbs_collection and fix duplicated type definition
Proposal
- The library type should read and use gem_rbs_collection.
- Methods whose types do not match are overloaded. If the gem_rbs_collection type is sufficient, the handwritten type definitions can be freely deleted. example:
# rbs in stdlib
def hoge: () -> Integer
# rbs in handwritten
def hoge: () -> string | ... # <- Overloaded
Background
Syntax error in RBS during development. Perhaps you are defining a type definition in this gem that did not exist in stdlib in the past.
❯ bundle exec steep check
# Type checking files:
../../.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/openapi_parser-2.0.0/sig/types.rbs:11:2: [error] Non-overloading method definition of `safe_load` in `::Psych` cannot be duplicated
│ Diagnostic ID: RBS::DuplicatedMethodDefinition
│
└ def self.safe_load: (untyped content, untyped parmitted_classes) -> Hash[bot, bot]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Detected 1 problem from 1 file
The relevant duplicate section is here. https://github.com/ruby/rbs/blob/master/stdlib/psych/0/psych.rbs#L351