Validate document
validate_documentValidate a loaded SVG document and return structured findings covering errors, warnings, missing fonts, glyphs, and id issues.
Instructions
Validate a loaded document and return structured, machine-readable findings.
When to use: a pass/fail correctness check on a document. For quantitative metrics + optimize
opportunities use quality_report; to fix size opportunities use svg_web_optimize.
Key params: none beyond doc_id.
Return shape: ValidationReport — ok (True iff no error-severity findings), error_count,
warning_count, and findings (each a stable machine code, a severity
error|warning|info, a human-readable message, and an optional locator). Covers missing
fonts, glyph coverage (a missing_glyphs warning naming the characters a text element's
declared font cannot render — read from the font's own cmap, not fontconfig substitution — plus
a covering family to try), external asset refs, large embedded rasters, id problems (duplicate
ids / dangling #id refs), and viewBox presence/sanity.
Example: validate_document(doc_id)
Risk class: low (read-only validation; document unchanged).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| doc_id | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | ||
| doc_id | Yes | ||
| findings | Yes | ||
| error_count | Yes | ||
| warning_count | Yes |