Skip to main content

unknown_trigger_fields

Function unknown_trigger_fields 

Source
pub fn unknown_trigger_fields(
    raw: &Value,
    file: &TriggersFile,
) -> Vec<(String, String)>
Available on crate features serve and triggers only.
Expand description

Detect fields in the raw triggers document that the typed parse silently dropped. Returns (trigger_label, dotted_field_path) pairs — empty when the document has no unknown fields.

This works around serde’s inability to combine #[serde(flatten)] (carried by TriggerSpec.kind) with #[serde(deny_unknown_fields)]: a misspelled top-level trigger field such as debounce_sec (for debounce_secs) would otherwise deserialize to its default with no error. We round-trip each parsed TriggerSpec back to JSON and report any raw key absent from that serialization, so the allow-list is derived from the types themselves and can never drift. Nested objects (store, queue, run) are checked too; the opaque inline pipeline config: sub-document is deliberately not descended into (its keys belong to a full pipeline config validated elsewhere).