uom icon indicating copy to clipboard operation
uom copied to clipboard

Feat implemented support for schemars via a feature flag

Open akowi-sknobloch opened this issue 1 year ago • 2 comments

I've implemented the JsonSchema trait from the schemars crate. I'm using serde + schemars in my project to generate a json schema so the users can easily create configs. As i've switched a lot of my structs to use uom deriving the JsonSchema trait no longer worked.

I think supporting schemars would make a lot of sense for uom. As uom already supports serde this addition would make building api's easier as you could simply generate your schema by deriving the trait.

My implementation of the Trait is pretty simple and covers the minimum. I don't really like the schema name to be hard coded but i didn't know how i could set it automatically to eg. Length, Mass, etc.

Would be nice to get this feature merged :) Happy for feedback and comments

akowi-sknobloch avatar Sep 30 '24 13:09 akowi-sknobloch

Thanks for the PR. I'll need to do some reading up on schemars. In the meantime I kicked off the automated tests to see if any immediate issues come up.

iliekturtles avatar Oct 22 '24 00:10 iliekturtles

is this still on the table to be merged? The automated tests succeeded. This would be very useful for my project

jochemhoorneman avatar May 26 '25 08:05 jochemhoorneman