Maximum types in array field's 'of' attribute?

27 replies
Last updated: Jan 24, 2026
Hey! Is there a maximum amount of types you can specify in the
of
attribute of a field with
type: array
? Thanks!
AI Update

Great question! There's no specific hard limit on the number of types you can include in the of attribute of an array field. You can technically add as many different types as you need.

However, there are some important practical considerations to keep in mind:

The 2000 Attribute Limit

While you can have many types in your of array, each type contributes to your dataset's overall attribute limit of 2000 unique paths. Here's how it works:

When you have an array with multiple types, the path counting works like this:

content.list - array
content.list[] - object (counts as one path regardless of how many types)
content.list[].eachField - (this is where multiple types increase path count)

So having 5 different types in your of array doesn't directly multiply your paths by 5, but each unique field across those types does add to your total count.

Monitoring Your Attribute Usage

You can check your current attribute count by visiting:

https://<projectId>.api.sanity.io/v1/data/stats/<datasetName>

Look for the fields.count.value (it will show next to limit: 2000). Currently, you won't get warnings as you approach the limit—you'll only see errors if you exceed it—so it's good to monitor this periodically.

Other Limits to Consider

  • Maximum attribute nesting depth: 20 levels
  • Document types are multipliers: If you use the same field structure across multiple document types, each document type counts separately toward your attribute limit

Performance Considerations

While there's no hard limit on types in of, having dozens of different types might make the Studio UI a bit cumbersome for editors. Consider the user experience when deciding how many types to include.

For more details on technical limits, check out the technical limits documentation.

Show original thread
27 replies

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Was this answer helpful?