Skip to content

Unable to paste copied cloudinary.asset as an array member in Sanity Studio #85

@oscarcarlstrom

Description

@oscarcarlstrom

Describe the bug

The Santiy Studio has a copy-paste feature for array members. But this doesn't work for anonymous objects, as described in sanity-io/sanity#7607. And this problem occurs when trying to paste a cloudinary.asset field defined as an array member.

It seems like this could be due to some fields in the asset object are anonymous, such as: context, metadata and derived (they don't have the _type attribute)

To Reproduce

Steps to reproduce the behavior:

  1. Create a document schema with an array field of type cloudinary.asset:
    defineField({
      type: 'array',
      name: 'images',
      title: 'Images',
      of: [defineArrayMember({ type: 'cloudinary.asset' })],
    }),
  1. Create a new document from this schema in the studio
  2. Add an image in the "Images" array:
Image
  1. Now copy this item
Image
  1. Try and paste it in the array
Image
  1. You will get the error Value of type "object" is not allowed in this array field
Image

Expected behavior

Pasting the item should work without any error.

Which versions of Sanity are you using?

@sanity/cli (global)                   3.75.0 (up to date)
@sanity/cli                            3.75.0 (up to date)
@sanity/document-internationalization   3.3.1 (up to date)
@sanity/locale-nb-no                   1.1.19 (up to date)
@sanity/locale-sv-se                   1.2.17 (up to date)
@sanity/ui                             2.13.0 (up to date)
@sanity/vision                         3.75.0 (up to date)
sanity                                 3.75.0 (up to date)

Using "sanity-plugin-cloudinary": 1.1.5

What operating system are you using?

macOS 15.1.1

Which versions of Node.js / npm are you running?

node v22.11.0

pnpm v9.15.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions