public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH installer] fetch-answer, post-hook: rename $format-info to $schema
@ 2024-11-15 16:28 Christoph Heiss
  2024-11-17 15:05 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Christoph Heiss @ 2024-11-15 16:28 UTC (permalink / raw)
  To: pve-devel

'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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-11-17 15:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-15 16:28 [pve-devel] [PATCH installer] fetch-answer, post-hook: rename $format-info to $schema Christoph Heiss
2024-11-17 15:05 ` [pve-devel] applied: " Thomas Lamprecht

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