Validation
Validation for experimental CMMF 1.3.0-beta.1.
This branch documents CMMF 1.3.0-beta.1, an experimental prerelease. Stable
1.2.0 remains canonical on main and the v1.2.0 release.
Validation has three distinct concerns. Passing one does not imply passing all three.
Schema / Format Validation
Section titled “Schema / Format Validation”The JSON Schema checks model declaration shape:
required properties, canonical field types, relationship compatibility, rich-text
configuration, and the structure of validationHints. It rejects malformed hint
objects, missing IDs or descriptions, unknown operators, mixed representations,
and empty action lists. It does not validate documents containing content.
Graph / Semantic Validation
Section titled “Graph / Semantic Validation”Semantic validation checks declarations in context. A structured hint must refer to fields that actually exist in the same model. Hint IDs must be unique within that model, and operators and literal types must fit the referenced field.
The beta includes a small declaration checker:
npm cinpm run validatenode scripts/validate-models.mjs --manifest /path/to/manifest.yamlIt requires Node.js 22 or later and the exact manifest version "1.3.0-beta.1".
It reads YAML or JSON model files directly within modelsPath (default ./models)
and reports schema errors, duplicate model/field/hint IDs, unknown structured field
references, incompatible operators or operands, and malformed regex patterns.
It does not change input or insert defaults.
This is a focused declaration checker, not a complete model-graph validator: it does not resolve relationship targets, inspect dialect-specific expressions or prose, solve contradictory hints, or fully formalise existing field validations.
Content Validation
Section titled “Content Validation”Content validation asks whether a particular document meets the model’s declared
constraints. Field-level required and validations express single-field intent;
model-level validation hints describe conditional
and cross-field intent. A hint’s severity describes the intended content finding.
It does not change whether the hint declaration itself is valid.
CMMF does not ship a content evaluator or execute expressions. Editors, validators, and translators decide how to realise that intent. Translators must account for every hint with a disposition and reason; hints are never silently discarded.
Existing Field-Level Validation Keys
Section titled “Existing Field-Level Validation Keys”Field validations remain unchanged in this beta:
| Category | Keys | Typical fields |
|---|---|---|
| Text | minLength, maxLength, regex |
string, text, slug |
| Number | min, max, integerOnly |
number |
| Lists | minItems, maxItems, uniqueItems |
Any list: true field |
| Asset | mimeTypes, dimensions, fileSize |
asset |
- id: title type: string required: true validations: minLength: 5 maxLength: 100Field-level validation semantics remain lightweight. Translators preserve them where possible and report unsupported or lossy mappings. The schema does not fully formalise the compatibility matrix for those existing validation keys.
Skills compatibility
Section titled “Skills compatibility”CMMF Skills does not support beta source requests or beta helper semantics. Use the matching beta example validator for the checks described here; do not treat those checks as Skills support.