🔮 Sanity Create is here. Writing is reinvented. Try now, no developer setup

Array member type name is the same as a global type

This warning means you have an array type that has a member that is given the same name as one of your global schema types.

When defining an array type in your schema you have the option to quickly declare several "inline" object types and give each one of them their own name to be able to distinguish between them. For example, the following could be used to define an array that can hold different variations of contact info without having to declare address and phone as separate schema types.

This allows for "locally scoped", inline types that you don't want to re-use across other schema types.

{
  name: 'contactInfo',
  type: 'array',
  of: [
    {
      type: 'object',
name: 'address'
title: 'Address', fields: [{name: 'street', type: 'string'}, /* … */] }, { type: 'object',
name: 'phone'
title: 'Phone', fields: [{name: 'number', type: 'string', /* … */}] } ] }

For inline object types we recommend not giving them the same name as an existing schema type, but either choose a different name, or refer to the globally defined schema type instead.

Was this article helpful?