AI tools
validate_artifactLast updated on
Last updated on
Validate a Paradoc artifact definition against the schema and logic rules
Checks an artifact definition (form, document, bundle, or checklist) against the Paradoc schema and its logic rules, including the template expressions in its text and DOCX layers. Inline layers are always checked; file-backed layers are read relative to the source's base URL (with an artifact source, set base_url). Use it after an agent writes or edits an artifact. To check a value a user gives, use validate_input.
Input
Takes a source plus:
| Field | Type | Required | Description |
|---|---|---|---|
options.schema | boolean | No | Run schema validation. Default true. |
options.logic | boolean | No | Validate logic and template expressions. Default true. |
Output
| Field | Type | Description |
|---|---|---|
valid | boolean | Whether the artifact passed |
artifact_kind | string | form, document, bundle, or checklist, when detected |
issues | { message, path? }[] | Validation issues, when invalid |
warnings | { message, path? }[] | Findings that do not make the artifact invalid |
error | ToolError | Set when validation could not run, for example because the source could not be loaded |
Direct usage
import { executeValidateArtifact } from "@paradoc/ai-tools"
const result = await executeValidateArtifact({
source: "artifact",
artifact: {
kind: "form",
name: "contact",
version: "1.0.0",
title: "Contact",
fields: {
name: { type: "text", label: "Name", required: true },
},
},
})From a registry, with logic checks off:
const result = await executeValidateArtifact({
source: "registry",
registry_url: "https://public.paradoc.dev",
artifact_name: "pet-addendum",
options: { logic: false },
})Example responses
Valid artifact
{
"valid": true,
"artifact_kind": "form"
}Invalid artifact
{
"valid": false,
"artifact_kind": "form",
"issues": [
{ "message": "Invalid input", "path": ["fields", "name"] }
]
}