parse(schema, value), except that keys the schema doesn't declare are
dropped rather than refused — the forward-compatible read of a payload a
remote authored.
Output schemas are strict so the server's DEV output validation catches a
handler leaking fields it shouldn't. The receiving side, though, is often
older than the remote it talks to — a deploy lands before open tabs reload
— and a remote that adds a field is making a compatible change. So when
every issue is an unknown key (unknown_key_targets), those keys are
stripped from a copy of value and it's parsed again, until a parse
succeeds or reports anything else; any other issue (a wrong type, a missing
field, null where a value is required) still fails. value itself is
never mutated. This matches serde's default on the Rust spine, which
ignores unknown fields.
A parse reports at most a hundred issues, so a pass that only
deleted the reported keys would take a parse per hundred unknown keys,
quadratic in a payload of many. So after the first parse that reports
unknown keys, one schema-guided pass deletes every key a strict object
doesn't name anywhere the schema reaches — object entries, array items,
record values, the variant option the discriminator picks — and the next
parse usually succeeds. A key under a union is never
stripped: which option will match isn't known, and the union fails as one
issue of its own. A later pipe stage is stripped only as reported, as the
pass reads only a pipe's first schema, so keys a later stage refuses that
the first names still go a hundred a parse. A pass that finds
nothing to strip ends it, and the passes are capped at
UNKNOWN_KEY_PASSES_MAX, past which the last failure is
returned, so the work stays linear in the payload whatever its shape.
A union reports one issue of its own, so a key inside one is not
stripped and the parse fails; a variant reports its matched option's
issues, so those are.
Used for a response's result (ActionEvent) and for a peer's reply to a
server-initiated request (peer/ping).