okf-cli-0.14.0.0: help/validation.md
VALIDATING OKF BUNDLES
okf validate checks every concept document in a bundle and the links between
them, then exits non-zero if anything is wrong.
okf validate BUNDLE
okf validate BUNDLE --strict
PERMISSIVE VS STRICT
Default validation accepts typed concepts, skips untyped Markdown with an
advisory, and tolerates broken links. Invalid YAML still fails validation.
--strict additionally requires the recommended authoring fields:
title
description
generated (or the superseded v0.1 timestamp it falls back to)
and reports authoring problems in the optional OKF families a document
has actually used:
generated must carry a by actor
a sources entry is missing its resource
two sources entries share an id
a body footnote label names no sources entry, or the reverse
a superseded v0.1 field in a bundle that declares okf_version 0.2 or higher
a path in a frontmatter value names a file the bundle does not hold
and, for a concept whose type is exactly "Attested Computation":
it declares no runtime
it declares no computation at all
it declares a computation both inline and by path
it has more than one code block under # Computation
Every one of those is strict-only. See CONFORMANCE VS AUTHORING CHECKS.
REFERENTIAL INTEGRITY
Both modes diagnose duplicate concept IDs and malformed log date groups.
Strict validation checks broken body links and unresolved path fields
including resource, superseded_by, computation, executor.resource and
attester.resource. Source scopes can be descriptive text.
Bare paths resolve against the concept's directory. An older bundle or one
without a declaration can retry a path field at the root. A v0.3 path field
explicitly starts at the root when it has a leading slash.
LOG ADVISORIES
okf validate reports concepts whose generated date is newer than the newest
entry in the nearest enclosing log.md. These stale-log findings are advisory
by default:
okf validate BUNDLE
okf validate BUNDLE --log-enforce
Use --log-enforce to make stale-log advisories fail the command. Use
okf log BUNDLE --check-stale for the same date check without running all
validation, or okf log BUNDLE --since REF to ask git which changed concept
files did not change their nearest log.md in the same diff.
CONFORMANCE VS AUTHORING CHECKS
Only a nonempty type is required for a concept. Optional fields, unknown
types and extension keys are compatible with core conformance.
An explicitly selected profile can apply additional rules. An untyped
Markdown record carrying the profile's document ID is checked when that
profile requires type. Profile diagnostics are advisory until
--profile-enforce is supplied. See "okf help profiles".
VERSION DECLARATION
A bundle may declare its format version in its root index.md frontmatter:
okf_version: "0.3"
Older and undeclared bundles remain readable. Strict mode diagnoses legacy
fields superseded by the declared version and warns on unknown versions.
OUTPUT
A valid bundle prints a concept count and exits 0:
OK: 3 concepts (okf_version 0.3)
An invalid bundle prints deterministic errors to stderr and exits non-zero,
for example:
orders: link to missing concept: customers
computations/revenue: Attested Computation concepts must declare runtime
SEE ALSO
okf help profiles Checking a bundle against house conventions.
okf help format Concept IDs, frontmatter, and links.
okf help computations The attested computation checks, in context.
okf help log Log advisories and --log-enforce.
okf help index Declaring okf_version with okf index.
PROFILE RELATIONS
Profile constraints can require grouped presence, order timestamps, check
text membership, and reject duplicate text across fields in one concept.
They run offline; indexed paths identify invalid occurrences. All profile
deviations remain advisory unless --profile-enforce is supplied.
NESTED FIELD NAMES
A profile may close elementFields or objectFields with NestedRules'
allowUnknownFields = False. Each undeclared member produces a diagnostic at
its actual path, such as rows[0].stray or settings.extra. This includes keys
with null or empty values and core names such as title. Declared conditional
members stay declared when their presence condition is false. Both validation
modes check closure; --profile-enforce makes the advisory deviations fail.
Existing descriptors stay open unless they opt in.