Skip to main content

validate_allowed_properties

Function validate_allowed_properties 

Source
pub fn validate_allowed_properties(
    payload: &Value,
    allowed: &[&str],
) -> Result<(), ValidationError>
Expand description

Check that every top-level key in the payload is in the allowed list.

This prevents clients from sending unrecognised properties that would be silently ignored, which can mask typos (e.g. "filed" instead of "fields"). Only top-level keys are checked — nested document data is not validated here.