You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current implementation doesn't validate field names when processing StaticSchema. Consider:
Empty field names should be rejected
Duplicate field names should be detected
Add validation before processing fields:
+ // Validate field names+ let mut seen_fields = std::collections::HashSet::new();+ for (field_name, _) in &fields {+ if field_name.is_empty() {+ return Err(StaticSchemaError::EmptyFieldName);+ }+ if !seen_fields.insert(field_name) {+ return Err(StaticSchemaError::DuplicateField(field_name.clone()));+ }+ }+
for (field_name, field_type) in fields {
Add the new error variants:
#[error("field name cannot be empty")]EmptyFieldName,#[error("duplicate field name: {0}")]DuplicateField(String),
The current implementation doesn't validate field names when processing
StaticSchema
. Consider:Add validation before processing fields:
Add the new error variants:
Originally posted by @coderabbitai[bot] in #1192 (comment)
The text was updated successfully, but these errors were encountered: