Are Metaobject Types Unique?

Hi Friends!

Per the title, my question is whether Metaobject Types are unique? My guess is yes but I don’t see anywhere that it’s explicitly stated.

Relevant info:

There is a getter for Metaobject Definition by type [1] that returns a single metaobject definition, but the mutation to create a metaobject definition [2] does not mention it being unique.

If it’s unique, then it would be awesome if this were spelled out in the docs!
If it’s not unique, what would metaobjectDefinitionByType return if there are multiple metaobjects with the same type?

Thanks!

1- metaobjectDefinitionByType - GraphQL Admin
2- metaobjectCreate - GraphQL Admin

Hello Bailey,

Yes, metaobject definition types are indeed unique and once you set it you cannot change it. They must be 3-255 characters long and only contain alphanumeric, hyphen, and underscore characters.

Thanks for catching that it’s not documented, we will update the docs.

2 Likes

Thanks @Rafa!

The other piece that I found confusing was the relationship between the admin access level and the type. IIRC if admin access level were set to MERCHANT_READ, the the type had to start with $app:. is that correct?

Hi @bailey – that is correct; metafields are read/write for merchants and other apps, unless you use a reserved namespace