You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So I guess this issue is mostly about making this more ergonomic:
make ComposeSchema public
make it possible to define that Vec1To4 should be inlined from within its ComposeSchema implementation
Yeah, current generics support has some walls and most likely the correct way forward would be making the ComposeSchema public type and it probably should be default for all in order to make the generic schema composition little less achy. For now there are some issues with the current implementation which tries to use different implementation depending whether type is a plain primitive type or a composable type and distincting this from a generic argument is not actually that easy.
This is something that probably should be addressed in future.
First, thanks for this lib. Version 5 is really great!
I am having a small issue. I have a struct with a field which is a Vec but which should have between 1 and 4 elements.
Here is how I modeled it so that the between 1 and 4 elements constraint is enforced by serde:
This generate the following schema:
While it works, it is pretty ugly and hacky:
utoipa::__dev::ComposeSchema
traitHere is what I would have liked:
Which is what is generated if I declare the following at the cost of no items length checking by serde:
And experimenting a bit more while writing this issue, I actually found a way to get what I want:
So I guess this issue is mostly about making this more ergonomic:
ComposeSchema
implementationIt seems #1184 might help for 2.
The text was updated successfully, but these errors were encountered: