summaryrefslogtreecommitdiff
path: root/vendor/schemars/src/json_schema_impls/mod.rs
blob: a5e076c7c9a74d55b48dd09ff570fe1ee39f8fa4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
macro_rules! inline_schema {
    () => {
        fn inline_schema() -> bool {
            true
        }
    };
}

macro_rules! forward_impl {
    (($($impl:tt)+) => $target:ty) => {
        impl $($impl)+ {
            fn inline_schema() -> bool {
                <$target>::inline_schema()
            }

            fn schema_name() -> alloc::borrow::Cow<'static, str> {
                <$target>::schema_name()
            }

            fn schema_id() -> alloc::borrow::Cow<'static, str> {
                <$target>::schema_id()
            }

            fn json_schema(generator: &mut $crate::SchemaGenerator) -> $crate::Schema {
                <$target>::json_schema(generator)
            }

            fn _schemars_private_non_optional_json_schema(generator: &mut $crate::SchemaGenerator) -> $crate::Schema {
                <$target>::_schemars_private_non_optional_json_schema(generator)
            }

            fn _schemars_private_is_option() -> bool {
                <$target>::_schemars_private_is_option()
            }
        }
    };
    ($ty:ty => $target:ty) => {
        forward_impl!(($crate::JsonSchema for $ty) => $target);
    };
}

mod array;
mod core;
mod maps;
mod nonzero;
mod primitives;
mod sequences;
mod serdejson;
mod std_time;
mod tuple;
mod wrapper;

#[cfg(target_has_atomic)]
mod atomic;

#[cfg(feature = "std")]
mod ffi;

#[cfg(feature = "arrayvec07")]
mod arrayvec07;

#[cfg(feature = "bytes1")]
mod bytes1;

#[cfg(feature = "chrono04")]
mod chrono04;

#[cfg(any(feature = "rust_decimal1", feature = "bigdecimal04"))]
mod decimal;

#[cfg(feature = "either1")]
mod either1;

#[cfg(feature = "indexmap2")]
mod indexmap2;

#[cfg(feature = "jiff02")]
mod jiff02;

#[cfg(feature = "semver1")]
mod semver1;

#[cfg(feature = "smallvec1")]
forward_impl!((<A: smallvec1::Array> crate::JsonSchema for smallvec1::SmallVec<A> where A::Item: crate::JsonSchema) => alloc::vec::Vec<A::Item>);

#[cfg(feature = "smol_str02")]
forward_impl!(smol_str02::SmolStr => alloc::string::String);

#[cfg(feature = "url2")]
mod url2;

#[cfg(feature = "uuid1")]
mod uuid1;