-
-
Notifications
You must be signed in to change notification settings - Fork 61
Description
Feature request
I tried to return an additional field for my resource by adding a metadata
option to my create
action like this:
metadata :additional_data, :string, allow_nil?: false
And setting this value in a change
using:
result = Ash.Resource.put_metadata(result, :signed_url, url)
But unfortunately this did not result in filling this field in the meta
field of the returned resource data.
Would be convenient for certain use cases to be able to pass additional data this way. I'm for example generating a signed url with write permissions for a storage bucket on creation of a resource. I only want to return this after creation. On reads I may want a read-only url.
@zachdaniel suggested to use the metadata
option on the route instead of the action instead, or use a calculated field. A combination of both options would do the job for me (action metadata for write-enabled url, calculated field for read-only url), but if I add a graphql api as well I've got to declare metadata for create there again, which this feature would prevent.
Also, for batch create actions, I think it makes sense to have this metadata per resource instead of on the route.
Curious for options on this :)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status