Re: [PATCH proxmox v3 4/8] schema: provide integer schema for node ports

Thomas Lamprecht
2026-03-31T22:55:43Z

Am 30.03.26 um 20:28 schrieb Christoph Heiss:
> Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
> ---
> Changes v2 -> v3:
> * no changes
>
> Changes v1 -> v2:
> * no changes
>
> proxmox-schema/src/api_types.rs | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/proxmox-schema/src/api_types.rs b/proxmox-schema/src/api_types.rs
> index cfad4a10..3e31d97e 100644
> --- a/proxmox-schema/src/api_types.rs
> +++ b/proxmox-schema/src/api_types.rs
> @@ -1,7 +1,7 @@
> //! The "basic" api types we generally require along with some of their macros.
> use const_format::concatcp;
>
> -use crate::{ApiStringFormat, ArraySchema, Schema, StringSchema};
> +use crate::{ApiStringFormat, ArraySchema, IntegerSchema, Schema, StringSchema};
>
> #[rustfmt::skip]
> const IPV4OCTET: &str = r"(?:25[0-5]|(?:2[0-4]|1[0-9]|[1-9])?[0-9])";
> @@ -221,6 +221,11 @@ pub const HOST_PORT_SCHEMA: Schema =
> .format(&HOST_PORT_FORMAT)
> .schema();
>
> +pub const PORT_SCHEMA: Schema = IntegerSchema::new("Node port")

nit: Description is a bit odd for a generic port? Could be just "Port" or
"Network port" if we want to have some correlation with network?

> + .minimum(1)
> + .maximum(65535)
> + .schema();
> +
> pub const HTTP_URL_SCHEMA: Schema = StringSchema::new("HTTP(s) url with optional port.")
> .format(&HTTP_URL_FORMAT)
> .schema();