Skip to main content

validate_item_attribute_values

Function validate_item_attribute_values 

Source
pub fn validate_item_attribute_values(item: &Item) -> Result<()>
Expand description

Validate all attribute values in an item.

Rejects:

  • Empty sets ({"SS": []}, {"NS": []}, {"BS": []})
  • Numbers that violate DynamoDB’s precision/range constraints
  • Nesting deeper than 32 levels

Validation is recursive: invalid values nested inside L (list) or M (map) are also rejected.

Note: Empty strings ({"S": ""}) and empty binary values ({"B": ""}) are permitted in non-key attributes since DynamoDB’s 2020 update. Key attributes are validated separately in helpers::validate_key_type.

Important: This must only be called on items being persisted, NOT on ExpressionAttributeValues (which may legitimately contain empty strings for comparisons).