Skip to content

Conversation

@akowi-sknobloch
Copy link

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

@iliekturtles
Copy link
Owner

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.

@jochemhoorneman
Copy link

jochemhoorneman commented May 26, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants