Skip to content

Conditional Export

A __condition__ field decides whether its parent {} node is exported.

It follows the same syntax as the spreadsheet condition type.

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
"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 1001 node has no condition — it’s always exported.
  • The 1002 node is exported only when --semver >= v1.2.3.
  • The 1003 node is exported only when --semver >= v1.2.3 and --cflags is empty or includes dev.