Vonage / vonage-ruby-sdk

Vonage REST API client for Ruby. API support for SMS, Voice, Text-to-Speech, Numbers, Verify (2FA) and more.
https://developer.vonage.com
Apache License 2.0
217 stars 108 forks source link

Add more Sorbet typing to the gem #178

Open hummusonrails opened 3 years ago

hummusonrails commented 3 years ago

The Vonage Ruby SDK has begun incorporating Sorbet to statically type the code, and you can contribute to it during Hacktoberfest!

We are looking for pull requests that continue the incremental adoption of Sorbet in the codebase in a thoughtful and meaningful way. How do you balance methods that take in a variety of optional parameters? How do you manage Sorbet adoption in this existing code the way it is currently structured -- adoption without doing major "code surgery" to the overall codebase.

AnshMishra2001 commented 3 years ago

Hey! I am knew to open source development. Can I work on this issue under your able guidance?

hummusonrails commented 3 years ago

Hey @AnshMishra2001, welcome to open source! Please feel free to study up on Sorbet on its official website, review the existing typing in the SDK and open up a small pull request with your first attempt and we can go from there!

dduugg commented 3 years ago

Hi, I've noticed the type declarations are breaking the yard task, by discarding the annotations and emitting a bunch of warnings like:

[warn]: in YARD::Handlers::Ruby::DSLHandler: Undocumentable method, missing name
    in file 'lib/vonage/sms.rb':95:

    95: sig { params(params: T::Hash[Symbol, T.untyped]).returns(Vonage::Response) }

[warn]: in YARD::Handlers::Ruby::DSLHandler: Undocumentable method, missing name
    in file 'lib/vonage/alerts.rb':15:

    15: sig { returns(Vonage::Response) }

[warn]: in YARD::Handlers::Ruby::DSLHandler: Undocumentable method, missing name
    in file 'lib/vonage/alerts.rb':31:

    31: sig { params(params: T::Hash[Symbol, T.untyped]).returns(Vonage::Response) }

These can be fixed by incorporating the yard-sorbet plugin (of which I am the maintainer). Would you be amenable to a PR that incorporates it? (It can also incorporate the type signatures into the documentation, raising the documentation coverage stat from 49% to 69%.)