When I get a product from Shopify using GraphQL, a variant has a field listing the selected option values, which is labelled as:
an array, where I can cherry-pick the values for use in copying or building a duplicate product.
Let us now move to ProductListing data, which in all seriousness provides the exact same data to represent a product, albeit, it is meant for a Sales Channel App to consume. So what. YAK SHAVING TIME KIDS!
So a product has variants, and in those variants, the options are listed as an array known as:
Seriously. Can we not do a global DIFF on some of the ways things are referenced and get some coherence and consistency! Would that be too much to ask?
My guess is that a different developer or group of developers implemented the ProductListing endpoint. Of course, if I were King I'd at the very least ask the new developers to look at the existing property names to ensure some consistency and expected behavior when adding new endpoints.
My cheat sheet of gotchas has gotten rather long over time while working with Shopify. Some data I can't use the REST API to get to, so I have to revert to the GraphQL API. And when I do, then I have to consult to my references as to what's what. Then while I'm still living in the GraphQL I have to look for what some fields are titled. Lather, rinse, and repeat!
I am really surprised there is not more total outright complaining. Things that I am now way too comfortable with:
- GraphQL and the stupidity of camel case snake case. The idiots at happy hour that designed this are laughing with cold beers in hell. The rest of us suffer their idiocy
- things you can do in RestAPI and has no equivalent in GraphQL
- things you can do in GraphQL that are only possible in GraphQL, but are actually different in places. Such as Product vs ProductListing
In some places an image is simply src: "https://foo.bum.bar/stupid_image.jpg" while in others it is "originalSrc"
Yak Shaving continues. Or is it painting the bike shed blue, since last week, when it was green no one liked that colour.