Class ManifestParser

Class Documentation

class ManifestParser

Parses manifest YAML files into Manifest structure.

The parser handles YAML loading and converts the document into internal model structures (Area, Component, App, Function).

Public Functions

Manifest parse_file(const std::string &file_path) const

Parse manifest from file.

Parameters:

file_path – Path to YAML file

Throws:

std::runtime_error – if file cannot be read or parsed

Returns:

Parsed manifest

Manifest parse_string(const std::string &yaml_content) const

Parse manifest from YAML string.

Parameters:

yaml_content – YAML content as string

Throws:

std::runtime_error – if YAML is malformed

Returns:

Parsed manifest

Manifest parse_fragment_file(const std::string &file_path) const

Parse a manifest fragment from file.

Fragments declare a subset of a manifest (apps, components, functions) intended to be merged on top of a base manifest at load time. A fragment MAY declare manifest_version but is not required to - when omitted, a synthetic "1.0" value is injected so the shared parse_string pipeline still sees a well-formed manifest. Forbidden top-level fields (areas, metadata, discovery, scripts, capabilities, lock_overrides) are still parsed into the returned Manifest so the caller (ManifestManager::apply_fragments) can detect and reject them with a specific validation error.

Files larger than kMaxFragmentBytes are rejected up-front without being read into memory.

Parameters:

file_path – Path to fragment YAML

Throws:

std::runtime_error – if file cannot be read or parsed, or if it exceeds kMaxFragmentBytes.

Returns:

Parsed manifest with only the fragment-allowed sections populated

Public Static Attributes

static constexpr std::uintmax_t kMaxFragmentBytes = 1U << 20U

Maximum accepted size of a single fragment file in bytes. fragments_dir is user-configurable, so a misconfigured path (or a symlink pointing at a large log file) could otherwise feed an unbounded amount of data into YAML::Load, which has no builtin cap. 1 MiB is well above any realistic fragment (tens of entities) while keeping worst-case allocation bounded.