Skip to main content

Module patch

Module patch 

Source
Expand description

$patch application — add / remove / replace over the $ref base (SPEC §5). There are no $after/$before/$merge/$change/$remove directives; $patch is the only overlay.

CRUDUI normalization (the analysis patch_ops): $patch is an OBJECT of operations. Two order-preserving input shapes are supported:

  1. Deep-path set — "field.validate.required": ".other". The dotted key is split into path segments and the value is SET at that node (creating intermediate objects). SPEC §5 canonical form. The value replaces a scalar leaf; for object values it deep-merges (both objects → deep merge, else the latter wins).

  2. Structured ops — explicit add / remove / replace keys:

    • add: { "path.to.new": value, … } — deep-merge value at path
    • replace: { "path.to.key": value, … } — same merge rule (scalar override)
    • remove: [ "path.to.key", … ] | { … } — deep delete

Resolution order: base ($ref) first, then $patch overlays. add/replace deep-merge; remove deep-deletes; deep-path set splits then applies. An unresolved patch (op shape error, path conflict, strict-remove miss) is a LOAD ERROR — never valid:true.

Functions§

apply_patch
Apply a $patch value to the (already $ref-expanded) base spec.