diff --git a/schemars/src/json_schema_impls/os.rs b/schemars/src/json_schema_impls/ffi.rs similarity index 71% rename from schemars/src/json_schema_impls/os.rs rename to schemars/src/json_schema_impls/ffi.rs index ec4dcbf..027ded2 100644 --- a/schemars/src/json_schema_impls/os.rs +++ b/schemars/src/json_schema_impls/ffi.rs @@ -1,7 +1,7 @@ use crate::gen::SchemaGenerator; use crate::schema::*; use crate::JsonSchema; -use std::ffi::{OsStr, OsString}; +use std::ffi::{CStr, CString, OsStr, OsString}; impl JsonSchema for OsString { fn schema_name() -> String { @@ -40,3 +40,27 @@ impl JsonSchema for OsStr { ::json_schema(gen) } } + +impl JsonSchema for CString { + no_ref_schema!(); + + fn schema_name() -> String { + >::schema_name() + } + + fn json_schema(gen: &mut SchemaGenerator) -> Schema { + >::json_schema(gen) + } +} + +impl JsonSchema for CStr { + no_ref_schema!(); + + fn schema_name() -> String { + >::schema_name() + } + + fn json_schema(gen: &mut SchemaGenerator) -> Schema { + >::json_schema(gen) + } +} diff --git a/schemars/src/json_schema_impls/mod.rs b/schemars/src/json_schema_impls/mod.rs index 42f6426..432cbb8 100644 --- a/schemars/src/json_schema_impls/mod.rs +++ b/schemars/src/json_schema_impls/mod.rs @@ -10,8 +10,8 @@ mod array; #[cfg(feature = "chrono")] mod chrono; mod core; +mod ffi; mod maps; -mod os; mod primitives; mod sequences; mod serdejson; diff --git a/schemars/tests/os.rs b/schemars/tests/ffi.rs similarity index 100% rename from schemars/tests/os.rs rename to schemars/tests/ffi.rs