Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong type definition for price_based_shipping_rates and weight_based_shipping_rates of the ShippingZone REST resource #1099

Closed
dhalai opened this issue Jan 12, 2023 · 5 comments
Assignees

Comments

@dhalai
Copy link

dhalai commented Jan 12, 2023

Issue summary

Starting from the shopify-api-ruby 10.0.0 if the REST API is used there is no way to get weight or price-based shipping rates related to the particular ShippingZone resource.

  • shopify_api version: 10.0.0 and up

Expected behavior

The price_based_shipping_rates and weight_based_shipping_rates attributes of the ShippingZone REST resource should return an array of hashes or an empty array if there are no related rates.

It should work for all API versions.

Actual behavior

It returns the TypeError Exception

TypeError Exception: Return value: Expected type T.nilable(T::Hash[T.untyped, T.untyped]), got type Array with value [{...}]...

Steps to reproduce the problem

  1. Get an existing ShippingZone by using REST API
  2. Try to access its price_based_shipping_rates or weight_based_shipping_rates attribute
@kliton661
Copy link

0

@cgarciavega
Copy link

Hi all! any update with this issue? I'm stuck with the same exception

@dhalai
Copy link
Author

dhalai commented Feb 7, 2023

Hey @cgarciavega , I just fork the repo and update the type definition manually. it's not a perfect workaround but works as a temporary solution.

@nelsonwittwer nelsonwittwer self-assigned this Mar 22, 2023
@nelsonwittwer
Copy link
Contributor

Thanks for your patience with this! I've tracked down the root problem and we are working on a fix! Unfortunately, the problem seems to be a type misunderstanding upstream with our API at Shopify so I'm not in complete control of the fix. I see this root issue affecting several other issues within our REST resources here which is a bummer :(

As a workaround, you could use the rest client directly directly, though you'll have to parse the response accordingly.

@nelsonwittwer
Copy link
Contributor

Fixed with #1137

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants