public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Christoph Heiss <c.heiss@proxmox.com>
To: Thomas Lamprecht <t.lamprecht@proxmox.com>
Cc: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH installer] post-hook: add `$version` field describing document schema version
Date: Tue, 12 Nov 2024 15:06:45 +0100	[thread overview]
Message-ID: <ck5gs2duhgbfp6izodvqn6sxcsdag5q3guvm6dcgyvrrlxg5hx@aopbga5dxtw7> (raw)
In-Reply-To: <05e00eda-7161-4c4a-8a89-5c73517a3c81@proxmox.com>

On Tue, Nov 12, 2024 at 02:44:48PM +0100, Thomas Lamprecht wrote:
> Am 12.11.24 um 14:18 schrieb Christoph Heiss:
> > [..]
> > --- a/proxmox-post-hook/src/main.rs
> > +++ b/proxmox-post-hook/src/main.rs
> > @@ -133,6 +133,17 @@ struct CpuInfo {
> >  #[derive(Serialize)]
> >  #[serde(rename_all = "kebab-case")]
> >  struct PostHookInfo {
> > +    /// major.minor version describing the schema version of this document, in a semanticy-version
> > +    /// way.
> > +    ///
> > +    /// major: Incremented for incompatible/breaking API changes, e.g. removing an existing
> > +    /// field.
> > +    /// minor: Incremented when adding functionality in a backwards-compatible matter, e.g.
> > +    /// adding a new field.
> > +    // 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 = "$version")]
>
> maybe still use $format-version or $hook-version or the like for the
> serialized key? I.e., to even better convey that this is, e.g., not some
> version from the installer or product.

What do you think about

    "$hook": { "version": "1.0" }`

maybe, thereby making it a bit more structured from the start?
Esp. when thinking about future expansions, if we ever want to add
additional metadata fields.

As we're already on the topic of future changes.

But no hard feelings, otherwise I'd just go with `$hook-version`.

>
> Albeit a hook-version would be probably sent along as HTTP header, as
> that then would even bigger change, but as a) it's rather unlikely that
> we change away from JSON and b) the absence of such a header can be used
> as v0, it is probably overkill now.

Also, sending as HTTP header would most likely complicate implementing
a server somewhat, depending on the tool/framework used. IOW, having it
in the document directly is quite useful IMO.

But it's a nice idea for the future to have, if we ever need something
like this.


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


  reply	other threads:[~2024-11-12 14:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-12 13:18 Christoph Heiss
2024-11-12 13:44 ` Thomas Lamprecht
2024-11-12 14:06   ` Christoph Heiss [this message]
2024-11-12 14:29     ` Thomas Lamprecht

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=ck5gs2duhgbfp6izodvqn6sxcsdag5q3guvm6dcgyvrrlxg5hx@aopbga5dxtw7 \
    --to=c.heiss@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=t.lamprecht@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