--- id: MAN-7 family: GR-MAN level: extended profiles: [storage-api] posture: normative-target added: "1.0" changed: "1.0" source: https://flowdrop.io/spec/rules/gr-man/man-7 specification: FlowDrop Workflow Specification 1.0-draft licence: CC BY 4.0 --- # MAN-7 — Only a flat default is published *GR-MAN (Part I) · level: extended · profiles: storage-api · added in 1.0* A default is published so a caller knows what happens if they omit the input. Anything with nested structure is dropped rather than half-published, and the rest of the fragment survives the drop. ## The rule > **Normative.** This is the rule. > > 1. A `default` survives into the published contract when it is null, a scalar, or a collection one level deep whose every member is null or a scalar, an empty collection included. > > 2. A default of any other shape, including one with a nested value, is dropped and the drop is logged. > > 3. Dropping a default never affects the rest of the fragment: every other contract key of that entry is retained. ## What it means A default is published so a caller can know what happens without supplying the input, and that only works if the published value is exactly what the runtime would use. A scalar is always safe. A collection one level deep is safe too, as long as every member of it is itself null or a scalar — a flat list, or a flat map, both count. Anything deeper is dropped rather than half-published, because a caller reading a truncated nested default would be told the wrong thing with no way to notice. Dropping a default touches nothing else: every other key of that entry's contract fragment — its `type`, its `maxLength`, whatever else survived MAN-5's strip — is retained exactly as it was. ## Example ```json title="A scalar default" verdict="retained" { "type": "string", "default": "abc" } ``` ```json title="A one-level map whose members are scalar or null" verdict="retained" { "default": { "a": 1, "b": null } } ``` ```json title="A default nested one level too deep" verdict="dropped" { "type": "array", "default": { "nested": { "too": "deep" } } } ``` The third default is gone from the published fragment, but its `type` key is not: ```json title="What the third fragment publishes" { "type": "array", "x-data-type": "array" } ``` ## Related rules - Names: MAN-5 - Referenced by: MAN-5 --- Rule identifiers are permanent and are never renumbered. This specification carries no implementation status: each implementation publishes its own standing against these rules. Licensed CC BY 4.0.