-
Notifications
You must be signed in to change notification settings - Fork 274
Description
From @ckeyes88 on July 17, 2018 16:39
Currently, string values on any of the data structs have the omitempty tag associated with them. Because of this, if I try to set a string value to it's nil value "", json.Unmarshal and json.Marshal leave off that attribute. This is a problem when trying to update a string field that I want to unset.
Steps to reproduce (using a variant as example):
- Create a variant with
v.InventoryManagement = "shopify" - Set
v.InventoryManagement = "" - Call
shopify.Variant.Updated(v)
Expected: The returned updated variant should have v.InventoryManagement == "" and that variant should no longer be set to have shopify track inventory.
Actual: The returned updated variant has v.InventoryManagement == "shopify" and that variant has no changes to it's inventory management in the admin console.
Proposed fix: Convert the string values to string pointers so that they can be explicitly nil-able.
If I'm thinking about the problem incorrectly, I'd love some feedback on how to unset string properties.
Copied from original issue: getconversio#104