schemars/json_schema_impls/
serdejson.rs
1use crate::gen::SchemaGenerator;
2use crate::schema::*;
3use crate::JsonSchema;
4use serde_json::{Map, Number, Value};
5use std::collections::BTreeMap;
6
7impl JsonSchema for Value {
8 no_ref_schema!();
9
10 fn schema_name() -> String {
11 "AnyValue".to_owned()
12 }
13
14 fn json_schema(_: &mut SchemaGenerator) -> Schema {
15 Schema::Bool(true)
16 }
17}
18
19forward_impl!(Map<String, Value> => BTreeMap<String, Value>);
20
21impl JsonSchema for Number {
22 no_ref_schema!();
23
24 fn schema_name() -> String {
25 "Number".to_owned()
26 }
27
28 fn json_schema(_: &mut SchemaGenerator) -> Schema {
29 SchemaObject {
30 instance_type: Some(InstanceType::Number.into()),
31 ..Default::default()
32 }
33 .into()
34 }
35}