ModelValidatorApp
![]()
© 2026 Obsvra. This document describes SpiceGrinder and is provided to help you evaluate and use it. It is not a license to reproduce, adapt, or use this material to build a competing product or service. Full terms: the SpiceGrinder EULA.
NAME
ModelValidatorApp — check whether one or more SpiceGrinder model files are valid
SYNOPSIS
java -cp spicegrinder.jar com.obsvra.spicegrinder.tools.ModelValidatorApp model.xml|model.json ...
On a jpackage install:
validator model.xml|model.json ...
DESCRIPTION
ModelValidatorApp loads one or more model files and reports every validate() failure found in each, plus file-level parse/load failures. It answers “is this model valid” (loadable, and every node’s own validate() passes) — a distinct question from ModelAnalyzerApp, which answers “how expensive is this already-valid model.”
Multiple files may be given on one invocation; each is checked independently and a full report is printed for each.
Available at any tier — validating a model file isn’t itself a licensed capability. A Free build attempting to load a model that references a Pro-only component still reports that as a load failure here, the same as any other file that fails to load.
Checks reported, per file:
- File-level failures: malformed XML/JSON, unresolved
<input>references, missing required attributes, a license-gated component referenced on a build that doesn’t have it — anything that prevents the model from loading at all. - Node-level failures: every node’s own
validate()is checked, and all failures are collected in one pass, not just the first one found — e.g. aMixwhose inputs don’t all share one dimension, aTruncatewith neitherminnormaxset.
OPTIONS
| Option | Meaning |
|---|---|
-h, --help | Print usage and exit. |
--version | Print the version (e.g. 1.0.0 Alpha 1 (Build 1)) and exit. |
--json | Emit one JSON report to stdout instead of human-readable text. See OUTPUT (JSON) below. |
No other options exist — validation behavior itself isn’t configurable, only the output format is.
OUTPUT (JSON)
With --json, every file given is checked exactly the same way, but the results are collected into one JSON document printed to stdout instead of per-file human-readable text:
{
"valid": true,
"results": [
{
"model": "/abs/path/model.xml",
"loaded": true,
"loadError": null,
"rootName": "root",
"nodeCount": 12,
"valid": true,
"failures": []
}
]
}
results[] has exactly one entry per file given, in order, regardless of whether that file loaded. loaded is false for a file that doesn’t exist or failed to parse/load, in which case loadError carries the reason and rootName/nodeCount are null; failures is always present as an array (empty when there’s nothing to report, never omitted). Each failures[] entry is {"nodeName": ..., "nodeType": ..., "message": ...} — one per node-level validate() failure. Top-level valid is true iff every result’s own valid is true — the same condition exit code 0 checks.
--json only changes this payload. -h/--help/--version output and bad-argument errors (exit code 2) always stay plain text, unaffected by --json.
EXIT STATUS
| Code | Meaning |
|---|---|
| 0 | Every file given loaded and validated clean. |
| 1 | At least one file failed to load, or had one or more validation failures. |
| 2 | Bad arguments — unrecognized option, or no files given. |
Suited to a check-in/CI validation step: validate, then analyze, before allowing a model file change to merge.
EXAMPLES
Validate a single model:
java -cp spicegrinder.jar com.obsvra.spicegrinder.tools.ModelValidatorApp model.xml
Validate every model in a directory as one CI step (shell glob expansion):
validator models/*.xml
Get a machine-readable report for a script or agent to parse:
validator --json models/*.xml
SEE ALSO
ModelAnalyzerApp(1), Grind(1), ComponentLibraryApp(1), McpServerApp(1)