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 conformance rules (§11), which has three conditions — all hard errors:
§11 c1 every non-reserved file has a parseable YAML frontmatter block;
§11 c2 every such block has a non-empty `type`;
§11 c3 every index.md/log.md present follows the §8/§9 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, broken cross-links (§6.1), and every v0.2 family shape (§5, §10). Pure — it reads nothing from disk; it works entirely on the in-memory bundle.
Warnings are machine-readable: each carries a check: id and a source:
naming who states the rule — :spec for the SPEC's own words,
:convention for a shape this gem asks for beyond them. Errors keep their
exact two-key shape; consumers already read it.
Defined Under Namespace
Classes: Result
Constant Summary collapse
- CONVENTION_CHECKS =
The warnings that state a gem convention rather than a SPEC rule. §5.1 gives
usage_countno type and §10.2 marks onlyruntimeREQUIRED;verified[].byis REQUIRED-within by analogy withgenerated.by, not by the SPEC's own words. A consumer that wants only the spec-normative warnings filters onsource:instead of string-matching messages. %i[ verified_entry_by source_usage_count source_usage_window_shape parameter_name executor_resource attester_resource ].freeze
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
35 36 37 |
# File 'lib/okf/bundle/validator.rb', line 35 def self.call(bundle) new(bundle).call end |
Instance Method Details
#call ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/okf/bundle/validator.rb', line 44 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 |