-
-
Notifications
You must be signed in to change notification settings - Fork 313
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
Provide a robust fix for unknown enums #10
Comments
Rather than making each enum implement an "Unknown" value, it's probably better to just make them all nullable. Checking if an enum is null takes the same effort as checking if it's "unknown". To avoid breaking changes, we'll have to save fixing this for existing enums until a v 2.0 release. Enums created from now on, though, will be nullable and make use of a dedicated |
TODO
|
Hi team, just curious if this fix will be available soon? We are currently having issues with it and hoping that it will be resolved soon before we jump to another package or workaround. thanks |
Hey @mdossantos, I'm looking at starting this soon but can't make any promises on exactly when it would be ready. Could you list which enums are specifically giving you trouble? I'd be happy to push a small update to fix it. |
Hi Joshua, Thanks for the quick reply. The enum we are having trouble with is
|
Thanks! I've just opened up an issue (#41) to track this. The fix will be switching |
Thank you
|
Hey @mdossantos, just a quick update on this. I've just created a PR for v2.0.0 of ShopifySharp which contains the fix for the error you've found. I'll be working on v2 over the next few days and hope to get it merged by this time next week. |
I am not able to use enum ShopifyChargeStatus |
Hey @shahrukh192, most enums were removed in 3.0. You can read the reasoning for that right here, but to summarize: Shopify devs sometimes change enums and they become invalid, or they add enums and don't document the changes. Instead of hardcoding the values, all enums were converted to plain old strings so that the developer can quickly update their own app to whatever value they need instead of waiting for ShopifySharp to put out a new update with the new enum values. For |
@nozzlegear Just reading this here after getting stuck on this exact thing for a moment when going through your book! Thanks for the update. BTW love the book and the ShopifySharp solution in general. really clean and easy to work with, our team is loving it. |
Thanks @L0G1C, glad to hear you like it! The next update to the book will use v4 of ShopifySharp, so there won't be any more outdated enum usage. |
@nozzlegear Great to hear. Doing this app for work actually has me thinking about a great App idea I want to make on my own, so I may pick up my own copy once the next update when its available. Curious, if I purchase the handbook now,, is the update free, or should I wait until the update? |
@L0G1C The update will be free for anybody that's already purchased the book. You'll get an email with links to the updated version as soon as it's released. |
Hi i purchased the book. How do i get the update??
…On Jun 23, 2017 2:18 PM, "Joshua Harms" ***@***.***> wrote:
Thanks @L0G1C <https://github.com/l0g1c>, glad to hear you like it! The
next update to the book will use v4 of ShopifySharp, so there won't be any
more outdated enum usage.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#10 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEhYstvVyNd2NRRD5oSwRK96EuHTrlEoks5sHA-JgaJpZM4GLxOH>
.
|
@ishahrier Hey, the update hasn't been released yet, I'm still working on it. You'll get it for free at the email address you used to purchase the current version. |
Awesome thanks!!
…On Jun 23, 2017 4:57 PM, "Joshua Harms" ***@***.***> wrote:
@ishahrier <https://github.com/ishahrier> Hey, the update hasn't been
released yet, I'm still working on it. You'll get it for free at the email
address you used to purchase the current version.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#10 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEhYsqs7gQK_u8_o6wmzgi93CCDyHm19ks5sHDTAgaJpZM4GLxOH>
.
|
Shopify's documentation comes nowhere close to documenting all available enum values, and this has really thrown a wrench in things. ShopifySharp tries to provide enums where applicable, but I've personally run into exceptions where Shopify returns an enum that isn't documented (therefore isn't in ShopifySharp) and fails to deserialize.
I feel that enums are still preferable to using plain strings, so we need a more robust solution that won't throw exceptions when trying to deserialize unknown enums.
Instead, the current plan is to make all of ShopifySharp's enums implement an "Unknown" value, and make them all use a custom converter that will deserialize unknown enum strings into the "Unknown" value. The ShopifySharp.Enums.ShopifyProcessingMethod is the first to do this.
The text was updated successfully, but these errors were encountered: