[pve-devel] [PATCH v4 proxmox 02/69] schema: add schema/format for comments
Lukas Wagner
l.wagner at proxmox.com
Thu Jul 20 16:31:29 CEST 2023
Signed-off-by: Lukas Wagner <l.wagner at proxmox.com>
---
Notes:
Changes since v3:
- New in v4
proxmox-schema/src/api_types.rs | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/proxmox-schema/src/api_types.rs b/proxmox-schema/src/api_types.rs
index ba6f02df..0cec043c 100644
--- a/proxmox-schema/src/api_types.rs
+++ b/proxmox-schema/src/api_types.rs
@@ -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();
--
2.39.2
More information about the pve-devel
mailing list