diff --git a/schemars/src/json_schema_impls/core.rs b/schemars/src/json_schema_impls/core.rs index 1deaec8..4f456a2 100644 --- a/schemars/src/json_schema_impls/core.rs +++ b/schemars/src/json_schema_impls/core.rs @@ -48,6 +48,18 @@ impl JsonSchema for std::marker::PhantomData { } } +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)] mod tests { use super::*; diff --git a/schemars/src/json_schema_impls/deref.rs b/schemars/src/json_schema_impls/deref.rs index fea8799..369b883 100644 --- a/schemars/src/json_schema_impls/deref.rs +++ b/schemars/src/json_schema_impls/deref.rs @@ -27,4 +27,8 @@ deref_impl!(<'a, T> JsonSchema for &'a mut T); deref_impl!( JsonSchema for Box); deref_impl!( JsonSchema for std::rc::Rc); deref_impl!( JsonSchema for std::sync::Arc); +deref_impl!( JsonSchema for std::sync::Mutex); +deref_impl!( JsonSchema for std::sync::RwLock); +deref_impl!( JsonSchema for std::cell::Cell); +deref_impl!( JsonSchema for std::cell::RefCell); deref_impl!(<'a, T: ToOwned> JsonSchema for std::borrow::Cow<'a, T>); diff --git a/schemars/src/json_schema_impls/mod.rs b/schemars/src/json_schema_impls/mod.rs index 0f178d9..286a9ed 100644 --- a/schemars/src/json_schema_impls/mod.rs +++ b/schemars/src/json_schema_impls/mod.rs @@ -17,11 +17,10 @@ mod sequences; mod serdejson; mod tuple; -// TODO chrono types under feature flag // TODO serde yaml value/map under feature flag // https://github.com/serde-rs/serde/blob/ce75418e40a593fc5c0902cbf4a45305a4178dd7/serde/src/ser/impls.rs -// Cell, RefCell, Mutex, RwLock, Result?, Duration, SystemTime, +// Result?, Duration, SystemTime, // IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV6, SocketAddrV6, -// Path, PathBuf, OsStr, OsString, Wrapping, Reverse, AtomicBool, AtomixI8 etc., +// Path, PathBuf, OsStr, OsString, Wrapping, Reverse, AtomicBool, AtomicI8 etc., // NonZeroU8 etc., ArcWeak, RcWeak, (!)?, Bound?, Range?, RangeInclusive?, // CString?, CStr?, fmt::Arguments?