Rather than manually inputting data from a number of group fields, I'm keen to use the import feature to migrate content from one schema, where we're using group fields, to a new slice-based schema.
Where the existing group fields are named similarly to the below:
"features_list": [{
"item_name": "1 combi dispenser in the door for powder cleaning agent and rinsing agent"
},
When I import the updated document, is it required that I include a key for the sliced content or will Prismic generate one if a key is missing? Or should I be generating a unique UID for that slice, similar to the below:
Ok, so I may have answered this myself. When importing the content you wish to migrate to an existing document, you just have to name the key by the slices key name, with no UID. A UID is generated by Prismic, and a new release is created on import.
An example of how your key should look on import, for the content you are migrating.
I'm glad you figured this out, but I can ask for a little more detail? Is what you are doing here migrating a group field from the static zone and transforming it into a Slice in the Slice Zone?
Yes, that is exactly what I'm doing. There is an additional level of complexity in the transformation process though.
This is mainly where I'm using a Python script to loop through the exported JSON files and check if the object keys for the related static group fields have an existing array.
If a condition matches an object key and an array exists, the existing array is then transformed into a new object with the new slice schema.
The matched object key will then have its array removed. So that when the release is generated and published in Prismic, we can successfully migrate away from the old schema without impacting the current web apps release, and upcoming release of our NextJS application.
I'm still currently finishing this script this evening. Though I hope that gives you an idea of the outcome I've designed, and am currently working on.