schemars/json_schema_impls/
serdejson.rs

1use crate::SchemaGenerator;
2use crate::_alloc_prelude::*;
3use crate::{json_schema, JsonSchema, Schema};
4use alloc::borrow::Cow;
5use alloc::collections::BTreeMap;
6use serde_json::{Map, Number, Value};
7
8impl JsonSchema for Value {
9    inline_schema!();
10
11    fn schema_name() -> Cow<'static, str> {
12        "AnyValue".into()
13    }
14
15    fn json_schema(_: &mut SchemaGenerator) -> Schema {
16        true.into()
17    }
18}
19
20forward_impl!(Map<String, Value> => BTreeMap<String, Value>);
21
22impl JsonSchema for Number {
23    inline_schema!();
24
25    fn schema_name() -> Cow<'static, str> {
26        "Number".into()
27    }
28
29    fn json_schema(_: &mut SchemaGenerator) -> Schema {
30        json_schema!({
31            "type": "number"
32        })
33    }
34}
35
36#[cfg(feature = "raw_value")]
37forward_impl!(serde_json::value::RawValue => Value);