impl JsonSchema for Schema
This commit is contained in:
parent
1819dceb24
commit
fe05631f21
1 changed files with 17 additions and 2 deletions
|
@ -2,8 +2,7 @@
|
|||
JSON Schema types.
|
||||
*/
|
||||
|
||||
use ref_cast::ref_cast_custom;
|
||||
use ref_cast::RefCastCustom;
|
||||
use ref_cast::{ref_cast_custom, RefCastCustom};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::{Map, Value};
|
||||
|
||||
|
@ -175,6 +174,22 @@ impl From<bool> for Schema {
|
|||
}
|
||||
}
|
||||
|
||||
impl crate::JsonSchema for Schema {
|
||||
fn schema_name() -> String {
|
||||
"Schema".to_owned()
|
||||
}
|
||||
|
||||
fn schema_id() -> std::borrow::Cow<'static, str> {
|
||||
"schemars::Schema".into()
|
||||
}
|
||||
|
||||
fn json_schema(_: &mut crate::gen::SchemaGenerator) -> Schema {
|
||||
crate::json_schema!({
|
||||
"type": ["object", "boolean"]
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
mod ser {
|
||||
use serde::ser::{Serialize, SerializeMap, SerializeSeq};
|
||||
use serde_json::Value;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue