Validation
Validation checks the consistency of your vault — from type schemas to object properties to links between objects. Run it with:
tmd type validateFor continuous validation during development, add --watch to monitor file changes and re-validate automatically:
tmd type validate --watchValidation phases
Section titled “Validation phases”Validation runs five phases in order. Each phase checks a different aspect of your vault.
Phase 1: Schema Validation
Section titled “Phase 1: Schema Validation”Scans all type schemas (types/<name>/schema.yaml) and shared property files (properties/*.yaml) and checks:
namefield is required- Each property must have a
nameandtype select/multi_selectproperties must defineoptionsrelationproperties must definetarget- Property names
name,description,created_at,updated_at,tags,locked,archived,object_type,links,backlinks,created_by, andupdated_byare reserved for system properties nameinpropertiesonly allows atemplatefield (for name templates)
Phase 2: Object Validation
Section titled “Phase 2: Object Validation”Validates all object properties against their type schema:
select/multi_selectvalues must be in the allowedoptionslistnumberproperties must be numericdatemust be inYYYY-MM-DDformatdatetimemust include a time componenturlmust start withhttp://orhttps://checkboxmust be booleanrelationtargets must match the expected type
Phase 3: Relation Validation
Section titled “Phase 3: Relation Validation”Checks all stored relations to ensure both the source and target objects exist.
Phase 4: Link Validation
Section titled “Phase 4: Link Validation”Detects broken links — [[target]] references in object body content where the target object does not exist. For shorthand targets ([[type/name]] or [[name]]) that match multiple objects, the ambiguous target is reported along with the list of matching full IDs.
Phase 5: Name Uniqueness Validation
Section titled “Phase 5: Name Uniqueness Validation”Checks all types with unique: true in their schema (e.g., the built-in tag type) to ensure no two objects of the same type share the same name value.
Lenient validation philosophy
Section titled “Lenient validation philosophy”TypeMD uses lenient validation by design:
- Extra properties are allowed — Properties not defined in the schema are silently accepted. This lets you add ad-hoc metadata without updating the schema.
- Missing properties do not cause errors — An object doesn’t need to have every property defined in its type schema.
- Only schema-defined properties are type-checked — If a property is in the schema, its value must match the declared type. If it’s not in the schema, no validation occurs.
This approach keeps TypeMD flexible while still catching real mistakes — like a select value that isn’t in the options list, or a relation pointing to a non-existent object.
Output
Section titled “Output”On success:
Validation passed.On failure, errors are grouped by phase:
Schema errors: book.yaml: property "status": select type requires non-empty options
Object errors: book/example: property "rating": expected number, got "abc"
Relation errors: book/example author person/missing: target object not found
Wiki-link errors: book/example: broken wiki-link [[person/nobody-01jjjjjjjjjjjjjjjjjjjjjjjj]]
Name uniqueness errors: duplicate tag name "golang": tag/golang-01abc and tag/golang-01xyz
found 5 validation error(s)See also
Section titled “See also”- Properties — property types and validation rules
- Tags — tag name uniqueness
- tmd type validate — CLI reference