From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pve-devel-bounces@lists.proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9])
	by lore.proxmox.com (Postfix) with ESMTPS id 167151FF16F
	for <inbox@lore.proxmox.com>; Fri, 15 Nov 2024 17:30:10 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id 41523197D9;
	Fri, 15 Nov 2024 17:30:11 +0100 (CET)
From: Christoph Heiss <c.heiss@proxmox.com>
To: pve-devel@lists.proxmox.com
Date: Fri, 15 Nov 2024 17:28:18 +0100
Message-ID: <20241115163000.1189086-1-c.heiss@proxmox.com>
X-Mailer: git-send-email 2.47.0
MIME-Version: 1.0
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.029 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more
 information. [http.rs, main.rs]
Subject: [pve-devel] [PATCH installer] fetch-answer,
 post-hook: rename $format-info to $schema
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: pve-devel-bounces@lists.proxmox.com
Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com>

'schema' describes the purpose the of this object better and is a more
"industry-standard" term.

Changes it for both locations where we currently have such an object.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
No hard feelings though if stay with $format-info if that is indeed
preferred.

 proxmox-fetch-answer/src/fetch_plugins/http.rs | 14 +++++++-------
 proxmox-post-hook/src/main.rs                  | 14 +++++++-------
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/proxmox-fetch-answer/src/fetch_plugins/http.rs b/proxmox-fetch-answer/src/fetch_plugins/http.rs
index f982383..633d79d 100644
--- a/proxmox-fetch-answer/src/fetch_plugins/http.rs
+++ b/proxmox-fetch-answer/src/fetch_plugins/http.rs
@@ -32,7 +32,7 @@ static DHCP_LEASE_FILE: &str = "/var/lib/dhcp/dhclient.leases";
 /// Metadata of the HTTP POST payload, such as schema version of the document.
 #[derive(Serialize)]
 #[serde(rename_all = "kebab-case")]
-struct HttpFetchInfoMeta {
+struct HttpFetchInfoSchema {
     /// major.minor version describing the schema version of this document, in a semanticy-version
     /// way.
     ///
@@ -43,11 +43,11 @@ struct HttpFetchInfoMeta {
     version: String,
 }
 
-impl HttpFetchInfoMeta {
+impl HttpFetchInfoSchema {
     const SCHEMA_VERSION: &str = "1.0";
 }
 
-impl Default for HttpFetchInfoMeta {
+impl Default for HttpFetchInfoSchema {
     fn default() -> Self {
         Self {
             version: Self::SCHEMA_VERSION.to_owned(),
@@ -57,7 +57,7 @@ impl Default for HttpFetchInfoMeta {
 
 /// All data sent as request payload with the answerfile fetch POST request.
 ///
-/// NOTE: The format is versioned through `format_info.version` (`$format-info.version` in the
+/// NOTE: The format is versioned through `schema.version` (`$schema.version` in the
 /// resulting JSON), ensure you update it when this struct or any of its members gets modified.
 #[derive(Serialize)]
 #[serde(rename_all = "kebab-case")]
@@ -65,8 +65,8 @@ struct HttpFetchPayload {
     /// Metadata for the answerfile fetch payload
     // This field is prefixed by `$` on purpose, to indicate that it is document metadata and not
     // part of the actual content itself. (E.g. JSON Schema uses a similar naming scheme)
-    #[serde(rename = "$format-info")]
-    format_info: HttpFetchInfoMeta,
+    #[serde(rename = "$schema")]
+    schema: HttpFetchInfoSchema,
     /// Information about the running system, flattened into this structure directly.
     #[serde(flatten)]
     sysinfo: SysInfo,
@@ -77,7 +77,7 @@ impl HttpFetchPayload {
     /// full payload including meta data.
     fn get() -> Result<Self> {
         Ok(Self {
-            format_info: HttpFetchInfoMeta::default(),
+            schema: HttpFetchInfoSchema::default(),
             sysinfo: SysInfo::get()?,
         })
     }
diff --git a/proxmox-post-hook/src/main.rs b/proxmox-post-hook/src/main.rs
index ae373d8..da47da9 100644
--- a/proxmox-post-hook/src/main.rs
+++ b/proxmox-post-hook/src/main.rs
@@ -132,7 +132,7 @@ struct CpuInfo {
 /// Metadata of the hook, such as schema version of the document.
 #[derive(Serialize)]
 #[serde(rename_all = "kebab-case")]
-struct PostHookInfoMeta {
+struct PostHookInfoSchema {
     /// major.minor version describing the schema version of this document, in a semanticy-version
     /// way.
     ///
@@ -143,11 +143,11 @@ struct PostHookInfoMeta {
     version: String,
 }
 
-impl PostHookInfoMeta {
+impl PostHookInfoSchema {
     const SCHEMA_VERSION: &str = "1.0";
 }
 
-impl Default for PostHookInfoMeta {
+impl Default for PostHookInfoSchema {
     fn default() -> Self {
         Self {
             version: Self::SCHEMA_VERSION.to_owned(),
@@ -157,15 +157,15 @@ impl Default for PostHookInfoMeta {
 
 /// All data sent as request payload with the post-installation-webhook POST request.
 ///
-/// NOTE: The format is versioned through `format_info.version` (`$format-info.version` in the
+/// NOTE: The format is versioned through `schema.version` (`$schema.version` in the
 /// resulting JSON), ensure you update it when this struct or any of its members gets modified.
 #[derive(Serialize)]
 #[serde(rename_all = "kebab-case")]
 struct PostHookInfo {
     // This field is prefixed by `$` on purpose, to indicate that it is document metadata and not
     // part of the actual content itself. (E.g. JSON Schema uses a similar naming scheme)
-    #[serde(rename = "$format-info")]
-    format_info: PostHookInfoMeta,
+    #[serde(rename = "$schema")]
+    schema: PostHookInfoSchema,
     /// major.minor version of Debian as installed, retrieved from /etc/debian_version
     debian_version: String,
     /// PVE/PMG/PBS version as reported by `pveversion`, `pmgversion` or
@@ -248,7 +248,7 @@ impl PostHookInfo {
         };
 
         Ok(Self {
-            format_info: PostHookInfoMeta::default(),
+            schema: PostHookInfoSchema::default(),
             debian_version: read_file("/etc/debian_version")?,
             product: Self::gather_product_info(&setup_info, &run_cmd)?,
             iso: setup_info.iso_info.clone(),
-- 
2.47.0



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel