Skip to content

Add schemars feature#107

Open
widberg wants to merge 3 commits into
hecatia-elegua:mainfrom
widberg:schemars
Open

Add schemars feature#107
widberg wants to merge 3 commits into
hecatia-elegua:mainfrom
widberg:schemars

Conversation

@widberg
Copy link
Copy Markdown
Collaborator

@widberg widberg commented Feb 20, 2026

Add a schemars feature to complement serde. Uses arbitrary-int's schemars support. Unfortunately, arbitrary-int uses schemars 0.8.21 and isn't complete; this bilge impl should only need minor changes if that ever gets updated. I've already started using this branch locally, and it seems fine.

Also fixed some warnings and updated the UI tests so CI would pass.

@hecatia-elegua
Copy link
Copy Markdown
Owner

I'm open to adding this, two short questions:
How is this used? I have only heard of schema.rs a little bit and have been working on completely different stuff. I know it creates a json schema, but where's that useful? sounds fun.

Would anyone maybe want to keep the reserved/padding fields in there?

@widberg
Copy link
Copy Markdown
Collaborator Author

widberg commented Mar 23, 2026

I've been using this branch in bff successfully for a month. I use the schema_for! macro to get the schema for a struct with deeply nested bilge structs. The schema describes the serde format of the struct, and I can generate Pydantic models in Python to read the output there. Since the bilge serde code does not output reserved/padding, it would be incorrect to include them in the schema without changing that in the bilge serde code first. Before adding schemars support to bilge, the underlying type would be what appeared in the schema, and that mismatch with the serde output was causing a lot of problems. Happy to answer any more questions and get tagged in issues/PRs related to serde/schemars going forward.

@widberg
Copy link
Copy Markdown
Collaborator Author

widberg commented May 21, 2026

If you don't have any more comments, is it all right if I merge this? I see you approved it, and I have permission to merge, but I wanted to check before doing it. I still haven't had any issues, and I've since done a release of my project with this version of bilge.

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.

2 participants