public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Shan Shaji <s.shaji@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH proxmox v2 5/6] pve-api-types: register missing pve-fw-comment-spec verify function
Date: Wed,  2 Sep 2026 16:59:43 +0200	[thread overview]
Message-ID: <20260902145944.365185-6-s.shaji@proxmox.com> (raw)
In-Reply-To: <20260902145944.365185-1-s.shaji@proxmox.com>

Earlier, `make all` failed to regenerate the types due to missing
registration of pve-fw-comment-spec format function. Resolved it
by registering it.

Signed-off-by: Shan Shaji <s.shaji@proxmox.com>
---
 pve-api-types/generate.pl            |  2 +-
 pve-api-types/pve-api.json           | 25 +++++++++++++++++++++++++
 pve-api-types/src/generated/types.rs |  8 ++++++++
 pve-api-types/src/types/verifiers.rs |  9 +++++++++
 4 files changed, 43 insertions(+), 1 deletion(-)

diff --git a/pve-api-types/generate.pl b/pve-api-types/generate.pl
index 927c822b..26d1b842 100755
--- a/pve-api-types/generate.pl
+++ b/pve-api-types/generate.pl
@@ -124,7 +124,7 @@ Schema2Rust::register_format('pve-sdn-controller-id' => { code => 'verifiers::ve
 Schema2Rust::register_format('pve-sdn-isis-net' => { regex => '^[a-fA-F0-9]{2}(\.[a-fA-F0-9]{4}){3,9}\.[a-fA-F0-9]{2}$' });
 Schema2Rust::register_format('pve-sdn-fabric-id' => { code => 'verifiers::verify_sdn_id' });
 Schema2Rust::register_format('pve-sdn-route-map-id' => { code => 'verifiers::verify_sdn_route_map_id' });
-
+Schema2Rust::register_format('pve-fw-comment-spec' => { code => 'verifiers::verify_fw_comment_spec' });
 # This is used as both a task status and guest status.
 Schema2Rust::generate_enum('IsRunning', {
     type => 'string',
diff --git a/pve-api-types/pve-api.json b/pve-api-types/pve-api.json
index 36ba0b07..1006538e 100644
--- a/pve-api-types/pve-api.json
+++ b/pve-api-types/pve-api.json
@@ -143,6 +143,7 @@
       "pve-day-of-week": ("Code")[],
       "pve-dir-override": ("Code")[],
       "pve-fw-addr-spec": ("Code")[],
+      "pve-fw-comment-spec": ("Code")[],
       "pve-fw-conntrack-helper": ("Code")[],
       "pve-fw-dport-spec": ("Code")[],
       "pve-fw-icmp-type-spec": ("Code")[],
@@ -5290,6 +5291,7 @@
                                              },
                                              "comment": {
                                                 "description": "Descriptive comment.",
+                                                "format": "pve-fw-comment-spec",
                                                 "optional": 1,
                                                 "type": "string"
                                              },
@@ -5496,6 +5498,7 @@
                                        },
                                        "comment": {
                                           "description": "Descriptive comment.",
+                                          "format": "pve-fw-comment-spec",
                                           "optional": 1,
                                           "type": "string"
                                        },
@@ -5622,6 +5625,7 @@
                               "items": {
                                  "properties": {
                                     "comment": {
+                                       "description": "Optional comment or description.",
                                        "optional": 1,
                                        "type": "string"
                                     },
@@ -5659,6 +5663,7 @@
                               "additionalProperties": 0,
                               "properties": {
                                  "comment": {
+                                    "format": "pve-fw-comment-spec",
                                     "optional": 1,
                                     "type": "string"
                                  },
@@ -5784,6 +5789,7 @@
                                        },
                                        "comment": {
                                           "description": "Descriptive comment.",
+                                          "format": "pve-fw-comment-spec",
                                           "optional": 1,
                                           "type": "string"
                                        },
@@ -5951,6 +5957,7 @@
                                  },
                                  "comment": {
                                     "description": "Descriptive comment.",
+                                    "format": "pve-fw-comment-spec",
                                     "optional": 1,
                                     "type": "string"
                                  },
@@ -6142,6 +6149,7 @@
                                           "properties": {
                                              "cidr": ("Ref")["/root/0/children/5/children/2/children/0/children/0/info/DELETE/parameters/properties/cidr"],
                                              "comment": {
+                                                "format": "pve-fw-comment-spec",
                                                 "optional": 1,
                                                 "type": "string"
                                              },
@@ -6361,6 +6369,7 @@
                               "additionalProperties": 0,
                               "properties": {
                                  "comment": {
+                                    "format": "pve-fw-comment-spec",
                                     "optional": 1,
                                     "type": "string"
                                  },
@@ -6485,6 +6494,7 @@
                                           "type": "string"
                                        },
                                        "comment": {
+                                          "format": "pve-fw-comment-spec",
                                           "optional": 1,
                                           "type": "string"
                                        },
@@ -6818,19 +6828,24 @@
                               "items": {
                                  "properties": {
                                     "comment": {
+                                       "description": "Optional comment or description.",
                                        "optional": 1,
                                        "type": "string"
                                     },
                                     "name": {
+                                       "description": "The name of the alias or ipset.",
                                        "type": "string"
                                     },
                                     "ref": {
+                                       "description": "The reference string used in firewall rules.",
                                        "type": "string"
                                     },
                                     "scope": {
+                                       "description": "The scope of the reference (e.g., SDN).",
                                        "type": "string"
                                     },
                                     "type": {
+                                       "description": "The type of reference (alias or ipset).",
                                        "enum": [
                                           "alias",
                                           "ipset"
@@ -12176,6 +12191,7 @@
                                                          },
                                                          "comment": {
                                                             "description": "Descriptive comment.",
+                                                            "format": "pve-fw-comment-spec",
                                                             "optional": 1,
                                                             "type": "string"
                                                          },
@@ -12336,6 +12352,7 @@
                                                    },
                                                    "comment": {
                                                       "description": "Descriptive comment.",
+                                                      "format": "pve-fw-comment-spec",
                                                       "optional": 1,
                                                       "type": "string"
                                                    },
@@ -20702,6 +20719,7 @@
                                                          },
                                                          "comment": {
                                                             "description": "Descriptive comment.",
+                                                            "format": "pve-fw-comment-spec",
                                                             "optional": 1,
                                                             "type": "string"
                                                          },
@@ -20874,6 +20892,7 @@
                                                    },
                                                    "comment": {
                                                       "description": "Descriptive comment.",
+                                                      "format": "pve-fw-comment-spec",
                                                       "optional": 1,
                                                       "type": "string"
                                                    },
@@ -21507,6 +21526,7 @@
                                                 "additionalProperties": 0,
                                                 "properties": {
                                                    "comment": {
+                                                      "format": "pve-fw-comment-spec",
                                                       "optional": 1,
                                                       "type": "string"
                                                    },
@@ -39456,6 +39476,7 @@
                                                          },
                                                          "comment": {
                                                             "description": "Descriptive comment.",
+                                                            "format": "pve-fw-comment-spec",
                                                             "optional": 1,
                                                             "type": "string"
                                                          },
@@ -39628,6 +39649,7 @@
                                                    },
                                                    "comment": {
                                                       "description": "Descriptive comment.",
+                                                      "format": "pve-fw-comment-spec",
                                                       "optional": 1,
                                                       "type": "string"
                                                    },
@@ -40261,6 +40283,7 @@
                                                 "additionalProperties": 0,
                                                 "properties": {
                                                    "comment": {
+                                                      "format": "pve-fw-comment-spec",
                                                       "optional": 1,
                                                       "type": "string"
                                                    },
@@ -53768,6 +53791,7 @@
                                              },
                                              "comment": {
                                                 "description": "Descriptive comment.",
+                                                "format": "pve-fw-comment-spec",
                                                 "optional": 1,
                                                 "type": "string"
                                              },
@@ -53938,6 +53962,7 @@
                                        },
                                        "comment": {
                                           "description": "Descriptive comment.",
+                                          "format": "pve-fw-comment-spec",
                                           "optional": 1,
                                           "type": "string"
                                        },
diff --git a/pve-api-types/src/generated/types.rs b/pve-api-types/src/generated/types.rs
index 6efedbff..129f82ed 100644
--- a/pve-api-types/src/generated/types.rs
+++ b/pve-api-types/src/generated/types.rs
@@ -3955,6 +3955,7 @@ pub struct CreateController {
             type: String,
         },
         comment: {
+            format: &ApiStringFormat::VerifyFn(verifiers::verify_fw_comment_spec),
             optional: true,
             type: String,
             description: "Descriptive comment",
@@ -3987,6 +3988,7 @@ pub struct CreateFirewallAlias {
             description: "CIDR address",
         },
         comment: {
+            format: &ApiStringFormat::VerifyFn(verifiers::verify_fw_comment_spec),
             optional: true,
             type: String,
             description: "Descriptive comment",
@@ -4996,14 +4998,18 @@ pub struct FirewallMacro {
 /// Object.
 #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
 pub struct FirewallRef {
+    /// Optional comment or description.
     #[serde(default, skip_serializing_if = "Option::is_none")]
     pub comment: Option<String>,
 
+    /// The name of the alias or ipset.
     pub name: String,
 
+    /// The reference string used in firewall rules.
     #[serde(rename = "ref")]
     pub r#ref: String,
 
+    /// The scope of the reference (e.g., SDN).
     pub scope: String,
 
     #[serde(rename = "type")]
@@ -21996,6 +22002,7 @@ pub struct UpdateClusterOptions {
             type: String,
         },
         comment: {
+            format: &ApiStringFormat::VerifyFn(verifiers::verify_fw_comment_spec),
             optional: true,
             type: String,
             description: "Descriptive comment",
@@ -22035,6 +22042,7 @@ pub struct UpdateFirewallAlias {
 #[api(
     properties: {
         comment: {
+            format: &ApiStringFormat::VerifyFn(verifiers::verify_fw_comment_spec),
             optional: true,
             type: String,
             description: "Descriptive comment",
diff --git a/pve-api-types/src/types/verifiers.rs b/pve-api-types/src/types/verifiers.rs
index c377c4a0..b0ebaba4 100644
--- a/pve-api-types/src/types/verifiers.rs
+++ b/pve-api-types/src/types/verifiers.rs
@@ -61,6 +61,7 @@ pub SDN_ROUTE_MAP_ID_RESERVED = r##"^(pve_.*|MAP_VTEP_IN|MAP_VTEP_OUT|correct_sr
 
 pub SCOPED_IP_ALIAS_RE = r##"^(dc/|guest/)?([A-Za-z][A-Za-z0-9\-\_]+)$"##;
 
+pub LINE_FEED_RE = r##"[\n\r]"##;
 }
 
 pub fn verify_volume_id(s: &str) -> Result<(), Error> {
@@ -346,3 +347,11 @@ pub fn verify_pve_acme_alias(s: &str) -> Result<(), Error> {
         bail!("not a valid acme alias");
     }
 }
+
+pub fn verify_fw_comment_spec(s: &str) -> Result<(), Error> {
+    if LINE_FEED_RE.is_match(s) {
+        bail!("comment must not contain a line feed");
+    }
+
+    Ok(())
+}
-- 
2.47.3





  parent reply	other threads:[~2026-09-02 15:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-02 14:59 [PATCH manager/proxmox{-yew-comp,} v2 0/6] add missing uptime to the GUI, update API dump, and regenerate pve-api-types Shan Shaji
2026-09-02 14:59 ` [PATCH pve-manager v2 1/6] fix: nodes: update `idle` key value in hash reference Shan Shaji
2026-09-02 14:59 ` [PATCH pve-manager v2 2/6] fix: node: add missing `uptime` property inside the return schema Shan Shaji
2026-09-02 14:59 ` [PATCH proxmox-yew-comp v2 3/6] fix #7932: add missing uptime to the GUI Shan Shaji
2026-09-02 14:59 ` [PATCH proxmox v2 4/6] chore: pve-api-types: update API dump and regenerate types Shan Shaji
2026-09-02 14:59 ` Shan Shaji [this message]
2026-09-02 14:59 ` [PATCH proxmox v2 6/6] pve-api-types: update API dump for /node/status " Shan Shaji

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260902145944.365185-6-s.shaji@proxmox.com \
    --to=s.shaji@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal