Beta
Optional
Beta
conditionalOptional
Beta
forceBy default, agent actions will never write to a published document.
Instead, they will force the use of a draft ID ("drafts.some-id") instead of the published ID ("some-id"), even when a published ID is provided.
Actions will use state from an existing draft if it exists, or use the published document to create a draft, if no draft exists.
Successful responses contains the _id that was mutated by the action.
When forcePublishedWrite: true an agent action will write to the exact id provided. The action will also not fallback to published state for draft ids.
When an ID on the form "versions.forcePublishedWrite: true
.
That is, only the exact document state of the id provided is considered and mutated.
Beta
schemaschemaId as reported by sanity deploy / sanity schema store
Beta
targetTarget defines which parts of the document will be affected by the instruction. It can be an array, so multiple parts of the document can be separately configured in detail.
Omitting target implies that the document itself is the root.
Notes:
maxPathDepth
When a type or field in the schema has a function set for
hidden
orreadOnly
, it is conditional.By default, Generate will not output to conditional
readOnly
andhidden
fields, ie, they are considered to resolve toreadOnly: true
/hidden: true
.conditionalPaths
param allows setting the default conditional value forhidden
andreadOnly
to false, or individually sethidden
andreadOnly
state for individual document paths.Note: fields and types with explicit readOnly: true or hidden: true in the schema, are not available to Generate, and cannot be changed via conditionalPaths
conditionalPaths state only apply to fields and types that have conditional
hidden
orreadOnly
in their schema definition.Consider using
hidden: () => true
in schema config, if a field should be writeable only by Generate and never visible in the studio – then make the field visible to the Generate usingconditionalPaths
.