You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: utils.rs
    path of file: ./repos/rivet/svc/api/kv/src
    
    the code of the file until where you have to start completion: use api_helper::anchor::WatchResponse;
use rivet_api::models;
use rivet_operation::prelude::*;

pub enum SlashConfig {
	NeedsTrailingSlash,
	NeedsNoTrailingSlash,
	None,
}

/// Validates a list of keys
pub fn validate_keys(keys: &[impl AsRef<str>], directory: bool) -> GlobalResult<()> {
	for (i, key) in keys.iter().enumerate() {
		let key = key.as_ref();

		if !directory {
			ensure_with!(
				!key.is_empty(
    
pub fn validate_keys(keys: &[impl AsRef<str>], directory: bool) -> GlobalResult<()> {
	for (i, key) in keys.iter().enumerate() {
		let key = key.as_ref();

		if !directory {
			ensure_with!(
				!key.is_empty(),
				KV_KEY_VALIDATION_ERROR,
				index = i,
				error = "Too short"
			);
		}

		ensure_with!(
			key.len() < 512,
			KV_KEY_VALIDATION_ERROR,
			index = i,
			error = "Too long (> 512 chars)",
		);
	}

	Ok(())
}