Class: OKF::Bundle::Validator
- Inherits:
-
Object
- Object
- OKF::Bundle::Validator
- Defined in:
- lib/okf/bundle/validator.rb,
lib/okf/bundle/validator/result.rb
Overview
Checks an OKF::Bundle against the OKF v0.1 conformance rules (§9), which has three conditions — all hard errors:
§9.1 every non-reserved file has a parseable YAML frontmatter block;
§9.2 every such block has a non-empty `type`;
§9.3 every index.md/log.md present follows the §6/§7 structure — a nested
index.md has no frontmatter, a root index.md carries only okf_version,
and log.md date headings are ISO `YYYY-MM-DD`.
Everything the spec marks as soft guidance is a warning and never makes a bundle non-conformant: missing recommended fields, non-list tags, an unparseable timestamp, and broken cross-links (§5.3), which consumers MUST tolerate. Pure — it reads nothing from disk; it works entirely on the in-memory bundle.
Defined Under Namespace
Classes: Result
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(bundle) ⇒ Validator
constructor
A new instance of Validator.
Constructor Details
Class Method Details
.call(bundle) ⇒ Object
20 21 22 |
# File 'lib/okf/bundle/validator.rb', line 20 def self.call(bundle) new(bundle).call end |
Instance Method Details
#call ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/okf/bundle/validator.rb', line 29 def call @existing = @bundle.paths.to_set @bundle.concepts.each { |concept| validate_concept(concept) } @bundle.reserved.each { |entry| validate_reserved(entry) } @bundle.unparseable.each { |entry| validate_unparseable(entry) } @result end |