paperclip
paperclip copied to clipboard
Apiv2Schema does not work for arrays
Hello,
When I define a struct
containing an array:
#[derive(Serialize, Deserialize, Debug, Apiv2Schema)]
pub struct MyStruct {
pub data: [u8; 4],
}
I've got this compil error:
error[E0425]: cannot find function `raw_schema` in the crate root
1464 | #[derive(Serialize, Deserialize, Apiv2Schema)]
| ^^^^^^^^^^^ not found in the crate root
If I put the array in an Option
or Vec
it works.
So what is the problem ?
Regards,
It seems that all is defined in https://github.com/wafflespeanut/paperclip/blob/master/core/src/v2/schema.rs (fnom line 408) so it should be ok …
Le mar. 8 déc. 2020 à 09:51, Mike Bush [email protected] a écrit :
I think the problem is that Apiv2Schema is not implemented for [u8; 4], that's possible but it's just awkward until rust has const generics https://github.com/rust-lang/rust/issues/44580 at which time we can impl<T, N> Apiv2Schema for [T; N]. Until we can use const generics the implementation needs to be defined for every length of array that you need to use.
That being said, I can't find where impl<T> Apiv2Schema for Vec<T> is defined.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/wafflespeanut/paperclip/issues/274#issuecomment-740478685, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARXUXWUUBBMGACAEW5IJUT3STXSH7ANCNFSM4UQRH3IA .
@BoOTheFurious Yeah - I found it right after i sent that message, realised I had no understanding of what was going on and tried to sneakily delete it :D