Documentation
¶
Overview ¶
Package okfschema is the field-type registry an editor consults to know how a frontmatter key may be edited: which keys are closed enumerations, which hold tag lists, and which the indexer owns and a human must not retype. It is pure data with no store or UI dependency, so other surfaces (a future validate check) can reuse the same definitions.
Index ¶
Constants ¶
const SupersededByKey = "superseded_by"
SupersededByKey is the frontmatter key naming the document that replaces this one. It is a uri relative to the kb root, the same address space as a link target, and is free text rather than an enum: the set of valid values is every document in the tree (ADR-0010).
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FieldKind ¶
type FieldKind int
FieldKind is how an editor presents a frontmatter field.
const ( // KindText is a free-form single-line scalar. KindText FieldKind = iota // KindEnum is a scalar restricted to FieldSchema.Enum. KindEnum // KindTags is a list of strings, retyped as a whole. KindTags // KindReadOnly is a field the index or the pipeline owns; it is displayed // but never edited. KindReadOnly )
type FieldSchema ¶
FieldSchema describes one frontmatter key. Enum is populated only for KindEnum.
func FieldSchemaFor ¶
func FieldSchemaFor(docType, key string) FieldSchema
FieldSchemaFor returns how key should be edited on a document of docType. An unknown type or an unlisted key falls back on the key alone: tag lists for "tags", read-only for the system keys, free text otherwise — so an editor always has a usable answer and never rejects an unknown OKF type.
type TypeSchema ¶
type TypeSchema struct {
Fields []FieldSchema
}
TypeSchema is the set of known fields for one OKF document type.