arcstr
arcstr copied to clipboard
Support schemars
Crate: https://docs.rs/schemars/0.8.22/schemars/.
Support can be enabled via a feature. What it takes a simple derive. Maybe I can do that later.
As a temporary fix, I did
// We can't derive `JsonSchema` because `ArcStr` doesn't implement it
// and we can't implement it for `ArcStr` because
// both `JsonSchema` trait and `ArcStr` type are external to this crate.
impl JsonSchema for IString {
fn schema_name() -> String {
"IString".to_string()
}
fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
<String as JsonSchema>::json_schema(gen)
}
}
I understand there is no schemars support in arcstr.
Wouldn't it also be nice to have arcstr support in schemars in addition to smol_str? 😄