stripity-stripe icon indicating copy to clipboard operation
stripity-stripe copied to clipboard

Inaccurate typespecs for Stripe.Subscription.update/2 (item.id is missing)

Open anotherpit opened this issue 5 months ago • 2 comments

Existing Issue or Pull Request Verification

  • [X] Confirmed, no existing Issues or Pull Requests found related to my submission.

Package Version

3.2.0

Are you using the latest version?

  • [X] Yes, I verified the issue is still present in the latest version.

Steps to Reproduce

Stripe.Subscription.update(subscription_id, %{
  items: [
    %{
      id: params.item_id,
      price: params.item_price
    }
  ],
})
mix dialyzer

Expected Result

Dialyzer is happy as passing item ids to subscription update method is valid.

Actual Result

The function call will not succeed.

Stripe.Subscription.update(_subscription_id :: nil | binary(), %{:items => [%{:id => binary(), :price => _}, ...]}) ::
[...]

will never return since the 2nd arguments differ
from the success typing arguments:

[...]
 :items => [
    %{
      :billing_thresholds => binary() | map(),
      :metadata => map(),
      :plan => binary(),
      :price => binary(),
      :price_data => map(),
      :quantity => integer(),
      :tax_rates => binary() | [any()]
    }
  ],
[...]

anotherpit avatar Sep 17 '24 17:09 anotherpit