A served port omits everything that matches the default
The wire shape is lean by divergence, which means a client cannot read absence as "unknown". Absence is the default, and the defaults are fixed here.
The rule
- A served port MUST emit
defaultValueonly where the port has a default, anulldefault included;exposedByDefaultonly where it isfalse; anddisplayOrderonly where it is not 0. - A client MUST read the absence of those keys as no default, exposed (CFG-2), and order 0 respectively.
What it means
Only three things are left out: a default the port does not have, an exposure
of true, and a display order of 0. Nothing a caller might read as falsy is
left out on those grounds. A default value of null, false, an empty string
or an empty list is still a default the author set, and it is emitted; a display order of a negative number diverges from 0 just as much
as a positive one does, and is emitted too. A client that treats "absent" as
loosely as "falsy" reintroduces exactly the ambiguity the divergence rule
was meant to remove.
Example
A port with none of the three set at all serialises to nothing but the six core keys:
{
"id": "plain",
"name": "Plain",
"type": "input",
"dataType": "string",
"required": false,
"description": ""
}A port whose default is the literal value false still carries the key:
falseAnd a negative display order is emitted the same as a positive one:
-5