morphir model verify
Validate a Morphir model, a single file or a document tree, against the official IR JSON schemas
The Morphir .NET CLI provides powerful command-line tools for working with Morphir IR files, validating schemas, and managing Morphir projects.
dotnet-morphir also has the F# frontend built in)morphir-mck entry pointmorphir-mck, with the same argumentsThe model group holds the commands that act on a Morphir model. It replaces the ir group, which was removed with
no alias.
morphir model --help lists both commands.
The Morphir .NET CLI is distributed as a .NET tool. Install it globally with:
dotnet tool install -g Morphir.CLI
Or locally in a project:
dotnet tool install Morphir.CLI
For help with any command, use the --help flag:
morphir --help
morphir model --help
morphir model verify --help
morphir model convert --help
The most common workflow is validating Morphir IR JSON files to ensure they conform to the expected schema:
# Validate a single file with auto-detection
morphir model verify path/to/morphir-ir.json
# Validate with explicit schema version
morphir model verify --schema-version 3 path/to/morphir-ir.json
# Get one JSON report for CI/CD (see Machine output below)
morphir model verify --json=document path/to/morphir-ir.json
# Quiet mode (only the exit code)
morphir model verify --quiet path/to/morphir-ir.json
See the morphir model verify documentation for complete details.
Every command with machine output takes one option, --json[=stream|document]:
--json (the same as --json=stream) writes JSON Lines to stdout. Each line is one compact JSON object with
an event member, written when its event occurs. The last line is the only completed record, and its report
member holds the command’s report. A command with no events writes only that line, which is also one JSON document.--json=document writes the report alone, as one JSON document. It is the report of the completed record of the
same run.--json, the command writes its output for people.For a valid model model.json in the current directory, the stream is one line:
$ morphir validate --input model.json --json
{"event":"completed","report":{"host":"morphir","success":true,"exitCode":0,"input":"/work/model.json","family":"Classic","formatVersion":"3","analyzers":[{"id":"morphir.type-validator","status":"ran"}],"diagnostics":[]}}
The document is the report of that line:
$ morphir validate --input model.json --json=document
{
"host": "morphir",
"success": true,
"exitCode": 0,
"input": "/work/model.json",
"family": "Classic",
"formatVersion": "3",
"analyzers": [
{
"id": "morphir.type-validator",
"status": "ran"
}
],
"diagnostics": []
}
Give the mode only after =. A bare --json never takes the next argument, so morphir model verify --json model.json
verifies model.json. A command without a positional argument refuses --json document with exit code 2 and
suggests --json=document. A mode that is not stream or document fails with exit code 2 and names both. A parse
or usage error in a JSON mode still ends with one completed record (or the one document) whose report states the
error. Logs and human-readable diagnostics go to stderr in every mode, so stdout holds only the JSON:
morphir validate --input model.json --json=document | jq .exitCode prints 0 for the model above. A consumer
ignores event types and members that it does not know. When a page names a member of a command’s JSON output, it is
a member of the report: of the document, and of the report of the completed record.
The removed --json-lines option fails as an unknown option with exit code 2: use --json.
Output that a cross-host contract defines keeps that contract’s form. morphir extension worker follows the pinned
WASM worker contract: --help --json writes one morphir/command-result with no completed wrapper, and its event
lines stay morphir/command-event (see extension worker).
The commands share a general split of exit codes:
compile, generate and
validate).The exact codes differ by command, so read each command’s page for them. For example,
model verify reports a file that is missing or not JSON as a model that is not valid,
with exit code 1, where validate gives 2 for an input that it cannot read, and a config key that is not found
exits 1. An unknown command, such as morphir ir, exits 1.
The configuration guide distinguishes the compatibility TOML cache loader from the additive shared configuration and project system.
The morphir config read commands inspect effective/scoped values, source reports and redacted explanations. JSON output follows the published schema; success, missing keys and usage/loading failures use exit codes 0/1/2. Shared config set/unset editing, project migrate and bounded workspace migrate are available. Start with the workspace configuration walkthrough.
See the Troubleshooting Guide for solutions to common issues.
Validate a Morphir model, a single file or a document tree, against the official IR JSON schemas
Store a Morphir model as a single file or as a document tree, keeping its IR version and its meaning
Commands for managing Morphir distributions, tools, and extensions.
Inspect and edit Morphir configuration through shared services
Migration of one classic morphir-elm project to the newer Morphir project system
Preview and apply a loss-checked migration from classic morphir.json to TOML
Bounded adoption of classic projects into a Morphir workspace
Preview and apply bounded workspace adoption with per-project loss checks and recoverable writes
Run the separately installed Morphir Compatibility Kit, morphir-mck
Install and use morphir-mck, the Morphir Compatibility Kit .NET runner
Report whether this host can run WASM extensions, with its engine, profiles and bounds, or the reason it cannot
Experimental and internal: run the crafted WASM host cases against a host’s worker mode, and check the report
Set up the Morphir toolchain with morphirup and run it, then the command reference
Experimental and internal: serve one WASM extension module over stdio for a conformance runner
Solutions to common issues with Morphir .NET CLI
Compile source code to Morphir IR
What the extension installer currently implements and what remains
Generate target artifacts from a Morphir model
Check a Morphir model with the built-in analyzers
Check an Open Knowledge Format bundle with the Morphir .NET CLI
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.