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 sorbet type of Shop#google_apps_login_enabled #1334

Closed
kirillplatonov opened this issue Aug 13, 2024 · 3 comments · Fixed by #1337
Closed

Wrong sorbet type of Shop#google_apps_login_enabled #1334

kirillplatonov opened this issue Aug 13, 2024 · 3 comments · Fixed by #1337

Comments

@kirillplatonov
Copy link
Contributor

Issue summary

When trying to read Shop#google_apps_login_enabled attribute with boolean value we're getting an error:

[6] pry(main)> loaded_shop.google_apps_login_enabled
TypeError: Return value: Expected type T.nilable(String), got type TrueClass
Caller: (pry):10
Definition: /Users/kirill/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/shopify_api-14.4.0/lib/shopify_api/rest/resources/2024_04/shop.rb:125 (ShopifyAPI::Shop#google_apps_login_enabled)
from /Users/kirill/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/sorbet-runtime-0.5.11514/lib/types/configuration.rb:296:in `call_validation_error_handler_default'
  • shopify_api version: 14.4.0
  • Ruby version: any
  • Operating system: any

Expected behavior

Should get attribute value.

Actual behavior

Getting sorbet exception.

Steps to reproduce the problem

The following snippet can be used to reproduce the issue:

shop = Shop.last
shopify_shop = shop.with_shopify_session do
  ShopifyAPI::Shop.all.first
end
shop_data = shopify_shop.to_hash
shop_data["google_apps_login_enabled"] = true
loaded_shop = shop.with_shopify_session do
  ShopifyAPI::Shop.new(from_hash: shop_data)
end
loaded_shop.google_apps_login_enabled
@paulomarg
Copy link
Contributor

Thanks for raising this, and for providing a clear repro scenario!

I'll add it to our tracking, and we'll look into it.

@kirillplatonov
Copy link
Contributor Author

I can open a PR for that. But not sure if it will be enough to just fix resources in lib/shopify_api/rest/resources folder or some hidden internal schema still needs to be fixed in Shopify? As I understand, resources will be re-generated during next Shopify bump and the schema for that is not open-sourced yet.

@paulomarg
Copy link
Contributor

Thanks! We can fix it in the existing files so we don't have to re-generate them, and we'll make sure it gets propagated to future versions.

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

Successfully merging a pull request may close this issue.

2 participants