A lot of the logic around verifying ID constraints like their length, or that they follow a specific pattern, hides in registered format functions, which makes them invisible in the API docs.
This series addresses this, as well as the not-ideal UX reported in #7077, by moving some of these checks to the registered JSON schemas and adding explicit length checks where no schema is defined. As discussed in v1 [0], this renders some of the registered format functions obsolete. I did remove formats that I was able to verify are not depended on anywhere, however in order to keep the scope of this patch series in check, I did not refactor any of the ones that do have dependants (i.e., the format is referred to anywhere else than in the call to `register_standard_option`). I would be very thankful for a review by someone with more experience with those registered formats, as I may have missed dependencies my poor grepping skills could not catch. Changes since v1: - Update JSON schema verification to check length constraints before custom format verification code and/or regex - Register length/regex constraints for IDs directly in the `register_standard_option` calls, if applicable [0] https://lore.proxmox.com/pve-devel/mp3ggxjqimualakem43bge5szrphz2dyat2wynowsujwl7wcbu@6pf4sbwxam6u/T/#u pve-common: Arthur Bied-Charreton (1): fix #7077: Change JSON Schema attribute validation order src/PVE/JSONSchema.pm | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) pve-network: Arthur Bied-Charreton (2): fix #7077: Enforce ID format in JSON schema definitions sdn: Remove unneeded registered formats src/PVE/Network/SDN/Controllers/IsisPlugin.pm | 3 +++ src/PVE/Network/SDN/Controllers/Plugin.pm | 17 +++-------------- src/PVE/Network/SDN/Dns/Plugin.pm | 15 ++------------- src/PVE/Network/SDN/Fabrics.pm | 3 +++ src/PVE/Network/SDN/Ipams/Plugin.pm | 15 ++------------- src/PVE/Network/SDN/VnetPlugin.pm | 17 +++-------------- src/PVE/Network/SDN/Zones/Plugin.pm | 17 +++-------------- 7 files changed, 19 insertions(+), 68 deletions(-) pve-storage: Arthur Bied-Charreton (1): fix #7077: lvm: Improve ID verification error messages src/PVE/Storage/Plugin.pm | 5 +++++ 1 file changed, 5 insertions(+) proxmox: Arthur Bied-Charreton (1): fix #7077: Improve SDN ID validation error messages pve-api-types/src/types/verifiers.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) Summary over all repositories: 10 files changed, 47 insertions(+), 83 deletions(-) -- Generated by murpp 0.9.0
