mirror of
https://github.com/GoodOlClint/PSProxmoxVE.git
synced 2026-08-09 22:09:24 +00:00
fix: validate API enum values against PVE OpenAPI spec
Add 70 xUnit tests that validate every ValidateSet in the module against the PVE OpenAPI spec. Three bugs found and fixed: - Storage: remove `glusterfs` (dropped in PVE 9), add `btrfs`, `esxi` - Backup compression: `none` → `0` (PVE uses "0" not "none") - Cluster resources: remove `lxc` filter (PVE uses `vm` for both) The pve-api-enums.json fixture (199KB) is extracted from the full OpenAPI spec and contains parameter enum values for 302 API paths. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -48,7 +48,7 @@ namespace PSProxmoxVE.Cmdlets.Backup
|
||||
/// <para type="description">The compression algorithm to use.</para>
|
||||
/// </summary>
|
||||
[Parameter(Mandatory = false, HelpMessage = "The compression algorithm.")]
|
||||
[ValidateSet("zstd", "lzo", "gzip", "none")]
|
||||
[ValidateSet("zstd", "lzo", "gzip", "0")]
|
||||
public string? Compress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace PSProxmoxVE.Cmdlets.Backup
|
||||
/// <para type="description">The compression algorithm to use.</para>
|
||||
/// </summary>
|
||||
[Parameter(Mandatory = false, HelpMessage = "The compression algorithm.")]
|
||||
[ValidateSet("zstd", "lzo", "gzip", "none")]
|
||||
[ValidateSet("zstd", "lzo", "gzip", "0")]
|
||||
public string? Compress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace PSProxmoxVE.Cmdlets.Backup
|
||||
/// <para type="description">Updated compression algorithm.</para>
|
||||
/// </summary>
|
||||
[Parameter(Mandatory = false, HelpMessage = "The compression algorithm.")]
|
||||
[ValidateSet("zstd", "lzo", "gzip", "none")]
|
||||
[ValidateSet("zstd", "lzo", "gzip", "0")]
|
||||
public string? Compress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -19,8 +19,8 @@ namespace PSProxmoxVE.Cmdlets.Cluster
|
||||
/// <summary>
|
||||
/// <para type="description">Filter by resource type.</para>
|
||||
/// </summary>
|
||||
[Parameter(Mandatory = false, Position = 0, HelpMessage = "Filter by resource type (vm, lxc, node, storage, sdn).")]
|
||||
[ValidateSet("vm", "lxc", "node", "storage", "sdn")]
|
||||
[Parameter(Mandatory = false, Position = 0, HelpMessage = "Filter by resource type (vm, node, storage, sdn).")]
|
||||
[ValidateSet("vm", "node", "storage", "sdn")]
|
||||
public string? Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace PSProxmoxVE.Cmdlets.Storage
|
||||
/// <summary>The storage type (e.g., "dir", "nfs", "lvm", "zfspool", "cephfs", "rbd").</summary>
|
||||
[Parameter(Mandatory = true, Position = 1, HelpMessage = "The storage type (e.g. dir, nfs, lvm, zfspool).")]
|
||||
[ValidateSet("dir", "nfs", "lvm", "lvmthin", "zfspool", "zfs", "cephfs", "rbd",
|
||||
"iscsi", "iscsidirect", "glusterfs", "cifs", "pbs", IgnoreCase = true)]
|
||||
"iscsi", "iscsidirect", "cifs", "pbs", "btrfs", "esxi", IgnoreCase = true)]
|
||||
public string Type { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>Comma-separated list of content types to support (e.g., "iso,vztmpl,backup").</summary>
|
||||
|
||||
Reference in New Issue
Block a user