Beta
Beta
documentOptional
Beta
environmentSpecify the environment name. This will be passed down to the
ValidationContext
and made available to custom validators.
Optional
Beta
getThe factory function used to get a sanity client used in custom validators. If not provided, the one from the workspace will be used (preferred).
Optional
Beta
getFunction used to check if referenced documents exists (and is published).
If you're validating many documents in bulk, you may want to query for all document IDs first and provide your own implementation using those.
If no function is provided a default one will be provided that will batch
call the doc
endpoint to check for document existence.
Optional
Beta
maxThe maximum amount of custom validation functions to be running
concurrently at once. This helps prevent custom validators from
overwhelming backend services (e.g. called via fetch) used in async,
user-defined validation functions. (i.e. rule.custom(async() => {})
)
Note that lowering this number may also help in cases where a custom validator could potentially exhaust the fetch concurrency. This is 5 by default.
Optional
Beta
maxThe amount of allowed inflight fetch requests at once. You may need to up
this value if you have complex custom validations that require many
client.fetch
requests at once. It's possible for custom validator to
stall if there are not enough concurrent fetch requests available to
fullfil the custom validation. This is 25 by default.
Beta
workspaceThe workspace instance (and associated schema) used to validate the given document against.
The document to be validated