If you’re still getting the error after updating the configuration with the above, and deploying a fresh version, please add the --verbose flag to the app deploy command, and provide us with the output for us to help look into further (censoring any access tokens or credentials that may be listed in the output, the important thing we’re looking for here is the error messages and x-request-ids)
Thanks for trying that and confirming it didn’t work. It does appear that the previous syntax you were using is more correct based on the errors you’re seeing, though I’m currently looking into this with our developers internally to confirm the correct way to declare metaobject validations in the toml file.
I feel like this is due to the fact that these are declarative metaobjects so when you deploy the app and it creates the metaobject definitions, it’s not done with the context of the actual store that the validation metaobject definition exists on, like it would have been if done via an API call.
As mentioned I’m currently discussing this with our developers further, though I might not hear back until monday at this point.
In the meantime, can you revert back to the previous syntax you were using that returned the Validations must be a valid metaobject definition belonging to your shop error, and then apply the --verbose flag, replicate this error once more, and provide us with the output (not including any tokens or credentials in the output)
Do you want something specific from the verbose output?
My guess is that it isn’t possible to create a metaobject reference via TOML as the metaobject_definition_id validation requires a dynamically created GID.
Another possible validation would be the metaobject_definition_type. This is returned by the admin API as a possible validation, but I don’t see it in the “List of validation options“ docs.
metaobject_definition_type would make sense to be the actual TOML accepted validation, as it would require a type, not a dynamic GID.
There is something off here. Even the naming seems wrong, validations should take an Array, a list, but in the TOML it seems to take a single object.
I’m very curious what the Shopify engineers recommend.
I’ve looked into this further with our developers internally, and I can confirm that @bkspace is correct here, the right way to declare the metaobject definition validations is with the metaobject type, exactly as @bkspace has shared.
Here’s an example shared from our developers as well:
[product.metafields.app.my_field]
type = "metaobject_reference<$app:my_metaobject_type>"
[metaobjects.app.my_metaobject_type]
// fields etc.
We’ll also be making sure our relevant Shopify.dev docs are updated so that this is clearly described for the future.
I’m fairly sure it was a mixture between the initial TOML examples and our previous experience with TOML, and a bunch of trial and error! The documentation has changed now, and I can’t seem to find anything specific.