Closed SheldonNunes closed 1 year ago
This PR updates the sorbet signature for the Webhooks::Registry to support T::Array[String].
Webhooks::Registry
T::Array[String]
ShopifyApp.configure do |config| config.webhooks = [ {topic: 'products/update', path: 'webhooks/products_update', fields: ['title', 'vendor']} ] end
The examples currently described in ShopifyApp above do not work as the following error is encountered:
Parameter 'fields': Expected type T.nilable(String), got type Array with value ["title", "vendor"] (TypeError)
This PR updates the signature to match the underlying registration code which accepts both String and T::Array[String]
https://github.com/Shopify/shopify-api-ruby/blob/77ab36ca816516a677b736a46eec59aeed36a055/lib/shopify_api/webhooks/registration.rb#L24C19-L24C61
Added additional tests asserting the behaviour remains unchanged when passing in array.
Description
This PR updates the sorbet signature for the
Webhooks::Registry
to supportT::Array[String]
.The examples currently described in ShopifyApp above do not work as the following error is encountered:
Parameter 'fields': Expected type T.nilable(String), got type Array with value ["title", "vendor"] (TypeError)
This PR updates the signature to match the underlying registration code which accepts both String and T::Array[String]
https://github.com/Shopify/shopify-api-ruby/blob/77ab36ca816516a677b736a46eec59aeed36a055/lib/shopify_api/webhooks/registration.rb#L24C19-L24C61
How has this been tested?
Added additional tests asserting the behaviour remains unchanged when passing in array.
Checklist: