Skip to main content

Module loader

Module loader 

Source
Expand description

File loader for $ref resolution.

$ref loads external YAML files. The compose engine never touches the filesystem directly — it goes through the FileLoader trait, so the shared fixtures supply a virtual in-memory file set (the spec graph is the input; no disk needed). The only implementation today is MemoryLoader; a disk + YAML backed loader is not implemented yet — when added it plugs into the same trait without touching the engine.

Path normalization:

  • absolute (/…) paths pass through unchanged
  • relative paths get the basepath prefix (basepath + '/' + path)

The loader receives the ALREADY-normalized absolute key, so cycle detection and the fixture map key on one canonical identifier.

Structs§

MemoryLoader
In-memory loader over a fixed { key: doc } map. Shared fixtures pass a file set here; the engine resolves $ref against it with no disk access. Keys are the normalized identifiers (normalize output).

Traits§

FileLoader
Loads a normalized file key to its parsed document. load returns ComposeLoadError(REF_FILE_NOT_FOUND) when the key is absent — the engine relies on that exact code (an unresolved $ref is a load error, never valid:true).

Type Aliases§

LoadedDoc
A loaded YAML document (a parsed object tree). Always an object map at the top.