From: Christoph Heiss <c.heiss@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH installer] fetch-answer, post-hook: rename $format-info to $schema
Date: Fri, 15 Nov 2024 17:28:18 +0100 [thread overview]
Message-ID: <20241115163000.1189086-1-c.heiss@proxmox.com> (raw)
'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
reply other threads:[~2024-11-15 16:30 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20241115163000.1189086-1-c.heiss@proxmox.com \
--to=c.heiss@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