From: Shannon Sterz <s.sterz@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH proxmox 1/4] router/api-macro: add unstable flag for ApiMethod
Date: Wed, 12 Nov 2025 11:24:09 +0100 [thread overview]
Message-ID: <20251112102415.175358-3-s.sterz@proxmox.com> (raw)
In-Reply-To: <20251112102415.175358-1-s.sterz@proxmox.com>
this allows marking certain api endpoints as unstable. an unstable api
endpoint gives no guarantees that it will stay compatible between
different versions. programmers that make use of an unstable endpoint,
have to expect that anything is subject to change.
docgen: add docgen crate
this crate allows products to easily dump their api definitions to a
`Value` that can be output as json for an api viewer.
meh
Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---
proxmox-api-macro/src/api/method.rs | 9 ++++++++-
proxmox-router/src/router.rs | 10 ++++++++++
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/proxmox-api-macro/src/api/method.rs b/proxmox-api-macro/src/api/method.rs
index d3d17447..68969735 100644
--- a/proxmox-api-macro/src/api/method.rs
+++ b/proxmox-api-macro/src/api/method.rs
@@ -245,6 +245,12 @@ pub fn handle_method(mut attribs: JSONObject, func: syn::ItemFn) -> Result<Token
.transpose()?
.unwrap_or(false);
+ let unstable: bool = attribs
+ .remove("unstable")
+ .map(TryFrom::try_from)
+ .transpose()?
+ .unwrap_or(false);
+
if !attribs.is_empty() {
error!(
attribs.span(),
@@ -329,7 +335,8 @@ pub fn handle_method(mut attribs: JSONObject, func: syn::ItemFn) -> Result<Token
#returns_schema_setter
#access_setter
.reload_timezone(#reload_timezone)
- .protected(#protected);
+ .protected(#protected)
+ .unstable(#unstable);
#default_consts
diff --git a/proxmox-router/src/router.rs b/proxmox-router/src/router.rs
index 732ced8b..f4207d2a 100644
--- a/proxmox-router/src/router.rs
+++ b/proxmox-router/src/router.rs
@@ -789,6 +789,8 @@ pub struct ApiMethod {
/// The protected flag indicates that the provides function should be forwarded
/// to the daemon running in privileged mode.
pub protected: bool,
+ /// Whether this method is still experimental or already stable.
+ pub unstable: bool,
/// This flag indicates that the provided method may change the local timezone, so the server
/// should do a tzset afterwards
pub reload_timezone: bool,
@@ -820,6 +822,7 @@ impl ApiMethod {
handler,
returns: ReturnType::new(false, &NULL_SCHEMA),
protected: false,
+ unstable: false,
reload_timezone: false,
access: ApiAccess {
description: None,
@@ -838,6 +841,7 @@ impl ApiMethod {
handler: &DUMMY_HANDLER,
returns: ReturnType::new(false, &NULL_SCHEMA),
protected: false,
+ unstable: false,
reload_timezone: false,
access: ApiAccess {
description: None,
@@ -858,6 +862,12 @@ impl ApiMethod {
self
}
+ pub const fn unstable(mut self, unstable: bool) -> Self {
+ self.unstable = unstable;
+
+ self
+ }
+
pub const fn reload_timezone(mut self, reload_timezone: bool) -> Self {
self.reload_timezone = reload_timezone;
--
2.47.3
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
next prev parent reply other threads:[~2025-11-12 10:23 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-12 10:24 [pdm-devel] [PATCH datacenter-manager/proxmox{, -backup}/widget-toolkit 0/8] unstable flag and pdm api viewer Shannon Sterz
2025-11-12 10:24 ` [pdm-devel] [PATCH widget-toolkit 1/1] api viewer: add support for endpoints that are marked as unstable Shannon Sterz
2025-11-12 10:24 ` Shannon Sterz [this message]
2025-11-12 10:24 ` [pdm-devel] [PATCH proxmox 2/4] docgen: add docgen crate Shannon Sterz
2025-11-12 10:24 ` [pdm-devel] [PATCH proxmox 3/4] docgen: add support for the new stable flag Shannon Sterz
2025-11-12 10:24 ` [pdm-devel] [PATCH proxmox 4/4] docgen: add a stop-gap fix to allow generating schema for pve-api-types Shannon Sterz
2025-11-12 16:09 ` Shannon Sterz
2025-11-12 10:24 ` [pdm-devel] [PATCH proxmox-backup 1/1] docgen: use proxmox-rs docgen crate Shannon Sterz
2025-11-12 10:24 ` [pdm-devel] [PATCH datacenter-manager 1/2] docgen: switch to " Shannon Sterz
2025-11-12 10:24 ` [pdm-devel] [PATCH datacenter-manager 2/2] api-viewer: add an api-viewer package Shannon Sterz
2025-11-13 12:02 ` [pdm-devel] Superseded: Re: [PATCH datacenter-manager/proxmox{, -backup}/widget-toolkit 0/8] unstable flag and pdm api viewer Shannon Sterz
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=20251112102415.175358-3-s.sterz@proxmox.com \
--to=s.sterz@proxmox.com \
--cc=pdm-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