When a config field is optional/nullable (or has multiple shapes), never rely on “default” or presence quirks. Make absence vs presence explicit, align schema rules with runtime parsing/normalization, and validate the structural inputs that runtime can actually interpret.
Apply these rules:
default will populate runtime values: implement (and test) normalization during reconciliation/parsing so omitted fields resolve to the correct internal default, while explicit values like 0 are preserved.{}-like objects so you don’t fall through to unintended plaintext/empty literals.Example (absence vs explicit empty mode):
const: "" if you want to reject cases where override_mode is omitted but other override fields are set.if/then/else/not logic that makes the empty-mode branch match only when the field is truly in the empty-state, not when it’s missing.Example (defaults annotation vs runtime normalization):
default as documentation.if input == nil { resolved = 200 } else { resolved = input }0 stays 0 and omission becomes the intended default.Enter the URL of a public GitHub repository