]> git.proxmox.com Git - proxmox.git/commitdiff
schema: add schema/format for comments
authorLukas Wagner <l.wagner@proxmox.com>
Thu, 20 Jul 2023 14:31:29 +0000 (16:31 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Mon, 24 Jul 2023 08:25:22 +0000 (10:25 +0200)
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
proxmox-schema/src/api_types.rs

index ba6f02df731170e09f258bb2d6c6afb3db9cc83d..0cec043c7fe2689f495264903457e5fcbc6614dd 100644 (file)
@@ -16,13 +16,21 @@ const_regex! {
     /// any identifier command line tools work with.
     pub SAFE_ID_REGEX = concat!(r"^", SAFE_ID_REGEX_STR!(), r"$");
     pub PASSWORD_REGEX = r"^[[:^cntrl:]]*$"; // everything but control characters
+    pub SINGLE_LINE_COMMENT_REGEX = r"^[[:^cntrl:]]*$"; // everything but control characters
 }
 
 pub const SAFE_ID_FORMAT: ApiStringFormat = ApiStringFormat::Pattern(&SAFE_ID_REGEX);
 pub const PASSWORD_FORMAT: ApiStringFormat = ApiStringFormat::Pattern(&PASSWORD_REGEX);
+pub const SINGLE_LINE_COMMENT_FORMAT: ApiStringFormat =
+    ApiStringFormat::Pattern(&SINGLE_LINE_COMMENT_REGEX);
 
 pub const PASSWORD_SCHEMA: Schema = StringSchema::new("Password.")
     .format(&PASSWORD_FORMAT)
     .min_length(1)
     .max_length(1024)
     .schema();
+
+pub const COMMENT_SCHEMA: Schema = StringSchema::new("Comment.")
+    .format(&SINGLE_LINE_COMMENT_FORMAT)
+    .max_length(128)
+    .schema();