Data Models

These dataclasses are returned by the Python API and used throughout okf-schema.

Validation

class okf_schema._internal.models.Finding(code, message, path=None)

A single validation finding (error or warning).

Parameters:
  • code (str)

  • message (str)

  • path (Path | None)

class okf_schema._internal.models.Report(errors=<factory>, warnings=<factory>)

Aggregated validation report for an OKF bundle.

Parameters:
property is_conformant: bool

Return True if the report contains no errors.

add_error(code, message, path=None)

Append an error finding to the report.

Return type:

None

Parameters:
  • code (str)

  • message (str)

  • path (Path | None)

add_warning(code, message, path=None)

Append a warning finding to the report.

Return type:

None

Parameters:
  • code (str)

  • message (str)

  • path (Path | None)

Concepts

class okf_schema._internal.models.ConceptInfo(title, description, type)

Extracted metadata from an OKF concept file.

Parameters:
  • title (str)

  • description (str)

  • type (str)

class okf_schema._internal.models.ConceptSummary(path, type, title)

Summary of a single concept in an OKF bundle.

Parameters:
  • path (str)

  • type (str)

  • title (str)

class okf_schema._internal.models.ConceptDetail(frontmatter, body)

Detailed view of a single concept file.

Parameters:
  • frontmatter (dict)

  • body (str)

Search and navigation

class okf_schema._internal.models.SearchResult(path, type, title)

Result from searching an OKF bundle.

Parameters:
  • path (str)

  • type (str)

  • title (str)

class okf_schema._internal.models.BacklinkResult(target, source)

A single backlink: a source concept that links to a target concept.

Parameters:
  • target (str)

  • source (str)

class okf_schema._internal.models.IndexUpdate(path, action)

Record of an index.md update operation.

Parameters:
  • path (str)

  • action (str)

Statistics

class okf_schema._internal.models.BundleStats(total_files, total_concepts, files_without_frontmatter, total_size, total_links, broken_links, types_distribution, tags_distribution, directories)

Statistics for an OKF bundle.

Parameters:
  • total_files (int)

  • total_concepts (int)

  • files_without_frontmatter (int)

  • total_size (int)

  • total_links (int)

  • broken_links (int)

  • types_distribution (dict[str, int])

  • tags_distribution (dict[str, int])

  • directories (int)