Skip to content

Demo File

A demo file is an optional companion to a tree-structured data file. Archmage derives structure and type information from both files, and the final definition is the union of the two.

A demo file is worth having for four reasons:

  • Isolation of meta nodes: The demo file holds all meta nodes, keeping the data file clean — nothing but data.
  • Recovery of missing fields: Even if some fields are missing from the data file, they are still populated into the exported data and generated code.
  • Stabilization of field order: It ensures a consistent field sequence within exported data and within generated code, regardless of how fields are ordered or elided across different versions of the data file.
  • Demonstration of field usage: It provides practical examples of field usage.

The demo file for foo.yaml is foo.demo.yaml. The pattern is:

<name>.demo.<ext>
  • Without a demo file: Meta nodes may reside directly in the data file.
  • With a demo file: Meta nodes must reside in the demo file, leaving the data file strictly clean.