Conditional Export
A __condition__ field decides whether its parent {} node is exported.
It follows the same syntax as the spreadsheet condition type.
Export Behavior
Section titled “Export Behavior”A __condition__ field doesn’t change the schema. It only affects what gets exported.
When a __condition__ value evaluates to false, Archmage removes the parent {} node from its enclosing node. What removal means depends on the data type of the enclosing node:
| Data Type | Effect |
|---|---|
{} |
Remove the parent {} field from its enclosing node. If its presence is implicit, then recover it with its default export value or zero value |
[] or map |
Remove the parent {} element from the container |
[N] |
Export fails — a fixed-size array cannot lose any element |
Example
Section titled “Example”"1001": myInt: 1 myStr: foo"1002": __condition__: v1.2.3 myInt: 2 myStr: bar"1003": __condition__: v1.2.3 && cflags=dev myInt: 3 myStr: qux{ "1001": { "myInt": 1, "myStr": "foo" }, "1002": { "__condition__": "v1.2.3", "myInt": 2, "myStr": "bar" }, "1003": { "__condition__": "v1.2.3 && cflags=dev", "myInt": 3, "myStr": "qux" }}- The
1001node has no condition — it’s always exported. - The
1002node is exported only when--semver >= v1.2.3. - The
1003node is exported only when--semver >= v1.2.3and--cflagsis empty or includesdev.