in core/sdk/src/topics/create_topic.rs [88:110]
fn validate(&self) -> Result<(), IggyError> {
if let Some(topic_id) = self.topic_id {
if topic_id == 0 {
return Err(IggyError::InvalidTopicId);
}
}
if self.name.is_empty() || self.name.len() > MAX_NAME_LENGTH {
return Err(IggyError::InvalidTopicName);
}
if !(0..=MAX_PARTITIONS_COUNT).contains(&self.partitions_count) {
return Err(IggyError::TooManyPartitions);
}
if let Some(replication_factor) = self.replication_factor {
if replication_factor == 0 {
return Err(IggyError::InvalidReplicationFactor);
}
}
Ok(())
}