Skip to content

Commit

Permalink
impl JsonSchema for Schema
Browse files Browse the repository at this point in the history
  • Loading branch information
GREsau committed May 23, 2024
1 parent 1819dce commit fe05631
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions schemars/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit fe05631

Please sign in to comment.