Debian Codegraph @

src/json_schema_impls/serdejson.rs

raw symbols SCIP
1 use crate::SchemaGenerator;
2 use crate::_alloc_prelude::*;
3 use crate::{json_schema, JsonSchema, Schema};
4 use alloc::borrow::Cow;
5 use alloc::collections::BTreeMap;
6 use serde_json::{Map, Number, Value};
7
8 impl 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
20 forward_impl!(Map<String, Value> => BTreeMap<String, Value>);
21
22 impl 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")]
37 forward_impl!(serde_json::value::RawValue => Value);