I can see that when we add a media reference array property to an Object type we get the warning message “Allowing multiple media items as a single property value is discouraged. To better leverage media capabilities in the Ontology, create a separate object type and use link types to model their association.” so I understand why it’s blocked at the Action type level. But Objects in Foundry serve as consistency boundaries (given there’s no FK constraints) and as permission boundaries (via restricted views), so we should be able to attach multiple media references to get proper transactionality/permissions
We actively don’t allow media reference arrays. Media items naturally have a lot of metadata that you may wish to model, and modelling your media as a separate object and using link types enables you to have more flexibility in representing that metadata and even permissioning (eg. maybe some users can have access to some associated documents but not all).
Would you be able to expand on your use case and why you feel that linked objects aren’t enough?
Working through a specific example, imagine I have a Field Report Object type (submitted thru a Create Field Report Action type) w/ a bunch of pictures attached to it
If we can’t have media reference array parameters we have to have a separate Object type + Action type like Field Report Picture and Create Field Report Picture (and a separate restricted view if we want granular permissions). In a custom app, for each picture the user is uploading we need to execute a Create Field Report Picture Action (including calling uploadMedia before each one), and separately execute Create Field Report. The default Action form in the platform doesn’t have a way to support this without media reference array parameters so you’re basically forced into Workshop/etc. if you want to support creating reports with multiple pictures
I see there’s a new endpoint for uploading media associated with an Action type (https://github.com/palantir/foundry-platform-typescript/blob/965be262329b0f6b8276b91444adbe25469316e3/packages/foundry.ontologies/src/public/MediaReferenceProperty.ts#L163) which is cool, but what if my Create Field Report Action fails after all my Create Field Report Picture calls? That 1 hour garbage collection is then kinda useless since the garbage collection applied to the Create Field Report Picture calls which succeeded
At a technical level again objects are a transactional consistency boundary in Foundry – it can’t really support fully normalized relational data modeling since it doesn’t have foreign key constraints nor support for complex read/write transactions. Wrote up a better explanation (https://bobbyfidz.tech/posts/foundry-wishlist#complex-property-types) of this a while ago. I hear you on potentially wanting to model extra data around an upload, but my argument there would actually just be that I want support for media references inside of structs and arbitrary nesting of structs and arrays . Sometimes it might make sense to model separately, but sometimes it might not! Sorta depends where the consistency boundary is