Yep, can confirm. valueType has disappeared on MetafieldInput and Metafield objects. REST API docs are being displayed fine with a deprecation of 2021-07. In addition, these deprecation notices are not listed on https://shopify.dev/api/release-notes/2021-07, and they are also not causing warnings in App’s API Health.
Also, when querying the new type parameter on metafields, it is returning json_string instead of just json (json_string does not exist according to https://shopify.dev/apps/metafields/definitions/types – it has been replaced by json)
I’m incredibly confused here… these inconsistencies are preventing me from upgrading our app to the 2021-07 API. Shopify, can you please clarify?
Sorry for the confusion! We’ll be updating each of those pages that Jake linked to make the situation more clear. Here’s what you need to know about this transition:
The type: String field is replacing the old value_type: MetafieldValueType field
You can see the new list of type values in our dev docs here. Some of those types map directly to the old MetafieldValueType enum, but we had to make an exception for json_string (the old value_type) and json (the new type). The deprecated “json_string” type will continue to exist because it behaves differently than the new “json” type when referenced in Liquid.
In 2021-07 we added type and deprecated value_type
In 2021-10 we will be removing value_type entirely
This transition is phased over two API releases so that you can upgrade to 2021-07 and start switching to the new type field without breaking any of your existing API calls that rely on value_type
So we can upgrade to 2021-07 without the need of updating value_type to type? Then only when upgrading to 2021-10, we will need to ensure we fully migrated to type? Finally, this change will follow the usual deprecation lifeycle (i.e. that is, we will have 9 months to update our apps to 2021-10 on October 1st 2021)?
What’s the difference between json_string and json? Can we use the JSON Liquid filter still on the new json type (e.g. {{product.metafields.foo.bar | json}})?
Your description of the deprecation and upgrade process is correct, with one change. We decided to delay the removal of value_type until 2022-01. It’s still deprecated in 2021-10.
Going forward you should use json instead of json_string. You can use the json liquid filter on the new json type but you need to add .value: {{ product.metafields.foo.bar.value | json }}
Thanks for confirming that – I was curious to why I was still able to use value_type on 2021-10 and also to why no API Health Alerts were being flagged on our production app.
After value_type (REST) and valueType (GraphQL) is deprecated, we can still continue to use the deprecated json_string, string, and integer on type, correct? From my understanding, this document here, https://shopify.dev/apps/metafields/manage.md#migrating-from-value_type-to-type, points in this direction but some additional clarification would be great here.
Also, the maximum value length has been published in the docs for string: 5 million chars, integer: 100k chars and json_string: 100k chars. What are the maximum lengths for the new type system? I do not see them here: https://shopify.dev/apps/metafields/definitions/types. Is this something that Shopify can clarify in their docs?
You are correct that you’ll still be able to use the old json_string, string, and integer types with the new type field. We do encourage you to migrate to json, single_line_text_field, multi_line_text_field, or number_integer if you can. You’ll have a more consistent experience (for example, in Liquid) by using the new types everywhere.
I’ll try to find those max value/length restrictions and get them into our docs soon, thanks for pointing that out.
Thanks for your reply! A question with Liquid I have:
Using the string type, I can output the string into a Javascript variable as follows:
Using the new multi_line_text_field type, I can output the string into a Javascript variable as follows:
Both of these examples yield the exact same output for me. However, is this always the case? In other words, is this the correct way to migrate our Liquid code from string to multi_line_text_field? Is there anything I should be aware of? For example, using the new type field could escape the string – e.g. Liquid turning the string 'hello into 'hello (a Javascript escape) or &hello into &hello (a HTML escape)?