[pbs-devel] [RFC PATCH] schema: allow serializing rust Schema to perl JsonSchema

Gabriel Goller g.goller at proxmox.com
Thu May 8 11:52:27 CEST 2025


On 08.05.2025 10:24, Wolfgang Bumiller wrote:
>On Wed, May 07, 2025 at 06:31:14PM +0200, Gabriel Goller wrote:
>> Implement serde::Serialize on the rust Schema, so that we can serialize
>> it and use it as a JsonSchema in perl. This allows us to write a single
>> Schema in rust and reuse it in perl for the api properties.
>>
>> The interesting bits (custom impls) are:
>>  * Recursive oneOf type-property resolver
>>  * oneOf and allOf implementation
>>  * ApiStringFormat skip of ApiStringVerifyFn (which won't work obviously)
>
>I'd like the commit to explain where we actually want to use/need this.
>Long ago (before we had the `OneOf` schema I already started this, but
>figured we didn't really need it anyway at the time.

We would primarily use this for the fabrics feature where SectionConfig
types are defined in rust using the api macro. In pve-network, we
retrieve these rust structs and expose them through the api. The current
issue is that we have to manually write the schema twice – once in rust
and again in the perl api properties. We could eliminate this
duplication by getting the api schema generated in rust and use it in
the perl api properties.

Thanks for the thorough review!
I'll go through all the other stuff now!




More information about the pbs-devel mailing list