Implement JsonSchema for more deref types
This commit is contained in:
parent
6cf9343657
commit
e9e0526adc
3 changed files with 18 additions and 3 deletions
|
@ -48,6 +48,18 @@ impl<T: ?Sized> JsonSchema for std::marker::PhantomData<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl JsonSchema for std::convert::Infallible {
|
||||||
|
no_ref_schema!();
|
||||||
|
|
||||||
|
fn schema_name() -> String {
|
||||||
|
"Never".to_owned()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn json_schema(gen: &mut SchemaGenerator) -> Result {
|
||||||
|
Ok(gen.schema_for_none())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
|
@ -27,4 +27,8 @@ deref_impl!(<'a, T> JsonSchema for &'a mut T);
|
||||||
deref_impl!(<T> JsonSchema for Box<T>);
|
deref_impl!(<T> JsonSchema for Box<T>);
|
||||||
deref_impl!(<T> JsonSchema for std::rc::Rc<T>);
|
deref_impl!(<T> JsonSchema for std::rc::Rc<T>);
|
||||||
deref_impl!(<T> JsonSchema for std::sync::Arc<T>);
|
deref_impl!(<T> JsonSchema for std::sync::Arc<T>);
|
||||||
|
deref_impl!(<T> JsonSchema for std::sync::Mutex<T>);
|
||||||
|
deref_impl!(<T> JsonSchema for std::sync::RwLock<T>);
|
||||||
|
deref_impl!(<T> JsonSchema for std::cell::Cell<T>);
|
||||||
|
deref_impl!(<T> JsonSchema for std::cell::RefCell<T>);
|
||||||
deref_impl!(<'a, T: ToOwned> JsonSchema for std::borrow::Cow<'a, T>);
|
deref_impl!(<'a, T: ToOwned> JsonSchema for std::borrow::Cow<'a, T>);
|
||||||
|
|
|
@ -17,11 +17,10 @@ mod sequences;
|
||||||
mod serdejson;
|
mod serdejson;
|
||||||
mod tuple;
|
mod tuple;
|
||||||
|
|
||||||
// TODO chrono types under feature flag
|
|
||||||
// TODO serde yaml value/map under feature flag
|
// TODO serde yaml value/map under feature flag
|
||||||
// https://github.com/serde-rs/serde/blob/ce75418e40a593fc5c0902cbf4a45305a4178dd7/serde/src/ser/impls.rs
|
// https://github.com/serde-rs/serde/blob/ce75418e40a593fc5c0902cbf4a45305a4178dd7/serde/src/ser/impls.rs
|
||||||
// Cell<T>, RefCell<T>, Mutex<T>, RwLock<T>, Result<R,E>?, Duration, SystemTime,
|
// Result<R,E>?, Duration, SystemTime,
|
||||||
// IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV6, SocketAddrV6,
|
// IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV6, SocketAddrV6,
|
||||||
// Path, PathBuf, OsStr, OsString, Wrapping<T>, Reverse<T>, AtomicBool, AtomixI8 etc.,
|
// Path, PathBuf, OsStr, OsString, Wrapping<T>, Reverse<T>, AtomicBool, AtomicI8 etc.,
|
||||||
// NonZeroU8 etc., ArcWeak, RcWeak, (!)?, Bound?, Range?, RangeInclusive?,
|
// NonZeroU8 etc., ArcWeak, RcWeak, (!)?, Bound?, Range?, RangeInclusive?,
|
||||||
// CString?, CStr?, fmt::Arguments?
|
// CString?, CStr?, fmt::Arguments?
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue