Closed
Description
Using #[derive(ToSchema)]
on types like geo_types::Coord
fails because it uses generics
e.g. jayvdb/geo@9b2c876
pub struct Coord<T: CoordNum = f64> {
pub x: T,
pub y: T,
}
becomes
"Coord": {
"type": "object",
"required": [
"x",
"y"
],
"properties": {
"x": {
"$ref": "#/components/schemas/T"
},
"y": {
"$ref": "#/components/schemas/T"
}
}
},
The basic fix for this would be to recognise the T: CoordNum = f64
, and use f64
for each T
, and also fail if the struct was designed using T: CoordNum
without any default type for T
, as in that case utoipa has a lot more work to do in order to know what CoordNum
might be.