Skip to main content

serde_with/
schemars_0_8.rs

1//! Integration with [schemars v0.8](schemars_0_8).
2//!
3//! This module is only available if using the `schemars_0_8` feature of the crate.
4//!
5//! If you would like to add support for schemars to your own `serde_with` helpers
6//! see [`JsonSchemaAs`].
7
8use crate::{
9    formats::{Flexible, Format, PreferMany, PreferOne, Separator, Strict},
10    prelude::{Schema as WrapSchema, *},
11};
12use ::schemars_0_8::{
13    gen::SchemaGenerator,
14    schema::{
15        ArrayValidation, InstanceType, Metadata, NumberValidation, ObjectValidation, Schema,
16        SchemaObject, SingleOrVec, SubschemaValidation,
17    },
18    JsonSchema,
19};
20
21//===================================================================
22// Trait Definition
23
24/// A type which can be described as a JSON schema document.
25///
26/// This trait is as [`SerializeAs`] is to [`Serialize`] but for [`JsonSchema`].
27/// You can use it to make your custom [`SerializeAs`] and [`DeserializeAs`]
28/// types also support being described via JSON schemas.
29///
30/// It is used by the [`Schema`][1] type in order to implement [`JsonSchema`]
31/// for the relevant types. [`Schema`][1] is used implicitly by the [`serde_as`]
32/// macro to instruct `schemars` on how to generate JSON schemas for fields
33/// annotated with `#[serde_as(as = "...")]` attributes.
34///
35/// # Examples
36/// Suppose we have our very own `PositiveInt` type. Then we could add support
37/// for generating a schema from it like this
38///
39/// ```
40/// # extern crate schemars_0_8 as schemars;
41/// # use serde::{Serialize, Serializer, Deserialize, Deserializer};
42/// # use serde_with::{SerializeAs, DeserializeAs};
43/// use serde_with::schemars_0_8::JsonSchemaAs;
44/// use schemars::gen::SchemaGenerator;
45/// use schemars::schema::Schema;
46/// use schemars::JsonSchema;
47///
48/// # #[allow(dead_code)]
49/// struct PositiveInt;
50///
51/// impl SerializeAs<i32> for PositiveInt {
52///     // ...
53///     # fn serialize_as<S>(&value: &i32, ser: S) -> Result<S::Ok, S::Error>
54///     # where
55///     #    S: Serializer
56///     # {
57///     #    if value < 0 {
58///     #        return Err(serde::ser::Error::custom(
59///     #            "expected a positive integer value, got a negative one"
60///     #        ));
61///     #    }
62///     #
63///     #    value.serialize(ser)
64///     # }
65/// }
66///
67/// impl<'de> DeserializeAs<'de, i32> for PositiveInt {
68///     // ...
69///     # fn deserialize_as<D>(de: D) -> Result<i32, D::Error>
70///     # where
71///     #     D: Deserializer<'de>,
72///     # {
73///     #     match i32::deserialize(de) {
74///     #         Ok(value) if value < 0 => Err(serde::de::Error::custom(
75///     #             "expected a positive integer value, got a negative one"
76///     #         )),
77///     #         value => value
78///     #     }
79///     # }
80/// }
81///
82/// impl JsonSchemaAs<i32> for PositiveInt {
83///     fn schema_name() -> String {
84///         "PositiveInt".into()
85///     }
86///
87///     fn json_schema(gen: &mut SchemaGenerator) -> Schema {
88///         let mut schema = <i32 as JsonSchema>::json_schema(gen).into_object();
89///         schema.number().minimum = Some(0.0);
90///         schema.into()
91///     }
92/// }
93/// ```
94///
95/// [0]: crate::serde_as
96/// [1]: crate::Schema
97pub trait JsonSchemaAs<T: ?Sized> {
98    /// Whether JSON Schemas generated for this type should be re-used where possible using the `$ref` keyword.
99    ///
100    /// For trivial types (such as primitives), this should return `false`. For more complex types, it should return `true`.
101    /// For recursive types, this **must** return `true` to prevent infinite cycles when generating schemas.
102    ///
103    /// By default, this returns `true`.
104    fn is_referenceable() -> bool {
105        true
106    }
107
108    /// The name of the generated JSON Schema.
109    ///
110    /// This is used as the title for root schemas, and the key within the root's `definitions` property for sub-schemas.
111    ///
112    /// As the schema name is used as as part of `$ref` it has to be a valid URI path segment according to
113    /// [RFC 3986 Section-3](https://datatracker.ietf.org/doc/html/rfc3986#section-3).
114    fn schema_name() -> String;
115
116    /// Returns a string that uniquely identifies the schema produced by this type.
117    ///
118    /// This does not have to be a human-readable string, and the value will not itself be included in generated schemas.
119    /// If two types produce different schemas, then they **must** have different `schema_id()`s,
120    /// but two types that produce identical schemas should *ideally* have the same `schema_id()`.
121    ///
122    /// The default implementation returns the same value as `schema_name()`.
123    fn schema_id() -> Cow<'static, str> {
124        Cow::Owned(Self::schema_name())
125    }
126
127    /// Generates a JSON Schema for this type.
128    ///
129    /// If the returned schema depends on any [referenceable](JsonSchema::is_referenceable) schemas, then this method will
130    /// add them to the [`SchemaGenerator`]'s schema definitions.
131    ///
132    /// This should not return a `$ref` schema.
133    fn json_schema(gen: &mut SchemaGenerator) -> Schema;
134}
135
136impl<T, TA> JsonSchema for WrapSchema<T, TA>
137where
138    T: ?Sized,
139    TA: JsonSchemaAs<T>,
140{
141    fn schema_name() -> String {
142        TA::schema_name()
143    }
144
145    fn schema_id() -> Cow<'static, str> {
146        TA::schema_id()
147    }
148
149    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
150        TA::json_schema(gen)
151    }
152
153    fn is_referenceable() -> bool {
154        TA::is_referenceable()
155    }
156}
157
158//===================================================================
159// Macro helpers
160
161macro_rules! forward_schema {
162    ($fwd:ty) => {
163        fn schema_name() -> String {
164            <$fwd as JsonSchema>::schema_name()
165        }
166
167        fn schema_id() -> Cow<'static, str> {
168            <$fwd as JsonSchema>::schema_id()
169        }
170
171        fn json_schema(gen: &mut SchemaGenerator) -> Schema {
172            <$fwd as JsonSchema>::json_schema(gen)
173        }
174
175        fn is_referenceable() -> bool {
176            <$fwd as JsonSchema>::is_referenceable()
177        }
178    };
179}
180
181//===================================================================
182// Common definitions for various std types
183
184impl<'a, T: 'a, TA: 'a> JsonSchemaAs<&'a T> for &'a TA
185where
186    T: ?Sized,
187    TA: JsonSchemaAs<T>,
188{
189    String
<&'a WrapSchema<T, TA> as JsonSchema>::schema_name();
Cow<'static, str>
<&'a WrapSchema<T, TA> as JsonSchema>::schema_id();
&mut SchemaGenerator
gen
Schema
<&'a WrapSchema<T, TA> as JsonSchema>::json_schema(gen);
bool
<&'a WrapSchema<T, TA> as JsonSchema>::is_referenceable();forward_schema!(&'a WrapSchema<T, TA>);
190}
191
192impl<'a, T: 'a, TA: 'a> JsonSchemaAs<&'a mut T> for &'a mut TA
193where
194    T: ?Sized,
195    TA: JsonSchemaAs<T>,
196{
197    String
<&'a mut WrapSchema<T, TA> as JsonSchema>::schema_name();
Cow<'static, str>
<&'a mut WrapSchema<T, TA> as JsonSchema>::schema_id();
&mut SchemaGenerator
gen
Schema
<&'a mut WrapSchema<T, TA> as JsonSchema>::json_schema(gen);
bool
<&'a mut WrapSchema<T, TA> as JsonSchema>::is_referenceable();forward_schema!(&'a mut WrapSchema<T, TA>);
198}
199
200impl<T, TA> JsonSchemaAs<Option<T>> for Option<TA>
201where
202    TA: JsonSchemaAs<T>,
203{
204    String
<Option<WrapSchema<T, TA>> as JsonSchema>::schema_name();
Cow<'static, str>
<Option<WrapSchema<T, TA>> as JsonSchema>::schema_id();
&mut SchemaGenerator
gen
Schema
<Option<WrapSchema<T, TA>> as JsonSchema>::json_schema(gen);
bool
<Option<WrapSchema<T, TA>> as JsonSchema>::is_referenceable();forward_schema!(Option<WrapSchema<T, TA>>);
205}
206
207impl<T, TA> JsonSchemaAs<Box<T>> for Box<TA>
208where
209    T: ?Sized,
210    TA: JsonSchemaAs<T>,
211{
212    String
<Box<WrapSchema<T, TA>> as JsonSchema>::schema_name();
Cow<'static, str>
<Box<WrapSchema<T, TA>> as JsonSchema>::schema_id();
&mut SchemaGenerator
gen
Schema
<Box<WrapSchema<T, TA>> as JsonSchema>::json_schema(gen);
bool
<Box<WrapSchema<T, TA>> as JsonSchema>::is_referenceable();forward_schema!(Box<WrapSchema<T, TA>>);
213}
214
215impl<T, TA> JsonSchemaAs<Rc<T>> for Rc<TA>
216where
217    T: ?Sized,
218    TA: JsonSchemaAs<T>,
219{
220    String
<Rc<WrapSchema<T, TA>> as JsonSchema>::schema_name();
Cow<'static, str>
<Rc<WrapSchema<T, TA>> as JsonSchema>::schema_id();
&mut SchemaGenerator
gen
Schema
<Rc<WrapSchema<T, TA>> as JsonSchema>::json_schema(gen);
bool
<Rc<WrapSchema<T, TA>> as JsonSchema>::is_referenceable();forward_schema!(Rc<WrapSchema<T, TA>>);
221}
222
223impl<T, TA> JsonSchemaAs<Arc<T>> for Arc<TA>
224where
225    T: ?Sized,
226    TA: JsonSchemaAs<T>,
227{
228    String
<Arc<WrapSchema<T, TA>> as JsonSchema>::schema_name();
Cow<'static, str>
<Arc<WrapSchema<T, TA>> as JsonSchema>::schema_id();
&mut SchemaGenerator
gen
Schema
<Arc<WrapSchema<T, TA>> as JsonSchema>::json_schema(gen);
bool
<Arc<WrapSchema<T, TA>> as JsonSchema>::is_referenceable();forward_schema!(Arc<WrapSchema<T, TA>>);
229}
230
231impl<T, TA> JsonSchemaAs<Vec<T>> for Vec<TA>
232where
233    TA: JsonSchemaAs<T>,
234{
235    String
<Vec<WrapSchema<T, TA>> as JsonSchema>::schema_name();
Cow<'static, str>
<Vec<WrapSchema<T, TA>> as JsonSchema>::schema_id();
&mut SchemaGenerator
gen
Schema
<Vec<WrapSchema<T, TA>> as JsonSchema>::json_schema(gen);
bool
<Vec<WrapSchema<T, TA>> as JsonSchema>::is_referenceable();forward_schema!(Vec<WrapSchema<T, TA>>);
236}
237
238impl<T, TA> JsonSchemaAs<VecDeque<T>> for VecDeque<TA>
239where
240    TA: JsonSchemaAs<T>,
241{
242    String
<VecDeque<WrapSchema<T, TA>> as JsonSchema>::schema_name();
Cow<'static, str>
<VecDeque<WrapSchema<T, TA>> as JsonSchema>::schema_id();
&mut SchemaGenerator
gen
Schema
<VecDeque<WrapSchema<T, TA>> as JsonSchema>::json_schema(gen);
bool
<VecDeque<WrapSchema<T, TA>> as JsonSchema>::is_referenceable();forward_schema!(VecDeque<WrapSchema<T, TA>>);
243}
244
245// schemars only requires that V implement JsonSchema for BTreeMap<K, V>
246impl<K, V, KA, VA> JsonSchemaAs<BTreeMap<K, V>> for BTreeMap<KA, VA>
247where
248    VA: JsonSchemaAs<V>,
249{
250    String
<BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as JsonSchema>::schema_name();
Cow<'static, str>
<BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as JsonSchema>::schema_id();
&mut SchemaGenerator
gen
Schema
<BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
        JsonSchema>::json_schema(gen);
bool
<BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
        JsonSchema>::is_referenceable();forward_schema!(BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>>);
251}
252
253// schemars only requires that V implement JsonSchema for HashMap<K, V>
254impl<K, V, S, KA, VA> JsonSchemaAs<HashMap<K, V, S>> for HashMap<KA, VA, S>
255where
256    VA: JsonSchemaAs<V>,
257{
258    String
<HashMap<WrapSchema<K, KA>, WrapSchema<V, VA>, S> as
        JsonSchema>::schema_name();
Cow<'static, str>
<HashMap<WrapSchema<K, KA>, WrapSchema<V, VA>, S> as JsonSchema>::schema_id();
&mut SchemaGenerator
gen
Schema
<HashMap<WrapSchema<K, KA>, WrapSchema<V, VA>, S> as
        JsonSchema>::json_schema(gen);
bool
<HashMap<WrapSchema<K, KA>, WrapSchema<V, VA>, S> as
        JsonSchema>::is_referenceable();forward_schema!(HashMap<WrapSchema<K, KA>, WrapSchema<V, VA>, S>);
259}
260
261impl<T, TA> JsonSchemaAs<BTreeSet<T>> for BTreeSet<TA>
262where
263    TA: JsonSchemaAs<T>,
264{
265    String
<BTreeSet<WrapSchema<T, TA>> as JsonSchema>::schema_name();
Cow<'static, str>
<BTreeSet<WrapSchema<T, TA>> as JsonSchema>::schema_id();
&mut SchemaGenerator
gen
Schema
<BTreeSet<WrapSchema<T, TA>> as JsonSchema>::json_schema(gen);
bool
<BTreeSet<WrapSchema<T, TA>> as JsonSchema>::is_referenceable();forward_schema!(BTreeSet<WrapSchema<T, TA>>);
266}
267
268impl<T, TA, S> JsonSchemaAs<T> for HashSet<TA, S>
269where
270    TA: JsonSchemaAs<T>,
271{
272    String
<HashSet<WrapSchema<T, TA>, S> as JsonSchema>::schema_name();
Cow<'static, str>
<HashSet<WrapSchema<T, TA>, S> as JsonSchema>::schema_id();
&mut SchemaGenerator
gen
Schema
<HashSet<WrapSchema<T, TA>, S> as JsonSchema>::json_schema(gen);
bool
<HashSet<WrapSchema<T, TA>, S> as JsonSchema>::is_referenceable();forward_schema!(HashSet<WrapSchema<T, TA>, S>);
273}
274
275impl<T, TA> JsonSchemaAs<Bound<T>> for Bound<TA>
276where
277    TA: JsonSchemaAs<T>,
278{
279    String
<Bound<WrapSchema<T, TA>> as JsonSchema>::schema_name();
Cow<'static, str>
<Bound<WrapSchema<T, TA>> as JsonSchema>::schema_id();
&mut SchemaGenerator
gen
Schema
<Bound<WrapSchema<T, TA>> as JsonSchema>::json_schema(gen);
bool
<Bound<WrapSchema<T, TA>> as JsonSchema>::is_referenceable();forward_schema!(Bound<WrapSchema<T, TA>>);
280}
281
282impl<T, TA> JsonSchemaAs<Range<T>> for Range<TA>
283where
284    TA: JsonSchemaAs<T>,
285{
286    String
<Range<WrapSchema<T, TA>> as JsonSchema>::schema_name();
Cow<'static, str>
<Range<WrapSchema<T, TA>> as JsonSchema>::schema_id();
&mut SchemaGenerator
gen
Schema
<Range<WrapSchema<T, TA>> as JsonSchema>::json_schema(gen);
bool
<Range<WrapSchema<T, TA>> as JsonSchema>::is_referenceable();forward_schema!(Range<WrapSchema<T, TA>>);
287}
288
289// Note: Not included in `schemars`
290// impl<T, TA> JsonSchemaAs<RangeFrom<T>> for RangeFrom<TA>
291// where
292//     TA: JsonSchemaAs<T>,
293// {
294//     forward_schema!(RangeFrom<WrapSchema<T, TA>>);
295// }
296
297// impl<T, TA> JsonSchemaAs<RangeTo<T>> for RangeTo<TA>
298// where
299//     TA: JsonSchemaAs<T>,
300// {
301//     forward_schema!(RangeTo<WrapSchema<T, TA>>);
302// }
303
304impl<T, TA> JsonSchemaAs<RangeInclusive<T>> for RangeInclusive<TA>
305where
306    TA: JsonSchemaAs<T>,
307{
308    String
<RangeInclusive<WrapSchema<T, TA>> as JsonSchema>::schema_name();
Cow<'static, str>
<RangeInclusive<WrapSchema<T, TA>> as JsonSchema>::schema_id();
&mut SchemaGenerator
gen
Schema
<RangeInclusive<WrapSchema<T, TA>> as JsonSchema>::json_schema(gen);
bool
<RangeInclusive<WrapSchema<T, TA>> as JsonSchema>::is_referenceable();forward_schema!(RangeInclusive<WrapSchema<T, TA>>);
309}
310
311impl<T, TA, const N: usize> JsonSchemaAs<[T; N]> for [TA; N]
312where
313    TA: JsonSchemaAs<T>,
314{
315    fn schema_name() -> String {
316        ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("[{0}; {1}]",
                <WrapSchema<T, TA>>::schema_name(), N))
    })std::format!("[{}; {}]", <WrapSchema<T, TA>>::schema_name(), N)
317    }
318
319    fn schema_id() -> Cow<'static, str> {
320        ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("[{0}; {1}]",
                <WrapSchema<T, TA>>::schema_id(), N))
    })std::format!("[{}; {}]", <WrapSchema<T, TA>>::schema_id(), N).into()
321    }
322
323    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
324        let (max, min) = match N.try_into() {
325            Ok(len) => (Some(len), Some(len)),
326            Err(_) => (None, Some(u32::MAX)),
327        };
328
329        SchemaObject {
330            instance_type: Some(InstanceType::Array.into()),
331            array: Some(Box::new(ArrayValidation {
332                items: Some(gen.subschema_for::<WrapSchema<T, TA>>().into()),
333                max_items: max,
334                min_items: min,
335                ..Default::default()
336            })),
337            ..Default::default()
338        }
339        .into()
340    }
341
342    fn is_referenceable() -> bool {
343        false
344    }
345}
346
347macro_rules! schema_for_tuple {
348    (
349        ( $( $ts:ident )+ )
350        ( $( $as:ident )+ )
351    ) => {
352        impl<$($ts,)+ $($as,)+> JsonSchemaAs<($($ts,)+)> for ($($as,)+)
353        where
354            $( $as: JsonSchemaAs<$ts>, )+
355        {
356            forward_schema!(( $( WrapSchema<$ts, $as>, )+ ));
357        }
358    }
359}
360
361impl JsonSchemaAs<()> for () {
362    String
<() as JsonSchema>::schema_name();
Cow<'static, str>
<() as JsonSchema>::schema_id();
&mut SchemaGenerator
gen
Schema
<() as JsonSchema>::json_schema(gen);
bool
<() as JsonSchema>::is_referenceable();forward_schema!(());
363}
364
365// schemars only implements JsonSchema for tuples up to 15 elements so we do
366// the same here.
367impl<T0, A0> JsonSchemaAs<(T0,)> for (A0,) where A0: JsonSchemaAs<T0> {
    fn schema_name() -> String {
        <(WrapSchema<T0, A0>,) as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <(WrapSchema<T0, A0>,) as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <(WrapSchema<T0, A0>,) as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <(WrapSchema<T0, A0>,) as JsonSchema>::is_referenceable()
    }
}schema_for_tuple!((T0)(A0));
368impl<T0, T1, A0, A1> JsonSchemaAs<(T0, T1)> for (A0, A1) where
    A0: JsonSchemaAs<T0>, A1: JsonSchemaAs<T1> {
    fn schema_name() -> String {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>) as
                JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>) as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>) as
                JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>) as
                JsonSchema>::is_referenceable()
    }
}schema_for_tuple!((T0 T1) (A0 A1));
369impl<T0, T1, T2, A0, A1, A2> JsonSchemaAs<(T0, T1, T2)> for (A0, A1, A2) where
    A0: JsonSchemaAs<T0>, A1: JsonSchemaAs<T1>, A2: JsonSchemaAs<T2> {
    fn schema_name() -> String {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>) as
                JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>) as
                JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>) as
                JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>) as
                JsonSchema>::is_referenceable()
    }
}schema_for_tuple!((T0 T1 T2) (A0 A1 A2));
370impl<T0, T1, T2, T3, A0, A1, A2, A3> JsonSchemaAs<(T0, T1, T2, T3)> for
    (A0, A1, A2, A3) where A0: JsonSchemaAs<T0>, A1: JsonSchemaAs<T1>,
    A2: JsonSchemaAs<T2>, A3: JsonSchemaAs<T3> {
    fn schema_name() -> String {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>) as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>) as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>) as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>) as JsonSchema>::is_referenceable()
    }
}schema_for_tuple!((T0 T1 T2 T3) (A0 A1 A2 A3));
371impl<T0, T1, T2, T3, T4, A0, A1, A2, A3, A4>
    JsonSchemaAs<(T0, T1, T2, T3, T4)> for (A0, A1, A2, A3, A4) where
    A0: JsonSchemaAs<T0>, A1: JsonSchemaAs<T1>, A2: JsonSchemaAs<T2>,
    A3: JsonSchemaAs<T3>, A4: JsonSchemaAs<T4> {
    fn schema_name() -> String {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>) as
                JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>) as
                JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>) as
                JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>) as
                JsonSchema>::is_referenceable()
    }
}schema_for_tuple!((T0 T1 T2 T3 T4) (A0 A1 A2 A3 A4));
372impl<T0, T1, T2, T3, T4, T5, A0, A1, A2, A3, A4, A5>
    JsonSchemaAs<(T0, T1, T2, T3, T4, T5)> for (A0, A1, A2, A3, A4, A5) where
    A0: JsonSchemaAs<T0>, A1: JsonSchemaAs<T1>, A2: JsonSchemaAs<T2>,
    A3: JsonSchemaAs<T3>, A4: JsonSchemaAs<T4>, A5: JsonSchemaAs<T5> {
    fn schema_name() -> String {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>, WrapSchema<T5, A5>) as
                JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>, WrapSchema<T5, A5>) as
                JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>, WrapSchema<T5, A5>) as
                JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>, WrapSchema<T5, A5>) as
                JsonSchema>::is_referenceable()
    }
}schema_for_tuple!((T0 T1 T2 T3 T4 T5) (A0 A1 A2 A3 A4 A5));
373impl<T0, T1, T2, T3, T4, T5, T6, A0, A1, A2, A3, A4, A5, A6>
    JsonSchemaAs<(T0, T1, T2, T3, T4, T5, T6)> for
    (A0, A1, A2, A3, A4, A5, A6) where A0: JsonSchemaAs<T0>,
    A1: JsonSchemaAs<T1>, A2: JsonSchemaAs<T2>, A3: JsonSchemaAs<T3>,
    A4: JsonSchemaAs<T4>, A5: JsonSchemaAs<T5>, A6: JsonSchemaAs<T6> {
    fn schema_name() -> String {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>, WrapSchema<T5, A5>,
                WrapSchema<T6, A6>) as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>, WrapSchema<T5, A5>,
                WrapSchema<T6, A6>) as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>, WrapSchema<T5, A5>,
                WrapSchema<T6, A6>) as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>, WrapSchema<T5, A5>,
                WrapSchema<T6, A6>) as JsonSchema>::is_referenceable()
    }
}schema_for_tuple!((T0 T1 T2 T3 T4 T5 T6) (A0 A1 A2 A3 A4 A5 A6));
374impl<T0, T1, T2, T3, T4, T5, T6, T7, A0, A1, A2, A3, A4, A5, A6, A7>
    JsonSchemaAs<(T0, T1, T2, T3, T4, T5, T6, T7)> for
    (A0, A1, A2, A3, A4, A5, A6, A7) where A0: JsonSchemaAs<T0>,
    A1: JsonSchemaAs<T1>, A2: JsonSchemaAs<T2>, A3: JsonSchemaAs<T3>,
    A4: JsonSchemaAs<T4>, A5: JsonSchemaAs<T5>, A6: JsonSchemaAs<T6>,
    A7: JsonSchemaAs<T7> {
    fn schema_name() -> String {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>, WrapSchema<T5, A5>,
                WrapSchema<T6, A6>, WrapSchema<T7, A7>) as
                JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>, WrapSchema<T5, A5>,
                WrapSchema<T6, A6>, WrapSchema<T7, A7>) as
                JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>, WrapSchema<T5, A5>,
                WrapSchema<T6, A6>, WrapSchema<T7, A7>) as
                JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>, WrapSchema<T5, A5>,
                WrapSchema<T6, A6>, WrapSchema<T7, A7>) as
                JsonSchema>::is_referenceable()
    }
}schema_for_tuple!((T0 T1 T2 T3 T4 T5 T6 T7) (A0 A1 A2 A3 A4 A5 A6 A7));
375impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, A0, A1, A2, A3, A4, A5, A6, A7, A8>
    JsonSchemaAs<(T0, T1, T2, T3, T4, T5, T6, T7, T8)> for
    (A0, A1, A2, A3, A4, A5, A6, A7, A8) where A0: JsonSchemaAs<T0>,
    A1: JsonSchemaAs<T1>, A2: JsonSchemaAs<T2>, A3: JsonSchemaAs<T3>,
    A4: JsonSchemaAs<T4>, A5: JsonSchemaAs<T5>, A6: JsonSchemaAs<T6>,
    A7: JsonSchemaAs<T7>, A8: JsonSchemaAs<T8> {
    fn schema_name() -> String {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>, WrapSchema<T5, A5>,
                WrapSchema<T6, A6>, WrapSchema<T7, A7>, WrapSchema<T8, A8>) as
                JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>, WrapSchema<T5, A5>,
                WrapSchema<T6, A6>, WrapSchema<T7, A7>, WrapSchema<T8, A8>) as
                JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>, WrapSchema<T5, A5>,
                WrapSchema<T6, A6>, WrapSchema<T7, A7>, WrapSchema<T8, A8>) as
                JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>, WrapSchema<T5, A5>,
                WrapSchema<T6, A6>, WrapSchema<T7, A7>, WrapSchema<T8, A8>) as
                JsonSchema>::is_referenceable()
    }
}schema_for_tuple!((T0 T1 T2 T3 T4 T5 T6 T7 T8) (A0 A1 A2 A3 A4 A5 A6 A7 A8));
376impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, A0, A1, A2, A3, A4, A5, A6, A7,
    A8, A9> JsonSchemaAs<(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)> for
    (A0, A1, A2, A3, A4, A5, A6, A7, A8, A9) where A0: JsonSchemaAs<T0>,
    A1: JsonSchemaAs<T1>, A2: JsonSchemaAs<T2>, A3: JsonSchemaAs<T3>,
    A4: JsonSchemaAs<T4>, A5: JsonSchemaAs<T5>, A6: JsonSchemaAs<T6>,
    A7: JsonSchemaAs<T7>, A8: JsonSchemaAs<T8>, A9: JsonSchemaAs<T9> {
    fn schema_name() -> String {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>, WrapSchema<T5, A5>,
                WrapSchema<T6, A6>, WrapSchema<T7, A7>, WrapSchema<T8, A8>,
                WrapSchema<T9, A9>) as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>, WrapSchema<T5, A5>,
                WrapSchema<T6, A6>, WrapSchema<T7, A7>, WrapSchema<T8, A8>,
                WrapSchema<T9, A9>) as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>, WrapSchema<T5, A5>,
                WrapSchema<T6, A6>, WrapSchema<T7, A7>, WrapSchema<T8, A8>,
                WrapSchema<T9, A9>) as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>, WrapSchema<T5, A5>,
                WrapSchema<T6, A6>, WrapSchema<T7, A7>, WrapSchema<T8, A8>,
                WrapSchema<T9, A9>) as JsonSchema>::is_referenceable()
    }
}schema_for_tuple!((T0 T1 T2 T3 T4 T5 T6 T7 T8 T9) (A0 A1 A2 A3 A4 A5 A6 A7 A8 A9));
377impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, A0, A1, A2, A3, A4, A5, A6,
    A7, A8, A9, A10>
    JsonSchemaAs<(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)> for
    (A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10) where A0: JsonSchemaAs<T0>,
    A1: JsonSchemaAs<T1>, A2: JsonSchemaAs<T2>, A3: JsonSchemaAs<T3>,
    A4: JsonSchemaAs<T4>, A5: JsonSchemaAs<T5>, A6: JsonSchemaAs<T6>,
    A7: JsonSchemaAs<T7>, A8: JsonSchemaAs<T8>, A9: JsonSchemaAs<T9>,
    A10: JsonSchemaAs<T10> {
    fn schema_name() -> String {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>, WrapSchema<T5, A5>,
                WrapSchema<T6, A6>, WrapSchema<T7, A7>, WrapSchema<T8, A8>,
                WrapSchema<T9, A9>, WrapSchema<T10, A10>) as
                JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>, WrapSchema<T5, A5>,
                WrapSchema<T6, A6>, WrapSchema<T7, A7>, WrapSchema<T8, A8>,
                WrapSchema<T9, A9>, WrapSchema<T10, A10>) as
                JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>, WrapSchema<T5, A5>,
                WrapSchema<T6, A6>, WrapSchema<T7, A7>, WrapSchema<T8, A8>,
                WrapSchema<T9, A9>, WrapSchema<T10, A10>) as
                JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>, WrapSchema<T5, A5>,
                WrapSchema<T6, A6>, WrapSchema<T7, A7>, WrapSchema<T8, A8>,
                WrapSchema<T9, A9>, WrapSchema<T10, A10>) as
                JsonSchema>::is_referenceable()
    }
}schema_for_tuple!((T0 T1 T2 T3 T4 T5 T6 T7 T8 T9 T10) (A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10));
378impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, A0, A1, A2, A3, A4, A5,
    A6, A7, A8, A9, A10, A11>
    JsonSchemaAs<(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)> for
    (A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11) where
    A0: JsonSchemaAs<T0>, A1: JsonSchemaAs<T1>, A2: JsonSchemaAs<T2>,
    A3: JsonSchemaAs<T3>, A4: JsonSchemaAs<T4>, A5: JsonSchemaAs<T5>,
    A6: JsonSchemaAs<T6>, A7: JsonSchemaAs<T7>, A8: JsonSchemaAs<T8>,
    A9: JsonSchemaAs<T9>, A10: JsonSchemaAs<T10>, A11: JsonSchemaAs<T11> {
    fn schema_name() -> String {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>, WrapSchema<T5, A5>,
                WrapSchema<T6, A6>, WrapSchema<T7, A7>, WrapSchema<T8, A8>,
                WrapSchema<T9, A9>, WrapSchema<T10, A10>,
                WrapSchema<T11, A11>) as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>, WrapSchema<T5, A5>,
                WrapSchema<T6, A6>, WrapSchema<T7, A7>, WrapSchema<T8, A8>,
                WrapSchema<T9, A9>, WrapSchema<T10, A10>,
                WrapSchema<T11, A11>) as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>, WrapSchema<T5, A5>,
                WrapSchema<T6, A6>, WrapSchema<T7, A7>, WrapSchema<T8, A8>,
                WrapSchema<T9, A9>, WrapSchema<T10, A10>,
                WrapSchema<T11, A11>) as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>, WrapSchema<T5, A5>,
                WrapSchema<T6, A6>, WrapSchema<T7, A7>, WrapSchema<T8, A8>,
                WrapSchema<T9, A9>, WrapSchema<T10, A10>,
                WrapSchema<T11, A11>) as JsonSchema>::is_referenceable()
    }
}schema_for_tuple!((T0 T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 T11) (A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11));
379impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, A0, A1, A2, A3,
    A4, A5, A6, A7, A8, A9, A10, A11, A12>
    JsonSchemaAs<(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)> for
    (A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12) where
    A0: JsonSchemaAs<T0>, A1: JsonSchemaAs<T1>, A2: JsonSchemaAs<T2>,
    A3: JsonSchemaAs<T3>, A4: JsonSchemaAs<T4>, A5: JsonSchemaAs<T5>,
    A6: JsonSchemaAs<T6>, A7: JsonSchemaAs<T7>, A8: JsonSchemaAs<T8>,
    A9: JsonSchemaAs<T9>, A10: JsonSchemaAs<T10>, A11: JsonSchemaAs<T11>,
    A12: JsonSchemaAs<T12> {
    fn schema_name() -> String {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>, WrapSchema<T5, A5>,
                WrapSchema<T6, A6>, WrapSchema<T7, A7>, WrapSchema<T8, A8>,
                WrapSchema<T9, A9>, WrapSchema<T10, A10>,
                WrapSchema<T11, A11>, WrapSchema<T12, A12>) as
                JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>, WrapSchema<T5, A5>,
                WrapSchema<T6, A6>, WrapSchema<T7, A7>, WrapSchema<T8, A8>,
                WrapSchema<T9, A9>, WrapSchema<T10, A10>,
                WrapSchema<T11, A11>, WrapSchema<T12, A12>) as
                JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>, WrapSchema<T5, A5>,
                WrapSchema<T6, A6>, WrapSchema<T7, A7>, WrapSchema<T8, A8>,
                WrapSchema<T9, A9>, WrapSchema<T10, A10>,
                WrapSchema<T11, A11>, WrapSchema<T12, A12>) as
                JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>, WrapSchema<T5, A5>,
                WrapSchema<T6, A6>, WrapSchema<T7, A7>, WrapSchema<T8, A8>,
                WrapSchema<T9, A9>, WrapSchema<T10, A10>,
                WrapSchema<T11, A11>, WrapSchema<T12, A12>) as
                JsonSchema>::is_referenceable()
    }
}schema_for_tuple!(
380    (T0 T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 T11 T12)
381    (A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12)
382);
383impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, A0, A1, A2,
    A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13>
    JsonSchemaAs<(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13)>
    for (A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13) where
    A0: JsonSchemaAs<T0>, A1: JsonSchemaAs<T1>, A2: JsonSchemaAs<T2>,
    A3: JsonSchemaAs<T3>, A4: JsonSchemaAs<T4>, A5: JsonSchemaAs<T5>,
    A6: JsonSchemaAs<T6>, A7: JsonSchemaAs<T7>, A8: JsonSchemaAs<T8>,
    A9: JsonSchemaAs<T9>, A10: JsonSchemaAs<T10>, A11: JsonSchemaAs<T11>,
    A12: JsonSchemaAs<T12>, A13: JsonSchemaAs<T13> {
    fn schema_name() -> String {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>, WrapSchema<T5, A5>,
                WrapSchema<T6, A6>, WrapSchema<T7, A7>, WrapSchema<T8, A8>,
                WrapSchema<T9, A9>, WrapSchema<T10, A10>,
                WrapSchema<T11, A11>, WrapSchema<T12, A12>,
                WrapSchema<T13, A13>) as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>, WrapSchema<T5, A5>,
                WrapSchema<T6, A6>, WrapSchema<T7, A7>, WrapSchema<T8, A8>,
                WrapSchema<T9, A9>, WrapSchema<T10, A10>,
                WrapSchema<T11, A11>, WrapSchema<T12, A12>,
                WrapSchema<T13, A13>) as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>, WrapSchema<T5, A5>,
                WrapSchema<T6, A6>, WrapSchema<T7, A7>, WrapSchema<T8, A8>,
                WrapSchema<T9, A9>, WrapSchema<T10, A10>,
                WrapSchema<T11, A11>, WrapSchema<T12, A12>,
                WrapSchema<T13, A13>) as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>, WrapSchema<T5, A5>,
                WrapSchema<T6, A6>, WrapSchema<T7, A7>, WrapSchema<T8, A8>,
                WrapSchema<T9, A9>, WrapSchema<T10, A10>,
                WrapSchema<T11, A11>, WrapSchema<T12, A12>,
                WrapSchema<T13, A13>) as JsonSchema>::is_referenceable()
    }
}schema_for_tuple!(
384    (T0 T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 T11 T12 T13)
385    (A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13)
386);
387impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, A0, A1,
    A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14>
    JsonSchemaAs<(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
    T14)> for
    (A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14) where
    A0: JsonSchemaAs<T0>, A1: JsonSchemaAs<T1>, A2: JsonSchemaAs<T2>,
    A3: JsonSchemaAs<T3>, A4: JsonSchemaAs<T4>, A5: JsonSchemaAs<T5>,
    A6: JsonSchemaAs<T6>, A7: JsonSchemaAs<T7>, A8: JsonSchemaAs<T8>,
    A9: JsonSchemaAs<T9>, A10: JsonSchemaAs<T10>, A11: JsonSchemaAs<T11>,
    A12: JsonSchemaAs<T12>, A13: JsonSchemaAs<T13>, A14: JsonSchemaAs<T14> {
    fn schema_name() -> String {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>, WrapSchema<T5, A5>,
                WrapSchema<T6, A6>, WrapSchema<T7, A7>, WrapSchema<T8, A8>,
                WrapSchema<T9, A9>, WrapSchema<T10, A10>,
                WrapSchema<T11, A11>, WrapSchema<T12, A12>,
                WrapSchema<T13, A13>, WrapSchema<T14, A14>) as
                JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>, WrapSchema<T5, A5>,
                WrapSchema<T6, A6>, WrapSchema<T7, A7>, WrapSchema<T8, A8>,
                WrapSchema<T9, A9>, WrapSchema<T10, A10>,
                WrapSchema<T11, A11>, WrapSchema<T12, A12>,
                WrapSchema<T13, A13>, WrapSchema<T14, A14>) as
                JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>, WrapSchema<T5, A5>,
                WrapSchema<T6, A6>, WrapSchema<T7, A7>, WrapSchema<T8, A8>,
                WrapSchema<T9, A9>, WrapSchema<T10, A10>,
                WrapSchema<T11, A11>, WrapSchema<T12, A12>,
                WrapSchema<T13, A13>, WrapSchema<T14, A14>) as
                JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>, WrapSchema<T5, A5>,
                WrapSchema<T6, A6>, WrapSchema<T7, A7>, WrapSchema<T8, A8>,
                WrapSchema<T9, A9>, WrapSchema<T10, A10>,
                WrapSchema<T11, A11>, WrapSchema<T12, A12>,
                WrapSchema<T13, A13>, WrapSchema<T14, A14>) as
                JsonSchema>::is_referenceable()
    }
}schema_for_tuple!(
388    (T0 T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 T11 T12 T13 T14)
389    (A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14)
390);
391impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, A0,
    A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15>
    JsonSchemaAs<(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
    T14, T15)> for
    (A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15)
    where A0: JsonSchemaAs<T0>, A1: JsonSchemaAs<T1>, A2: JsonSchemaAs<T2>,
    A3: JsonSchemaAs<T3>, A4: JsonSchemaAs<T4>, A5: JsonSchemaAs<T5>,
    A6: JsonSchemaAs<T6>, A7: JsonSchemaAs<T7>, A8: JsonSchemaAs<T8>,
    A9: JsonSchemaAs<T9>, A10: JsonSchemaAs<T10>, A11: JsonSchemaAs<T11>,
    A12: JsonSchemaAs<T12>, A13: JsonSchemaAs<T13>, A14: JsonSchemaAs<T14>,
    A15: JsonSchemaAs<T15> {
    fn schema_name() -> String {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>, WrapSchema<T5, A5>,
                WrapSchema<T6, A6>, WrapSchema<T7, A7>, WrapSchema<T8, A8>,
                WrapSchema<T9, A9>, WrapSchema<T10, A10>,
                WrapSchema<T11, A11>, WrapSchema<T12, A12>,
                WrapSchema<T13, A13>, WrapSchema<T14, A14>,
                WrapSchema<T15, A15>) as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>, WrapSchema<T5, A5>,
                WrapSchema<T6, A6>, WrapSchema<T7, A7>, WrapSchema<T8, A8>,
                WrapSchema<T9, A9>, WrapSchema<T10, A10>,
                WrapSchema<T11, A11>, WrapSchema<T12, A12>,
                WrapSchema<T13, A13>, WrapSchema<T14, A14>,
                WrapSchema<T15, A15>) as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>, WrapSchema<T5, A5>,
                WrapSchema<T6, A6>, WrapSchema<T7, A7>, WrapSchema<T8, A8>,
                WrapSchema<T9, A9>, WrapSchema<T10, A10>,
                WrapSchema<T11, A11>, WrapSchema<T12, A12>,
                WrapSchema<T13, A13>, WrapSchema<T14, A14>,
                WrapSchema<T15, A15>) as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <(WrapSchema<T0, A0>, WrapSchema<T1, A1>, WrapSchema<T2, A2>,
                WrapSchema<T3, A3>, WrapSchema<T4, A4>, WrapSchema<T5, A5>,
                WrapSchema<T6, A6>, WrapSchema<T7, A7>, WrapSchema<T8, A8>,
                WrapSchema<T9, A9>, WrapSchema<T10, A10>,
                WrapSchema<T11, A11>, WrapSchema<T12, A12>,
                WrapSchema<T13, A13>, WrapSchema<T14, A14>,
                WrapSchema<T15, A15>) as JsonSchema>::is_referenceable()
    }
}schema_for_tuple!(
392    (T0 T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 T11 T12 T13 T14 T15)
393    (A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15)
394);
395
396//===================================================================
397// Impls for serde_with types.
398
399impl<T: JsonSchema> JsonSchemaAs<T> for Same {
400    String
<T as JsonSchema>::schema_name();
Cow<'static, str>
<T as JsonSchema>::schema_id();
&mut SchemaGenerator
gen
Schema
<T as JsonSchema>::json_schema(gen);
bool
<T as JsonSchema>::is_referenceable();forward_schema!(T);
401}
402
403impl<T> JsonSchemaAs<T> for DisplayFromStr {
404    String
<String as JsonSchema>::schema_name();
Cow<'static, str>
<String as JsonSchema>::schema_id();
&mut SchemaGenerator
gen
Schema
<String as JsonSchema>::json_schema(gen);
bool
<String as JsonSchema>::is_referenceable();forward_schema!(String);
405}
406
407#[cfg(feature = "hex")]
408impl<T, F: formats::Format> JsonSchemaAs<T> for hex::Hex<F> {
409    fn schema_name() -> String {
410        "Hex<F>".into()
411    }
412
413    fn schema_id() -> Cow<'static, str> {
414        "serde_with::hex::Hex<F>".into()
415    }
416
417    fn json_schema(_: &mut SchemaGenerator) -> Schema {
418        use ::schemars_0_8::schema::StringValidation;
419
420        SchemaObject {
421            instance_type: Some(InstanceType::String.into()),
422            string: Some(Box::new(StringValidation {
423                pattern: Some(r"^(?:[0-9A-Fa-f]{2})*$".to_owned()),
424                ..Default::default()
425            })),
426            ..Default::default()
427        }
428        .into()
429    }
430
431    fn is_referenceable() -> bool {
432        false
433    }
434}
435
436impl JsonSchemaAs<bool> for BoolFromInt<Strict> {
437    fn schema_name() -> String {
438        "BoolFromInt<Strict>".into()
439    }
440
441    fn schema_id() -> Cow<'static, str> {
442        "serde_with::BoolFromInt<Strict>".into()
443    }
444
445    fn json_schema(_: &mut SchemaGenerator) -> Schema {
446        SchemaObject {
447            instance_type: Some(InstanceType::Integer.into()),
448            number: Some(Box::new(NumberValidation {
449                minimum: Some(0.0),
450                maximum: Some(1.0),
451                ..Default::default()
452            })),
453            ..Default::default()
454        }
455        .into()
456    }
457
458    fn is_referenceable() -> bool {
459        false
460    }
461}
462
463impl JsonSchemaAs<bool> for BoolFromInt<Flexible> {
464    fn schema_name() -> String {
465        "BoolFromInt<Flexible>".into()
466    }
467
468    fn schema_id() -> Cow<'static, str> {
469        "serde_with::BoolFromInt<Flexible>".into()
470    }
471
472    fn json_schema(_: &mut SchemaGenerator) -> Schema {
473        SchemaObject {
474            instance_type: Some(InstanceType::Integer.into()),
475            ..Default::default()
476        }
477        .into()
478    }
479
480    fn is_referenceable() -> bool {
481        false
482    }
483}
484
485impl<'a, T: 'a> JsonSchemaAs<Cow<'a, T>> for BorrowCow
486where
487    T: ?Sized + ToOwned,
488    Cow<'a, T>: JsonSchema,
489{
490    String
<Cow<'a, T> as JsonSchema>::schema_name();
Cow<'static, str>
<Cow<'a, T> as JsonSchema>::schema_id();
&mut SchemaGenerator
gen
Schema
<Cow<'a, T> as JsonSchema>::json_schema(gen);
bool
<Cow<'a, T> as JsonSchema>::is_referenceable();forward_schema!(Cow<'a, T>);
491}
492
493impl<T> JsonSchemaAs<T> for Bytes {
494    String
<Vec<u8> as JsonSchema>::schema_name();
Cow<'static, str>
<Vec<u8> as JsonSchema>::schema_id();
&mut SchemaGenerator
gen
Schema
<Vec<u8> as JsonSchema>::json_schema(gen);
bool
<Vec<u8> as JsonSchema>::is_referenceable();forward_schema!(Vec<u8>);
495}
496
497impl JsonSchemaAs<Vec<u8>> for BytesOrString {
498    fn schema_name() -> String {
499        "BytesOrString".into()
500    }
501
502    fn schema_id() -> Cow<'static, str> {
503        "serde_with::BytesOrString".into()
504    }
505
506    fn json_schema(generator: &mut SchemaGenerator) -> Schema {
507        SchemaObject {
508            subschemas: Some(Box::new(SubschemaValidation {
509                any_of: Some(::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
        [generator.subschema_for::<Vec<u8>>(),
                SchemaObject {
                        instance_type: Some(InstanceType::String.into()),
                        metadata: Some(Box::new(Metadata {
                                    write_only: true,
                                    ..Default::default()
                                })),
                        ..Default::default()
                    }.into()]))std::vec![
510                    generator.subschema_for::<Vec<u8>>(),
511                    SchemaObject {
512                        instance_type: Some(InstanceType::String.into()),
513                        metadata: Some(Box::new(Metadata {
514                            write_only: true,
515                            ..Default::default()
516                        })),
517                        ..Default::default()
518                    }
519                    .into()
520                ]),
521                ..Default::default()
522            })),
523            ..Default::default()
524        }
525        .into()
526    }
527
528    fn is_referenceable() -> bool {
529        false
530    }
531}
532
533impl<T, TA> JsonSchemaAs<T> for DefaultOnError<TA>
534where
535    TA: JsonSchemaAs<T>,
536{
537    String
<WrapSchema<T, TA> as JsonSchema>::schema_name();
Cow<'static, str>
<WrapSchema<T, TA> as JsonSchema>::schema_id();
&mut SchemaGenerator
gen
Schema
<WrapSchema<T, TA> as JsonSchema>::json_schema(gen);
bool
<WrapSchema<T, TA> as JsonSchema>::is_referenceable();forward_schema!(WrapSchema<T, TA>);
538}
539
540impl<T, TA> JsonSchemaAs<T> for DefaultOnNull<TA>
541where
542    TA: JsonSchemaAs<T>,
543{
544    String
<Option<WrapSchema<T, TA>> as JsonSchema>::schema_name();
Cow<'static, str>
<Option<WrapSchema<T, TA>> as JsonSchema>::schema_id();
&mut SchemaGenerator
gen
Schema
<Option<WrapSchema<T, TA>> as JsonSchema>::json_schema(gen);
bool
<Option<WrapSchema<T, TA>> as JsonSchema>::is_referenceable();forward_schema!(Option<WrapSchema<T, TA>>);
545}
546
547impl<O, T: JsonSchema> JsonSchemaAs<O> for FromInto<T> {
548    String
<T as JsonSchema>::schema_name();
Cow<'static, str>
<T as JsonSchema>::schema_id();
&mut SchemaGenerator
gen
Schema
<T as JsonSchema>::json_schema(gen);
bool
<T as JsonSchema>::is_referenceable();forward_schema!(T);
549}
550
551impl<O, T: JsonSchema> JsonSchemaAs<O> for FromIntoRef<T> {
552    String
<T as JsonSchema>::schema_name();
Cow<'static, str>
<T as JsonSchema>::schema_id();
&mut SchemaGenerator
gen
Schema
<T as JsonSchema>::json_schema(gen);
bool
<T as JsonSchema>::is_referenceable();forward_schema!(T);
553}
554
555impl<T, U: JsonSchema> JsonSchemaAs<T> for TryFromInto<U> {
556    String
<U as JsonSchema>::schema_name();
Cow<'static, str>
<U as JsonSchema>::schema_id();
&mut SchemaGenerator
gen
Schema
<U as JsonSchema>::json_schema(gen);
bool
<U as JsonSchema>::is_referenceable();forward_schema!(U);
557}
558
559impl<T, U: JsonSchema> JsonSchemaAs<T> for TryFromIntoRef<U> {
560    String
<U as JsonSchema>::schema_name();
Cow<'static, str>
<U as JsonSchema>::schema_id();
&mut SchemaGenerator
gen
Schema
<U as JsonSchema>::json_schema(gen);
bool
<U as JsonSchema>::is_referenceable();forward_schema!(U);
561}
562
563impl<T, TA, FA> JsonSchemaAs<T> for IfIsHumanReadable<TA, FA>
564where
565    TA: JsonSchemaAs<T>,
566{
567    // serde_json always has `is_human_readable` set to true so we just use the
568    // schema for the human readable variant.
569    String
<WrapSchema<T, TA> as JsonSchema>::schema_name();
Cow<'static, str>
<WrapSchema<T, TA> as JsonSchema>::schema_id();
&mut SchemaGenerator
gen
Schema
<WrapSchema<T, TA> as JsonSchema>::json_schema(gen);
bool
<WrapSchema<T, TA> as JsonSchema>::is_referenceable();forward_schema!(WrapSchema<T, TA>);
570}
571
572macro_rules! schema_for_map {
573    ($type:ty) => {
574        impl<K, V, KA, VA> JsonSchemaAs<$type> for Map<KA, VA>
575        where
576            VA: JsonSchemaAs<V>,
577        {
578            forward_schema!(WrapSchema<BTreeMap<K, V>, BTreeMap<KA, VA>>);
579        }
580    };
581}
582
583impl<K, V, KA, VA> JsonSchemaAs<[(K, V)]> for Map<KA, VA> where
    VA: JsonSchemaAs<V> {
    fn schema_name() -> String {
        <WrapSchema<BTreeMap<K, V>, BTreeMap<KA, VA>> as
                JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <WrapSchema<BTreeMap<K, V>, BTreeMap<KA, VA>> as
                JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <WrapSchema<BTreeMap<K, V>, BTreeMap<KA, VA>> as
                JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <WrapSchema<BTreeMap<K, V>, BTreeMap<KA, VA>> as
                JsonSchema>::is_referenceable()
    }
}schema_for_map!([(K, V)]);
584impl<K, V, KA, VA> JsonSchemaAs<BTreeSet<(K, V)>> for Map<KA, VA> where
    VA: JsonSchemaAs<V> {
    fn schema_name() -> String {
        <WrapSchema<BTreeMap<K, V>, BTreeMap<KA, VA>> as
                JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <WrapSchema<BTreeMap<K, V>, BTreeMap<KA, VA>> as
                JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <WrapSchema<BTreeMap<K, V>, BTreeMap<KA, VA>> as
                JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <WrapSchema<BTreeMap<K, V>, BTreeMap<KA, VA>> as
                JsonSchema>::is_referenceable()
    }
}schema_for_map!(BTreeSet<(K, V)>);
585impl<K, V, KA, VA> JsonSchemaAs<BinaryHeap<(K, V)>> for Map<KA, VA> where
    VA: JsonSchemaAs<V> {
    fn schema_name() -> String {
        <WrapSchema<BTreeMap<K, V>, BTreeMap<KA, VA>> as
                JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <WrapSchema<BTreeMap<K, V>, BTreeMap<KA, VA>> as
                JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <WrapSchema<BTreeMap<K, V>, BTreeMap<KA, VA>> as
                JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <WrapSchema<BTreeMap<K, V>, BTreeMap<KA, VA>> as
                JsonSchema>::is_referenceable()
    }
}schema_for_map!(BinaryHeap<(K, V)>);
586impl<K, V, KA, VA> JsonSchemaAs<Box<[(K, V)]>> for Map<KA, VA> where
    VA: JsonSchemaAs<V> {
    fn schema_name() -> String {
        <WrapSchema<BTreeMap<K, V>, BTreeMap<KA, VA>> as
                JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <WrapSchema<BTreeMap<K, V>, BTreeMap<KA, VA>> as
                JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <WrapSchema<BTreeMap<K, V>, BTreeMap<KA, VA>> as
                JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <WrapSchema<BTreeMap<K, V>, BTreeMap<KA, VA>> as
                JsonSchema>::is_referenceable()
    }
}schema_for_map!(Box<[(K, V)]>);
587impl<K, V, KA, VA> JsonSchemaAs<LinkedList<(K, V)>> for Map<KA, VA> where
    VA: JsonSchemaAs<V> {
    fn schema_name() -> String {
        <WrapSchema<BTreeMap<K, V>, BTreeMap<KA, VA>> as
                JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <WrapSchema<BTreeMap<K, V>, BTreeMap<KA, VA>> as
                JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <WrapSchema<BTreeMap<K, V>, BTreeMap<KA, VA>> as
                JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <WrapSchema<BTreeMap<K, V>, BTreeMap<KA, VA>> as
                JsonSchema>::is_referenceable()
    }
}schema_for_map!(LinkedList<(K, V)>);
588impl<K, V, KA, VA> JsonSchemaAs<Vec<(K, V)>> for Map<KA, VA> where
    VA: JsonSchemaAs<V> {
    fn schema_name() -> String {
        <WrapSchema<BTreeMap<K, V>, BTreeMap<KA, VA>> as
                JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <WrapSchema<BTreeMap<K, V>, BTreeMap<KA, VA>> as
                JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <WrapSchema<BTreeMap<K, V>, BTreeMap<KA, VA>> as
                JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <WrapSchema<BTreeMap<K, V>, BTreeMap<KA, VA>> as
                JsonSchema>::is_referenceable()
    }
}schema_for_map!(Vec<(K, V)>);
589impl<K, V, KA, VA> JsonSchemaAs<VecDeque<(K, V)>> for Map<KA, VA> where
    VA: JsonSchemaAs<V> {
    fn schema_name() -> String {
        <WrapSchema<BTreeMap<K, V>, BTreeMap<KA, VA>> as
                JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <WrapSchema<BTreeMap<K, V>, BTreeMap<KA, VA>> as
                JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <WrapSchema<BTreeMap<K, V>, BTreeMap<KA, VA>> as
                JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <WrapSchema<BTreeMap<K, V>, BTreeMap<KA, VA>> as
                JsonSchema>::is_referenceable()
    }
}schema_for_map!(VecDeque<(K, V)>);
590
591impl<K, V, S, KA, VA> JsonSchemaAs<HashSet<(K, V), S>> for Map<KA, VA>
592where
593    VA: JsonSchemaAs<V>,
594{
595    String
<WrapSchema<BTreeMap<K, V>, BTreeMap<KA, VA>> as JsonSchema>::schema_name();
Cow<'static, str>
<WrapSchema<BTreeMap<K, V>, BTreeMap<KA, VA>> as JsonSchema>::schema_id();
&mut SchemaGenerator
gen
Schema
<WrapSchema<BTreeMap<K, V>, BTreeMap<KA, VA>> as
        JsonSchema>::json_schema(gen);
bool
<WrapSchema<BTreeMap<K, V>, BTreeMap<KA, VA>> as
        JsonSchema>::is_referenceable();forward_schema!(WrapSchema<BTreeMap<K, V>, BTreeMap<KA, VA>>);
596}
597
598impl<T> JsonSchemaAs<Vec<T>> for EnumMap
599where
600    T: JsonSchema,
601{
602    fn schema_name() -> String {
603        ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("EnumMap({0})", T::schema_name()))
    })std::format!("EnumMap({})", T::schema_name())
604    }
605
606    fn schema_id() -> Cow<'static, str> {
607        ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("serde_with::EnumMap({0})",
                T::schema_id()))
    })std::format!("serde_with::EnumMap({})", T::schema_id()).into()
608    }
609
610    // We generate the schema here by going through all the variants of the
611    // enum (the oneOf property) and sticking all their properties onto an
612    // object.
613    //
614    // This will be wrong if the object is not an externally tagged enum but in
615    // that case serialization and deserialization will fail so it is probably
616    // OK.
617    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
618        let mut object = SchemaObject {
619            instance_type: Some(InstanceType::Object.into()),
620            ..Default::default()
621        };
622        let inner = T::json_schema(gen).into_object();
623
624        let one_of = match inner.subschemas {
625            Some(subschemas) => match subschemas.one_of {
626                Some(one_of) => one_of,
627                None => return object.into(),
628            },
629            None => return object.into(),
630        };
631
632        let properties = &mut object.object().properties;
633        for schema in one_of {
634            if let Some(object) = schema.into_object().object {
635                properties.extend(object.properties);
636            }
637        }
638
639        object.object().additional_properties = Some(Box::new(Schema::Bool(false)));
640        object.into()
641    }
642
643    fn is_referenceable() -> bool {
644        true
645    }
646}
647
648impl<T, TA> WrapSchema<Vec<T>, KeyValueMap<TA>>
649where
650    TA: JsonSchemaAs<T>,
651{
652    /// Transform a schema from the entry type of a `KeyValueMap<T>` to the
653    /// resulting field type.
654    ///
655    /// This usually means doing one of two things:
656    /// 1. removing the `$key$` property from an object, or,
657    /// 2. removing the first item from an array.
658    ///
659    /// We also need to adjust any fields that control the number of items or
660    /// properties allowed such as `(max|min)_properties` or `(max|min)_items`.
661    ///
662    /// This is mostly straightforward. Where things get hairy is when dealing
663    /// with subschemas. JSON schemas allow you to build the schema for an
664    /// object by combining multiple subschemas:
665    /// - You can match exactly one of a set of subschemas (`one_of`).
666    /// - You can match any of a set of subschemas (`any_of`).
667    /// - You can match all of a set of subschemas (`all_of`).
668    ///
669    /// Unfortunately for us, we need to handle all of these options by recursing
670    /// into the subschemas and applying the same transformations as above.
671    fn kvmap_transform_schema_0_8(gen: &mut SchemaGenerator, schema: &mut Schema) {
672        let mut parents = Vec::new();
673
674        Self::kvmap_transform_schema_impl_0_8(gen, schema, &mut parents, 0);
675    }
676
677    fn kvmap_transform_schema_impl_0_8(
678        gen: &mut SchemaGenerator,
679        schema: &mut Schema,
680        parents: &mut Vec<String>,
681        depth: u32,
682    ) {
683        if depth > 8 {
684            return;
685        }
686
687        let mut done = false;
688        let schema = match schema {
689            Schema::Object(schema) => schema,
690            _ => return,
691        };
692
693        // The schema is a reference to a schema defined elsewhere.
694        //
695        // If possible we replace it with its definition but if that is not
696        // available then we give up and leave it as-is.
697        let mut parents = if let Some(reference) = &schema.reference {
698            let name = match reference.strip_prefix(&gen.settings().definitions_path) {
699                Some(name) => name,
700                // Reference is defined elsewhere, nothing we can do.
701                None => return,
702            };
703
704            // We are in a recursive reference loop. No point in continuing.
705            if parents.iter().any(|parent| parent == name) {
706                return;
707            }
708
709            let name = name.to_owned();
710            *schema = match gen.definitions().get(&name) {
711                Some(Schema::Object(schema)) => schema.clone(),
712                _ => return,
713            };
714
715            parents.push(name);
716            utils::DropGuard::new(parents, |parents| drop(parents.pop()))
717        } else {
718            utils::DropGuard::unguarded(parents)
719        };
720
721        if let Some(object) = &mut schema.object {
722            // For objects KeyValueMap uses the $key$ property so we need to remove it from
723            // the inner schema.
724
725            done |= object.properties.remove("$key$").is_some();
726            done |= object.required.remove("$key$");
727
728            if let Some(max) = &mut object.max_properties {
729                *max = max.saturating_sub(1);
730            }
731
732            if let Some(min) = &mut object.min_properties {
733                *min = min.saturating_sub(1);
734            }
735        }
736
737        if let Some(array) = &mut schema.array {
738            // For arrays KeyValueMap uses the first array element so we need to remove it
739            // from the inner schema.
740
741            if let Some(SingleOrVec::Vec(items)) = &mut array.items {
742                // If the array is empty then the leading element may be following the
743                // additionalItem schema. In that case we do nothing.
744                if !items.is_empty() {
745                    items.remove(0);
746                    done = true;
747                }
748            }
749
750            if let Some(max) = &mut array.max_items {
751                *max = max.saturating_sub(1);
752            }
753
754            if let Some(min) = &mut array.min_items {
755                *min = min.saturating_sub(1);
756            }
757        }
758
759        // We've already modified the schema so there's no need to do more work.
760        if done {
761            return;
762        }
763
764        let subschemas = match &mut schema.subschemas {
765            Some(subschemas) => subschemas,
766            None => return,
767        };
768
769        if let Some(one_of) = &mut subschemas.one_of {
770            for subschema in one_of {
771                Self::kvmap_transform_schema_impl_0_8(gen, subschema, &mut parents, depth + 1);
772            }
773        }
774
775        if let Some(any_of) = &mut subschemas.any_of {
776            for subschema in any_of {
777                Self::kvmap_transform_schema_impl_0_8(gen, subschema, &mut parents, depth + 1);
778            }
779        }
780
781        if let Some(all_of) = &mut subschemas.all_of {
782            for subschema in all_of {
783                Self::kvmap_transform_schema_impl_0_8(gen, subschema, &mut parents, depth + 1);
784            }
785        }
786    }
787}
788
789impl<T, TA> JsonSchemaAs<Vec<T>> for KeyValueMap<TA>
790where
791    TA: JsonSchemaAs<T>,
792{
793    fn schema_name() -> String {
794        ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("KeyValueMap({0})",
                <WrapSchema<T, TA>>::schema_name()))
    })std::format!("KeyValueMap({})", <WrapSchema<T, TA>>::schema_name())
795    }
796
797    fn schema_id() -> Cow<'static, str> {
798        ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("serde_with::KeyValueMap({0})",
                <WrapSchema<T, TA>>::schema_id()))
    })std::format!(
799            "serde_with::KeyValueMap({})",
800            <WrapSchema<T, TA>>::schema_id()
801        )
802        .into()
803    }
804
805    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
806        let mut value = <WrapSchema<T, TA>>::json_schema(gen);
807        <WrapSchema<Vec<T>, KeyValueMap<TA>>>::kvmap_transform_schema_0_8(gen, &mut value);
808
809        SchemaObject {
810            instance_type: Some(InstanceType::Object.into()),
811            object: Some(Box::new(ObjectValidation {
812                additional_properties: Some(Box::new(value)),
813                ..Default::default()
814            })),
815            ..Default::default()
816        }
817        .into()
818    }
819
820    fn is_referenceable() -> bool {
821        true
822    }
823}
824
825impl<K, V, KA, VA, const N: usize> JsonSchemaAs<[(K, V); N]> for Map<KA, VA>
826where
827    VA: JsonSchemaAs<V>,
828{
829    String
<WrapSchema<BTreeMap<K, V>, BTreeMap<KA, VA>> as JsonSchema>::schema_name();
Cow<'static, str>
<WrapSchema<BTreeMap<K, V>, BTreeMap<KA, VA>> as JsonSchema>::schema_id();
&mut SchemaGenerator
gen
Schema
<WrapSchema<BTreeMap<K, V>, BTreeMap<KA, VA>> as
        JsonSchema>::json_schema(gen);
bool
<WrapSchema<BTreeMap<K, V>, BTreeMap<KA, VA>> as
        JsonSchema>::is_referenceable();forward_schema!(WrapSchema<BTreeMap<K, V>, BTreeMap<KA, VA>>);
830}
831
832macro_rules! map_first_last_wins_schema {
833    ($(=> $extra:ident)? $type:ty) => {
834        impl<K, V, $($extra,)? KA, VA> JsonSchemaAs<$type> for MapFirstKeyWins<KA, VA>
835        where
836            VA: JsonSchemaAs<V>,
837        {
838            forward_schema!(BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>>);
839        }
840
841        impl<K, V, $($extra,)? KA, VA> JsonSchemaAs<$type> for MapPreventDuplicates<KA, VA>
842        where
843            VA: JsonSchemaAs<V>,
844        {
845            forward_schema!(BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>>);
846        }
847    }
848}
849
850impl<K, V, KA, VA> JsonSchemaAs<BTreeMap<K, V>> for MapFirstKeyWins<KA, VA>
    where VA: JsonSchemaAs<V> {
    fn schema_name() -> String {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::is_referenceable()
    }
}
impl<K, V, KA, VA> JsonSchemaAs<BTreeMap<K, V>> for
    MapPreventDuplicates<KA, VA> where VA: JsonSchemaAs<V> {
    fn schema_name() -> String {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::is_referenceable()
    }
}map_first_last_wins_schema!(BTreeMap<K, V>);
851impl<K, V, S, KA, VA> JsonSchemaAs<HashMap<K, V, S>> for
    MapFirstKeyWins<KA, VA> where VA: JsonSchemaAs<V> {
    fn schema_name() -> String {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::is_referenceable()
    }
}
impl<K, V, S, KA, VA> JsonSchemaAs<HashMap<K, V, S>> for
    MapPreventDuplicates<KA, VA> where VA: JsonSchemaAs<V> {
    fn schema_name() -> String {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::is_referenceable()
    }
}map_first_last_wins_schema!(=> S HashMap<K, V, S>);
852#[cfg(feature = "hashbrown_0_14")]
853impl<K, V, S, KA, VA> JsonSchemaAs<hashbrown_0_14::HashMap<K, V, S>> for
    MapFirstKeyWins<KA, VA> where VA: JsonSchemaAs<V> {
    fn schema_name() -> String {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::is_referenceable()
    }
}
impl<K, V, S, KA, VA> JsonSchemaAs<hashbrown_0_14::HashMap<K, V, S>> for
    MapPreventDuplicates<KA, VA> where VA: JsonSchemaAs<V> {
    fn schema_name() -> String {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::is_referenceable()
    }
}map_first_last_wins_schema!(=> S hashbrown_0_14::HashMap<K, V, S>);
854#[cfg(feature = "hashbrown_0_15")]
855impl<K, V, S, KA, VA> JsonSchemaAs<hashbrown_0_15::HashMap<K, V, S>> for
    MapFirstKeyWins<KA, VA> where VA: JsonSchemaAs<V> {
    fn schema_name() -> String {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::is_referenceable()
    }
}
impl<K, V, S, KA, VA> JsonSchemaAs<hashbrown_0_15::HashMap<K, V, S>> for
    MapPreventDuplicates<KA, VA> where VA: JsonSchemaAs<V> {
    fn schema_name() -> String {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::is_referenceable()
    }
}map_first_last_wins_schema!(=> S hashbrown_0_15::HashMap<K, V, S>);
856#[cfg(feature = "hashbrown_0_16")]
857impl<K, V, S, KA, VA> JsonSchemaAs<hashbrown_0_16::HashMap<K, V, S>> for
    MapFirstKeyWins<KA, VA> where VA: JsonSchemaAs<V> {
    fn schema_name() -> String {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::is_referenceable()
    }
}
impl<K, V, S, KA, VA> JsonSchemaAs<hashbrown_0_16::HashMap<K, V, S>> for
    MapPreventDuplicates<KA, VA> where VA: JsonSchemaAs<V> {
    fn schema_name() -> String {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::is_referenceable()
    }
}map_first_last_wins_schema!(=> S hashbrown_0_16::HashMap<K, V, S>);
858#[cfg(feature = "hashbrown_0_17")]
859impl<K, V, S, KA, VA> JsonSchemaAs<hashbrown_0_17::HashMap<K, V, S>> for
    MapFirstKeyWins<KA, VA> where VA: JsonSchemaAs<V> {
    fn schema_name() -> String {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::is_referenceable()
    }
}
impl<K, V, S, KA, VA> JsonSchemaAs<hashbrown_0_17::HashMap<K, V, S>> for
    MapPreventDuplicates<KA, VA> where VA: JsonSchemaAs<V> {
    fn schema_name() -> String {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::is_referenceable()
    }
}map_first_last_wins_schema!(=> S hashbrown_0_17::HashMap<K, V, S>);
860#[cfg(feature = "indexmap_1")]
861impl<K, V, S, KA, VA> JsonSchemaAs<indexmap_1::IndexMap<K, V, S>> for
    MapFirstKeyWins<KA, VA> where VA: JsonSchemaAs<V> {
    fn schema_name() -> String {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::is_referenceable()
    }
}
impl<K, V, S, KA, VA> JsonSchemaAs<indexmap_1::IndexMap<K, V, S>> for
    MapPreventDuplicates<KA, VA> where VA: JsonSchemaAs<V> {
    fn schema_name() -> String {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::is_referenceable()
    }
}map_first_last_wins_schema!(=> S indexmap_1::IndexMap<K, V, S>);
862#[cfg(feature = "indexmap_2")]
863impl<K, V, S, KA, VA> JsonSchemaAs<indexmap_2::IndexMap<K, V, S>> for
    MapFirstKeyWins<KA, VA> where VA: JsonSchemaAs<V> {
    fn schema_name() -> String {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::is_referenceable()
    }
}
impl<K, V, S, KA, VA> JsonSchemaAs<indexmap_2::IndexMap<K, V, S>> for
    MapPreventDuplicates<KA, VA> where VA: JsonSchemaAs<V> {
    fn schema_name() -> String {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <BTreeMap<WrapSchema<K, KA>, WrapSchema<V, VA>> as
                JsonSchema>::is_referenceable()
    }
}map_first_last_wins_schema!(=> S indexmap_2::IndexMap<K, V, S>);
864
865impl<T, TA> JsonSchemaAs<Vec<T>> for OneOrMany<TA, PreferOne>
866where
867    TA: JsonSchemaAs<T>,
868{
869    fn schema_name() -> String {
870        ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("OneOrMany({0},PreferOne)",
                <WrapSchema<T, TA>>::schema_name()))
    })std::format!(
871            "OneOrMany({},PreferOne)",
872            <WrapSchema<T, TA>>::schema_name()
873        )
874    }
875
876    fn schema_id() -> Cow<'static, str> {
877        ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("serde_with::OneOrMany({0},PreferOne)",
                <WrapSchema<T, TA>>::schema_id()))
    })std::format!(
878            "serde_with::OneOrMany({},PreferOne)",
879            <WrapSchema<T, TA>>::schema_id()
880        )
881        .into()
882    }
883
884    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
885        let single = gen.subschema_for::<WrapSchema<T, TA>>();
886        let array = SchemaObject {
887            instance_type: Some(InstanceType::Array.into()),
888            array: Some(Box::new(ArrayValidation {
889                items: Some(single.clone().into()),
890                ..Default::default()
891            })),
892            ..Default::default()
893        };
894
895        SchemaObject {
896            subschemas: Some(Box::new(SubschemaValidation {
897                any_of: Some(::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
        [single, array.into()]))std::vec![single, array.into()]),
898                ..Default::default()
899            })),
900            ..Default::default()
901        }
902        .into()
903    }
904}
905
906impl<T, TA> JsonSchemaAs<Vec<T>> for OneOrMany<TA, PreferMany>
907where
908    TA: JsonSchemaAs<T>,
909{
910    fn schema_name() -> String {
911        ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("OneOrMany<{0}, PreferMany>",
                <WrapSchema<T, TA>>::schema_name()))
    })std::format!(
912            "OneOrMany<{}, PreferMany>",
913            <WrapSchema<T, TA>>::schema_name()
914        )
915    }
916
917    fn schema_id() -> Cow<'static, str> {
918        ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("serde_with::OneOrMany<{0}, PreferMany>",
                <WrapSchema<T, TA>>::schema_id()))
    })std::format!(
919            "serde_with::OneOrMany<{}, PreferMany>",
920            <WrapSchema<T, TA>>::schema_id()
921        )
922        .into()
923    }
924
925    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
926        let inner = gen.subschema_for::<WrapSchema<T, TA>>();
927        let single = SchemaObject {
928            metadata: Some(Box::new(Metadata {
929                write_only: true,
930                ..Default::default()
931            })),
932            subschemas: Some(Box::new(SubschemaValidation {
933                all_of: Some(::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
        [inner.clone()]))std::vec![inner.clone()]),
934                ..Default::default()
935            })),
936            ..Default::default()
937        };
938        let array = SchemaObject {
939            instance_type: Some(InstanceType::Array.into()),
940            array: Some(Box::new(ArrayValidation {
941                items: Some(Schema::from(single.clone()).into()),
942                ..Default::default()
943            })),
944            ..Default::default()
945        };
946
947        SchemaObject {
948            subschemas: Some(Box::new(SubschemaValidation {
949                any_of: Some(::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
        [single.into(), array.into()]))std::vec![single.into(), array.into()]),
950                ..Default::default()
951            })),
952            ..Default::default()
953        }
954        .into()
955    }
956}
957
958macro_rules! schema_for_pickfirst {
959    ($( $param:ident )+) => {
960        impl<T, $($param,)+> JsonSchemaAs<T> for PickFirst<($( $param, )+)>
961        where
962            $( $param: JsonSchemaAs<T>, )+
963        {
964            fn schema_name() -> String {
965                std::format!(
966                    concat!(
967                        "PickFirst(",
968                        $( "{", stringify!($param), "}", )+
969                        ")"
970                    ),
971                    $( $param = <WrapSchema<T, $param>>::schema_name(), )+
972                )
973            }
974
975            fn schema_id() -> Cow<'static, str> {
976                std::format!(
977                    concat!(
978                        "serde_with::PickFirst(",
979                        $( "{", stringify!($param), "}", )+
980                        ")"
981                    ),
982                    $( $param = <WrapSchema<T, $param>>::schema_id(), )+
983                )
984                .into()
985            }
986
987            fn json_schema(g: &mut SchemaGenerator) -> Schema {
988                let mut first = true;
989                let subschemas = std::vec![$(
990                    {
991                        let is_first = std::mem::replace(&mut first, false);
992                        let schema = g.subschema_for::<WrapSchema<T, $param>>();
993
994                        if !is_first {
995                            SchemaObject {
996                                metadata: Some(Box::new(Metadata {
997                                    write_only: true,
998                                    ..Default::default()
999                                })),
1000                                subschemas: Some(Box::new(SubschemaValidation {
1001                                    all_of: Some(std::vec![schema]),
1002                                    ..Default::default()
1003                                })),
1004                                ..Default::default()
1005                            }
1006                            .into()
1007                        } else {
1008                            schema
1009                        }
1010                    }
1011                ),+];
1012
1013                SchemaObject {
1014                    subschemas: Some(Box::new(SubschemaValidation {
1015                        any_of: Some(subschemas),
1016                        ..Default::default()
1017                    })),
1018                    ..Default::default()
1019                }
1020                .into()
1021            }
1022        }
1023    }
1024}
1025
1026impl<T, A> JsonSchemaAs<T> for PickFirst<(A,)> where A: JsonSchemaAs<T> {
    fn schema_name() -> String {
        ::alloc::__export::must_use({
                ::alloc::fmt::format(format_args!("PickFirst({0})",
                        <WrapSchema<T, A>>::schema_name()))
            })
    }
    fn schema_id() -> Cow<'static, str> {
        ::alloc::__export::must_use({
                    ::alloc::fmt::format(format_args!("serde_with::PickFirst({0})",
                            <WrapSchema<T, A>>::schema_id()))
                }).into()
    }
    fn json_schema(g: &mut SchemaGenerator) -> Schema {
        let mut first = true;
        let subschemas =
            ::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
                    [{
                                let is_first = std::mem::replace(&mut first, false);
                                let schema = g.subschema_for::<WrapSchema<T, A>>();
                                if !is_first {
                                    SchemaObject {
                                            metadata: Some(Box::new(Metadata {
                                                        write_only: true,
                                                        ..Default::default()
                                                    })),
                                            subschemas: Some(Box::new(SubschemaValidation {
                                                        all_of: Some(::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
                                                                    [schema]))),
                                                        ..Default::default()
                                                    })),
                                            ..Default::default()
                                        }.into()
                                } else { schema }
                            }]));
        SchemaObject {
                subschemas: Some(Box::new(SubschemaValidation {
                            any_of: Some(subschemas),
                            ..Default::default()
                        })),
                ..Default::default()
            }.into()
    }
}schema_for_pickfirst!(A);
1027impl<T, A, B> JsonSchemaAs<T> for PickFirst<(A, B)> where A: JsonSchemaAs<T>,
    B: JsonSchemaAs<T> {
    fn schema_name() -> String {
        ::alloc::__export::must_use({
                ::alloc::fmt::format(format_args!("PickFirst({0}{1})",
                        <WrapSchema<T, A>>::schema_name(),
                        <WrapSchema<T, B>>::schema_name()))
            })
    }
    fn schema_id() -> Cow<'static, str> {
        ::alloc::__export::must_use({
                    ::alloc::fmt::format(format_args!("serde_with::PickFirst({0}{1})",
                            <WrapSchema<T, A>>::schema_id(),
                            <WrapSchema<T, B>>::schema_id()))
                }).into()
    }
    fn json_schema(g: &mut SchemaGenerator) -> Schema {
        let mut first = true;
        let subschemas =
            ::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
                    [{
                                let is_first = std::mem::replace(&mut first, false);
                                let schema = g.subschema_for::<WrapSchema<T, A>>();
                                if !is_first {
                                    SchemaObject {
                                            metadata: Some(Box::new(Metadata {
                                                        write_only: true,
                                                        ..Default::default()
                                                    })),
                                            subschemas: Some(Box::new(SubschemaValidation {
                                                        all_of: Some(::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
                                                                    [schema]))),
                                                        ..Default::default()
                                                    })),
                                            ..Default::default()
                                        }.into()
                                } else { schema }
                            },
                            {
                                let is_first = std::mem::replace(&mut first, false);
                                let schema = g.subschema_for::<WrapSchema<T, B>>();
                                if !is_first {
                                    SchemaObject {
                                            metadata: Some(Box::new(Metadata {
                                                        write_only: true,
                                                        ..Default::default()
                                                    })),
                                            subschemas: Some(Box::new(SubschemaValidation {
                                                        all_of: Some(::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
                                                                    [schema]))),
                                                        ..Default::default()
                                                    })),
                                            ..Default::default()
                                        }.into()
                                } else { schema }
                            }]));
        SchemaObject {
                subschemas: Some(Box::new(SubschemaValidation {
                            any_of: Some(subschemas),
                            ..Default::default()
                        })),
                ..Default::default()
            }.into()
    }
}schema_for_pickfirst!(A B);
1028impl<T, A, B, C> JsonSchemaAs<T> for PickFirst<(A, B, C)> where
    A: JsonSchemaAs<T>, B: JsonSchemaAs<T>, C: JsonSchemaAs<T> {
    fn schema_name() -> String {
        ::alloc::__export::must_use({
                ::alloc::fmt::format(format_args!("PickFirst({0}{1}{2})",
                        <WrapSchema<T, A>>::schema_name(),
                        <WrapSchema<T, B>>::schema_name(),
                        <WrapSchema<T, C>>::schema_name()))
            })
    }
    fn schema_id() -> Cow<'static, str> {
        ::alloc::__export::must_use({
                    ::alloc::fmt::format(format_args!("serde_with::PickFirst({0}{1}{2})",
                            <WrapSchema<T, A>>::schema_id(),
                            <WrapSchema<T, B>>::schema_id(),
                            <WrapSchema<T, C>>::schema_id()))
                }).into()
    }
    fn json_schema(g: &mut SchemaGenerator) -> Schema {
        let mut first = true;
        let subschemas =
            ::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
                    [{
                                let is_first = std::mem::replace(&mut first, false);
                                let schema = g.subschema_for::<WrapSchema<T, A>>();
                                if !is_first {
                                    SchemaObject {
                                            metadata: Some(Box::new(Metadata {
                                                        write_only: true,
                                                        ..Default::default()
                                                    })),
                                            subschemas: Some(Box::new(SubschemaValidation {
                                                        all_of: Some(::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
                                                                    [schema]))),
                                                        ..Default::default()
                                                    })),
                                            ..Default::default()
                                        }.into()
                                } else { schema }
                            },
                            {
                                let is_first = std::mem::replace(&mut first, false);
                                let schema = g.subschema_for::<WrapSchema<T, B>>();
                                if !is_first {
                                    SchemaObject {
                                            metadata: Some(Box::new(Metadata {
                                                        write_only: true,
                                                        ..Default::default()
                                                    })),
                                            subschemas: Some(Box::new(SubschemaValidation {
                                                        all_of: Some(::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
                                                                    [schema]))),
                                                        ..Default::default()
                                                    })),
                                            ..Default::default()
                                        }.into()
                                } else { schema }
                            },
                            {
                                let is_first = std::mem::replace(&mut first, false);
                                let schema = g.subschema_for::<WrapSchema<T, C>>();
                                if !is_first {
                                    SchemaObject {
                                            metadata: Some(Box::new(Metadata {
                                                        write_only: true,
                                                        ..Default::default()
                                                    })),
                                            subschemas: Some(Box::new(SubschemaValidation {
                                                        all_of: Some(::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
                                                                    [schema]))),
                                                        ..Default::default()
                                                    })),
                                            ..Default::default()
                                        }.into()
                                } else { schema }
                            }]));
        SchemaObject {
                subschemas: Some(Box::new(SubschemaValidation {
                            any_of: Some(subschemas),
                            ..Default::default()
                        })),
                ..Default::default()
            }.into()
    }
}schema_for_pickfirst!(A B C);
1029impl<T, A, B, C, D> JsonSchemaAs<T> for PickFirst<(A, B, C, D)> where
    A: JsonSchemaAs<T>, B: JsonSchemaAs<T>, C: JsonSchemaAs<T>,
    D: JsonSchemaAs<T> {
    fn schema_name() -> String {
        ::alloc::__export::must_use({
                ::alloc::fmt::format(format_args!("PickFirst({0}{1}{2}{3})",
                        <WrapSchema<T, A>>::schema_name(),
                        <WrapSchema<T, B>>::schema_name(),
                        <WrapSchema<T, C>>::schema_name(),
                        <WrapSchema<T, D>>::schema_name()))
            })
    }
    fn schema_id() -> Cow<'static, str> {
        ::alloc::__export::must_use({
                    ::alloc::fmt::format(format_args!("serde_with::PickFirst({0}{1}{2}{3})",
                            <WrapSchema<T, A>>::schema_id(),
                            <WrapSchema<T, B>>::schema_id(),
                            <WrapSchema<T, C>>::schema_id(),
                            <WrapSchema<T, D>>::schema_id()))
                }).into()
    }
    fn json_schema(g: &mut SchemaGenerator) -> Schema {
        let mut first = true;
        let subschemas =
            ::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
                    [{
                                let is_first = std::mem::replace(&mut first, false);
                                let schema = g.subschema_for::<WrapSchema<T, A>>();
                                if !is_first {
                                    SchemaObject {
                                            metadata: Some(Box::new(Metadata {
                                                        write_only: true,
                                                        ..Default::default()
                                                    })),
                                            subschemas: Some(Box::new(SubschemaValidation {
                                                        all_of: Some(::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
                                                                    [schema]))),
                                                        ..Default::default()
                                                    })),
                                            ..Default::default()
                                        }.into()
                                } else { schema }
                            },
                            {
                                let is_first = std::mem::replace(&mut first, false);
                                let schema = g.subschema_for::<WrapSchema<T, B>>();
                                if !is_first {
                                    SchemaObject {
                                            metadata: Some(Box::new(Metadata {
                                                        write_only: true,
                                                        ..Default::default()
                                                    })),
                                            subschemas: Some(Box::new(SubschemaValidation {
                                                        all_of: Some(::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
                                                                    [schema]))),
                                                        ..Default::default()
                                                    })),
                                            ..Default::default()
                                        }.into()
                                } else { schema }
                            },
                            {
                                let is_first = std::mem::replace(&mut first, false);
                                let schema = g.subschema_for::<WrapSchema<T, C>>();
                                if !is_first {
                                    SchemaObject {
                                            metadata: Some(Box::new(Metadata {
                                                        write_only: true,
                                                        ..Default::default()
                                                    })),
                                            subschemas: Some(Box::new(SubschemaValidation {
                                                        all_of: Some(::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
                                                                    [schema]))),
                                                        ..Default::default()
                                                    })),
                                            ..Default::default()
                                        }.into()
                                } else { schema }
                            },
                            {
                                let is_first = std::mem::replace(&mut first, false);
                                let schema = g.subschema_for::<WrapSchema<T, D>>();
                                if !is_first {
                                    SchemaObject {
                                            metadata: Some(Box::new(Metadata {
                                                        write_only: true,
                                                        ..Default::default()
                                                    })),
                                            subschemas: Some(Box::new(SubschemaValidation {
                                                        all_of: Some(::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
                                                                    [schema]))),
                                                        ..Default::default()
                                                    })),
                                            ..Default::default()
                                        }.into()
                                } else { schema }
                            }]));
        SchemaObject {
                subschemas: Some(Box::new(SubschemaValidation {
                            any_of: Some(subschemas),
                            ..Default::default()
                        })),
                ..Default::default()
            }.into()
    }
}schema_for_pickfirst!(A B C D);
1030
1031macro_rules! map_first_last_wins_schema {
1032    ($(=> $extra:ident)? $type:ty) => {
1033        impl<V, $($extra,)? VA> JsonSchemaAs<$type> for SetLastValueWins<VA>
1034        where
1035            VA: JsonSchemaAs<V>,
1036        {
1037            fn schema_id() -> Cow<'static, str> {
1038                std::format!(
1039                    "serde_with::SetLastValueWins<{}>",
1040                    <WrapSchema<V, VA> as JsonSchema>::schema_id()
1041                )
1042                .into()
1043            }
1044
1045            fn schema_name() -> String {
1046                std::format!(
1047                    "SetLastValueWins<{}>",
1048                    <WrapSchema<V, VA> as JsonSchema>::schema_name()
1049                )
1050            }
1051
1052            fn json_schema(gen: &mut SchemaGenerator) -> Schema {
1053                let schema = <BTreeSet<WrapSchema<V, VA>> as JsonSchema>::json_schema(gen);
1054                let mut schema = schema.into_object();
1055
1056                // We explicitly allow duplicate items since the whole point of
1057                // SetLastValueWins is to take the duplicate value.
1058                if let Some(array) = &mut schema.array {
1059                    array.unique_items = None;
1060                }
1061
1062                schema.into()
1063            }
1064
1065            fn is_referenceable() -> bool {
1066                false
1067            }
1068        }
1069
1070        impl<V, $($extra,)? VA> JsonSchemaAs<$type> for SetPreventDuplicates<VA>
1071        where
1072            VA: JsonSchemaAs<V>,
1073        {
1074            forward_schema!(BTreeSet<WrapSchema<V, VA>>);
1075        }
1076    }
1077}
1078
1079impl<V, VA> JsonSchemaAs<BTreeSet<V>> for SetLastValueWins<VA> where
    VA: JsonSchemaAs<V> {
    fn schema_id() -> Cow<'static, str> {
        ::alloc::__export::must_use({
                    ::alloc::fmt::format(format_args!("serde_with::SetLastValueWins<{0}>",
                            <WrapSchema<V, VA> as JsonSchema>::schema_id()))
                }).into()
    }
    fn schema_name() -> String {
        ::alloc::__export::must_use({
                ::alloc::fmt::format(format_args!("SetLastValueWins<{0}>",
                        <WrapSchema<V, VA> as JsonSchema>::schema_name()))
            })
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        let schema =
            <BTreeSet<WrapSchema<V, VA>> as JsonSchema>::json_schema(gen);
        let mut schema = schema.into_object();
        if let Some(array) = &mut schema.array { array.unique_items = None; }
        schema.into()
    }
    fn is_referenceable() -> bool { false }
}
impl<V, VA> JsonSchemaAs<BTreeSet<V>> for SetPreventDuplicates<VA> where
    VA: JsonSchemaAs<V> {
    fn schema_name() -> String {
        <BTreeSet<WrapSchema<V, VA>> as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <BTreeSet<WrapSchema<V, VA>> as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <BTreeSet<WrapSchema<V, VA>> as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <BTreeSet<WrapSchema<V, VA>> as JsonSchema>::is_referenceable()
    }
}map_first_last_wins_schema!(BTreeSet<V>);
1080#[cfg(feature = "std")]
1081impl<V, S, VA> JsonSchemaAs<HashSet<V, S>> for SetLastValueWins<VA> where
    VA: JsonSchemaAs<V> {
    fn schema_id() -> Cow<'static, str> {
        ::alloc::__export::must_use({
                    ::alloc::fmt::format(format_args!("serde_with::SetLastValueWins<{0}>",
                            <WrapSchema<V, VA> as JsonSchema>::schema_id()))
                }).into()
    }
    fn schema_name() -> String {
        ::alloc::__export::must_use({
                ::alloc::fmt::format(format_args!("SetLastValueWins<{0}>",
                        <WrapSchema<V, VA> as JsonSchema>::schema_name()))
            })
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        let schema =
            <BTreeSet<WrapSchema<V, VA>> as JsonSchema>::json_schema(gen);
        let mut schema = schema.into_object();
        if let Some(array) = &mut schema.array { array.unique_items = None; }
        schema.into()
    }
    fn is_referenceable() -> bool { false }
}
impl<V, S, VA> JsonSchemaAs<HashSet<V, S>> for SetPreventDuplicates<VA> where
    VA: JsonSchemaAs<V> {
    fn schema_name() -> String {
        <BTreeSet<WrapSchema<V, VA>> as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <BTreeSet<WrapSchema<V, VA>> as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <BTreeSet<WrapSchema<V, VA>> as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <BTreeSet<WrapSchema<V, VA>> as JsonSchema>::is_referenceable()
    }
}map_first_last_wins_schema!(=> S HashSet<V, S>);
1082#[cfg(feature = "hashbrown_0_14")]
1083impl<V, S, VA> JsonSchemaAs<hashbrown_0_14::HashSet<V, S>> for
    SetLastValueWins<VA> where VA: JsonSchemaAs<V> {
    fn schema_id() -> Cow<'static, str> {
        ::alloc::__export::must_use({
                    ::alloc::fmt::format(format_args!("serde_with::SetLastValueWins<{0}>",
                            <WrapSchema<V, VA> as JsonSchema>::schema_id()))
                }).into()
    }
    fn schema_name() -> String {
        ::alloc::__export::must_use({
                ::alloc::fmt::format(format_args!("SetLastValueWins<{0}>",
                        <WrapSchema<V, VA> as JsonSchema>::schema_name()))
            })
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        let schema =
            <BTreeSet<WrapSchema<V, VA>> as JsonSchema>::json_schema(gen);
        let mut schema = schema.into_object();
        if let Some(array) = &mut schema.array { array.unique_items = None; }
        schema.into()
    }
    fn is_referenceable() -> bool { false }
}
impl<V, S, VA> JsonSchemaAs<hashbrown_0_14::HashSet<V, S>> for
    SetPreventDuplicates<VA> where VA: JsonSchemaAs<V> {
    fn schema_name() -> String {
        <BTreeSet<WrapSchema<V, VA>> as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <BTreeSet<WrapSchema<V, VA>> as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <BTreeSet<WrapSchema<V, VA>> as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <BTreeSet<WrapSchema<V, VA>> as JsonSchema>::is_referenceable()
    }
}map_first_last_wins_schema!(=> S hashbrown_0_14::HashSet<V, S>);
1084#[cfg(feature = "hashbrown_0_15")]
1085impl<V, S, VA> JsonSchemaAs<hashbrown_0_15::HashSet<V, S>> for
    SetLastValueWins<VA> where VA: JsonSchemaAs<V> {
    fn schema_id() -> Cow<'static, str> {
        ::alloc::__export::must_use({
                    ::alloc::fmt::format(format_args!("serde_with::SetLastValueWins<{0}>",
                            <WrapSchema<V, VA> as JsonSchema>::schema_id()))
                }).into()
    }
    fn schema_name() -> String {
        ::alloc::__export::must_use({
                ::alloc::fmt::format(format_args!("SetLastValueWins<{0}>",
                        <WrapSchema<V, VA> as JsonSchema>::schema_name()))
            })
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        let schema =
            <BTreeSet<WrapSchema<V, VA>> as JsonSchema>::json_schema(gen);
        let mut schema = schema.into_object();
        if let Some(array) = &mut schema.array { array.unique_items = None; }
        schema.into()
    }
    fn is_referenceable() -> bool { false }
}
impl<V, S, VA> JsonSchemaAs<hashbrown_0_15::HashSet<V, S>> for
    SetPreventDuplicates<VA> where VA: JsonSchemaAs<V> {
    fn schema_name() -> String {
        <BTreeSet<WrapSchema<V, VA>> as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <BTreeSet<WrapSchema<V, VA>> as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <BTreeSet<WrapSchema<V, VA>> as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <BTreeSet<WrapSchema<V, VA>> as JsonSchema>::is_referenceable()
    }
}map_first_last_wins_schema!(=> S hashbrown_0_15::HashSet<V, S>);
1086#[cfg(feature = "hashbrown_0_16")]
1087impl<V, S, VA> JsonSchemaAs<hashbrown_0_16::HashSet<V, S>> for
    SetLastValueWins<VA> where VA: JsonSchemaAs<V> {
    fn schema_id() -> Cow<'static, str> {
        ::alloc::__export::must_use({
                    ::alloc::fmt::format(format_args!("serde_with::SetLastValueWins<{0}>",
                            <WrapSchema<V, VA> as JsonSchema>::schema_id()))
                }).into()
    }
    fn schema_name() -> String {
        ::alloc::__export::must_use({
                ::alloc::fmt::format(format_args!("SetLastValueWins<{0}>",
                        <WrapSchema<V, VA> as JsonSchema>::schema_name()))
            })
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        let schema =
            <BTreeSet<WrapSchema<V, VA>> as JsonSchema>::json_schema(gen);
        let mut schema = schema.into_object();
        if let Some(array) = &mut schema.array { array.unique_items = None; }
        schema.into()
    }
    fn is_referenceable() -> bool { false }
}
impl<V, S, VA> JsonSchemaAs<hashbrown_0_16::HashSet<V, S>> for
    SetPreventDuplicates<VA> where VA: JsonSchemaAs<V> {
    fn schema_name() -> String {
        <BTreeSet<WrapSchema<V, VA>> as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <BTreeSet<WrapSchema<V, VA>> as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <BTreeSet<WrapSchema<V, VA>> as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <BTreeSet<WrapSchema<V, VA>> as JsonSchema>::is_referenceable()
    }
}map_first_last_wins_schema!(=> S hashbrown_0_16::HashSet<V, S>);
1088#[cfg(feature = "hashbrown_0_17")]
1089impl<V, S, VA> JsonSchemaAs<hashbrown_0_17::HashSet<V, S>> for
    SetLastValueWins<VA> where VA: JsonSchemaAs<V> {
    fn schema_id() -> Cow<'static, str> {
        ::alloc::__export::must_use({
                    ::alloc::fmt::format(format_args!("serde_with::SetLastValueWins<{0}>",
                            <WrapSchema<V, VA> as JsonSchema>::schema_id()))
                }).into()
    }
    fn schema_name() -> String {
        ::alloc::__export::must_use({
                ::alloc::fmt::format(format_args!("SetLastValueWins<{0}>",
                        <WrapSchema<V, VA> as JsonSchema>::schema_name()))
            })
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        let schema =
            <BTreeSet<WrapSchema<V, VA>> as JsonSchema>::json_schema(gen);
        let mut schema = schema.into_object();
        if let Some(array) = &mut schema.array { array.unique_items = None; }
        schema.into()
    }
    fn is_referenceable() -> bool { false }
}
impl<V, S, VA> JsonSchemaAs<hashbrown_0_17::HashSet<V, S>> for
    SetPreventDuplicates<VA> where VA: JsonSchemaAs<V> {
    fn schema_name() -> String {
        <BTreeSet<WrapSchema<V, VA>> as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <BTreeSet<WrapSchema<V, VA>> as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <BTreeSet<WrapSchema<V, VA>> as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <BTreeSet<WrapSchema<V, VA>> as JsonSchema>::is_referenceable()
    }
}map_first_last_wins_schema!(=> S hashbrown_0_17::HashSet<V, S>);
1090#[cfg(feature = "indexmap_1")]
1091impl<V, S, VA> JsonSchemaAs<indexmap_1::IndexSet<V, S>> for
    SetLastValueWins<VA> where VA: JsonSchemaAs<V> {
    fn schema_id() -> Cow<'static, str> {
        ::alloc::__export::must_use({
                    ::alloc::fmt::format(format_args!("serde_with::SetLastValueWins<{0}>",
                            <WrapSchema<V, VA> as JsonSchema>::schema_id()))
                }).into()
    }
    fn schema_name() -> String {
        ::alloc::__export::must_use({
                ::alloc::fmt::format(format_args!("SetLastValueWins<{0}>",
                        <WrapSchema<V, VA> as JsonSchema>::schema_name()))
            })
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        let schema =
            <BTreeSet<WrapSchema<V, VA>> as JsonSchema>::json_schema(gen);
        let mut schema = schema.into_object();
        if let Some(array) = &mut schema.array { array.unique_items = None; }
        schema.into()
    }
    fn is_referenceable() -> bool { false }
}
impl<V, S, VA> JsonSchemaAs<indexmap_1::IndexSet<V, S>> for
    SetPreventDuplicates<VA> where VA: JsonSchemaAs<V> {
    fn schema_name() -> String {
        <BTreeSet<WrapSchema<V, VA>> as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <BTreeSet<WrapSchema<V, VA>> as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <BTreeSet<WrapSchema<V, VA>> as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <BTreeSet<WrapSchema<V, VA>> as JsonSchema>::is_referenceable()
    }
}map_first_last_wins_schema!(=> S indexmap_1::IndexSet<V, S>);
1092#[cfg(feature = "indexmap_2")]
1093impl<V, S, VA> JsonSchemaAs<indexmap_2::IndexSet<V, S>> for
    SetLastValueWins<VA> where VA: JsonSchemaAs<V> {
    fn schema_id() -> Cow<'static, str> {
        ::alloc::__export::must_use({
                    ::alloc::fmt::format(format_args!("serde_with::SetLastValueWins<{0}>",
                            <WrapSchema<V, VA> as JsonSchema>::schema_id()))
                }).into()
    }
    fn schema_name() -> String {
        ::alloc::__export::must_use({
                ::alloc::fmt::format(format_args!("SetLastValueWins<{0}>",
                        <WrapSchema<V, VA> as JsonSchema>::schema_name()))
            })
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        let schema =
            <BTreeSet<WrapSchema<V, VA>> as JsonSchema>::json_schema(gen);
        let mut schema = schema.into_object();
        if let Some(array) = &mut schema.array { array.unique_items = None; }
        schema.into()
    }
    fn is_referenceable() -> bool { false }
}
impl<V, S, VA> JsonSchemaAs<indexmap_2::IndexSet<V, S>> for
    SetPreventDuplicates<VA> where VA: JsonSchemaAs<V> {
    fn schema_name() -> String {
        <BTreeSet<WrapSchema<V, VA>> as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <BTreeSet<WrapSchema<V, VA>> as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <BTreeSet<WrapSchema<V, VA>> as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <BTreeSet<WrapSchema<V, VA>> as JsonSchema>::is_referenceable()
    }
}map_first_last_wins_schema!(=> S indexmap_2::IndexSet<V, S>);
1094
1095impl<SEP, T, TA> JsonSchemaAs<T> for StringWithSeparator<SEP, TA>
1096where
1097    SEP: Separator,
1098{
1099    String
<String as JsonSchema>::schema_name();
Cow<'static, str>
<String as JsonSchema>::schema_id();
&mut SchemaGenerator
gen
Schema
<String as JsonSchema>::json_schema(gen);
bool
<String as JsonSchema>::is_referenceable();forward_schema!(String);
1100}
1101
1102impl<T, TA> JsonSchemaAs<Vec<T>> for VecSkipError<TA>
1103where
1104    TA: JsonSchemaAs<T>,
1105{
1106    String
<Vec<WrapSchema<T, TA>> as JsonSchema>::schema_name();
Cow<'static, str>
<Vec<WrapSchema<T, TA>> as JsonSchema>::schema_id();
&mut SchemaGenerator
gen
Schema
<Vec<WrapSchema<T, TA>> as JsonSchema>::json_schema(gen);
bool
<Vec<WrapSchema<T, TA>> as JsonSchema>::is_referenceable();forward_schema!(Vec<WrapSchema<T, TA>>);
1107}
1108
1109mod timespan {
1110    use super::*;
1111
1112    // #[non_exhaustive] is not actually necessary here but it should
1113    // help avoid warnings about semver breakage if this ever changes.
1114    #[non_exhaustive]
1115    pub enum TimespanTargetType {
1116        String,
1117        F64,
1118        U64,
1119        I64,
1120    }
1121
1122    /// Internal helper trait used to constrain which types we implement
1123    /// `JsonSchemaAs<T>` for.
1124    pub trait TimespanSchemaTarget<F> {
1125        /// The underlying type.
1126        ///
1127        /// This is mainly used to decide which variant of the resulting schema
1128        /// should be marked as `write_only: true`.
1129        const TYPE: TimespanTargetType;
1130
1131        /// Whether the target type is signed.
1132        ///
1133        /// This is only true for `std::time::Duration`.
1134        const SIGNED: bool = true;
1135    }
1136
1137    macro_rules! timespan_type_of {
1138        (String) => {
1139            TimespanTargetType::String
1140        };
1141        (f64) => {
1142            TimespanTargetType::F64
1143        };
1144        (i64) => {
1145            TimespanTargetType::I64
1146        };
1147        (u64) => {
1148            TimespanTargetType::U64
1149        };
1150    }
1151
1152    macro_rules! declare_timespan_target {
1153        ( $target:ty { $($format:ident),* $(,)? } ) => {
1154            $(
1155                impl TimespanSchemaTarget<$format> for $target {
1156                    const TYPE: TimespanTargetType = timespan_type_of!($format);
1157                }
1158            )*
1159        }
1160    }
1161
1162    impl TimespanSchemaTarget<u64> for Duration {
1163        const TYPE: TimespanTargetType = TimespanTargetType::U64;
1164        const SIGNED: bool = false;
1165    }
1166
1167    impl TimespanSchemaTarget<f64> for Duration {
1168        const TYPE: TimespanTargetType = TimespanTargetType::F64;
1169        const SIGNED: bool = false;
1170    }
1171
1172    impl TimespanSchemaTarget<String> for Duration {
1173        const TYPE: TimespanTargetType = TimespanTargetType::String;
1174        const SIGNED: bool = false;
1175    }
1176
1177    impl TimespanSchemaTarget<String> for SystemTime {
    const TYPE: TimespanTargetType = TimespanTargetType::String;
}declare_timespan_target!(SystemTime { i64, f64, String });
1178
1179    #[cfg(feature = "chrono_0_4")]
1180    impl TimespanSchemaTarget<String> for ::chrono_0_4::Duration {
    const TYPE: TimespanTargetType = TimespanTargetType::String;
}declare_timespan_target!(::chrono_0_4::Duration { i64, f64, String });
1181    #[cfg(feature = "chrono_0_4")]
1182    impl TimespanSchemaTarget<String> for
    ::chrono_0_4::DateTime<::chrono_0_4::Utc> {
    const TYPE: TimespanTargetType = TimespanTargetType::String;
}declare_timespan_target!(::chrono_0_4::DateTime<::chrono_0_4::Utc> { i64, f64, String });
1183    #[cfg(feature = "chrono_0_4")]
1184    impl TimespanSchemaTarget<String> for
    ::chrono_0_4::DateTime<::chrono_0_4::Local> {
    const TYPE: TimespanTargetType = TimespanTargetType::String;
}declare_timespan_target!(::chrono_0_4::DateTime<::chrono_0_4::Local> { i64, f64, String });
1185    #[cfg(feature = "chrono_0_4")]
1186    impl TimespanSchemaTarget<String> for ::chrono_0_4::NaiveDateTime {
    const TYPE: TimespanTargetType = TimespanTargetType::String;
}declare_timespan_target!(::chrono_0_4::NaiveDateTime { i64, f64, String });
1187
1188    #[cfg(feature = "time_0_3")]
1189    impl TimespanSchemaTarget<String> for ::time_0_3::Duration {
    const TYPE: TimespanTargetType = TimespanTargetType::String;
}declare_timespan_target!(::time_0_3::Duration { i64, f64, String });
1190    #[cfg(feature = "time_0_3")]
1191    impl TimespanSchemaTarget<String> for ::time_0_3::OffsetDateTime {
    const TYPE: TimespanTargetType = TimespanTargetType::String;
}declare_timespan_target!(::time_0_3::OffsetDateTime { i64, f64, String });
1192    #[cfg(feature = "time_0_3")]
1193    impl TimespanSchemaTarget<String> for ::time_0_3::PrimitiveDateTime {
    const TYPE: TimespanTargetType = TimespanTargetType::String;
}declare_timespan_target!(::time_0_3::PrimitiveDateTime { i64, f64, String });
1194}
1195
1196use self::timespan::{TimespanSchemaTarget, TimespanTargetType};
1197
1198/// Internal type used for the base impls on `DurationXXX` and `TimestampYYY` types.
1199///
1200/// This allows the `JsonSchema` impls that are Strict to be generic without
1201/// committing to it as part of the public API.
1202struct Timespan<Format, Strictness>(PhantomData<(Format, Strictness)>);
1203
1204impl<T, F> JsonSchemaAs<T> for Timespan<F, Strict>
1205where
1206    T: TimespanSchemaTarget<F>,
1207    F: Format + JsonSchema,
1208{
1209    String
<F as JsonSchema>::schema_name();
Cow<'static, str>
<F as JsonSchema>::schema_id();
&mut SchemaGenerator
gen
Schema
<F as JsonSchema>::json_schema(gen);
bool
<F as JsonSchema>::is_referenceable();forward_schema!(F);
1210}
1211
1212impl TimespanTargetType {
1213    pub(crate) fn into_flexible_schema(self, signed: bool) -> Schema {
1214        use ::schemars_0_8::schema::StringValidation;
1215
1216        let mut number = SchemaObject {
1217            instance_type: Some(InstanceType::Number.into()),
1218            number: (!signed).then(|| {
1219                Box::new(NumberValidation {
1220                    minimum: Some(0.0),
1221                    ..Default::default()
1222                })
1223            }),
1224            ..Default::default()
1225        };
1226
1227        // This is a more lenient version of the regex used to determine
1228        // whether JSON numbers are valid. Specifically, it allows multiple
1229        // leading zeroes whereas that is illegal in JSON.
1230        let regex = r#"[0-9]+(\.[0-9]+)?([eE][+-]?[0-9]+)?"#;
1231        let mut string = SchemaObject {
1232            instance_type: Some(InstanceType::String.into()),
1233            string: Some(Box::new(StringValidation {
1234                pattern: Some(match signed {
1235                    true => ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("^-?{0}$", regex))
    })std::format!("^-?{regex}$"),
1236                    false => ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("^{0}$", regex))
    })std::format!("^{regex}$"),
1237                }),
1238                ..Default::default()
1239            })),
1240            ..Default::default()
1241        };
1242
1243        if #[allow(non_exhaustive_omitted_patterns)] match self {
    Self::String => true,
    _ => false,
}matches!(self, Self::String) {
1244            number.metadata().write_only = true;
1245        } else {
1246            string.metadata().write_only = true;
1247        }
1248
1249        SchemaObject {
1250            subschemas: Some(Box::new(SubschemaValidation {
1251                one_of: Some(::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
        [number.into(), string.into()]))std::vec![number.into(), string.into()]),
1252                ..Default::default()
1253            })),
1254            ..Default::default()
1255        }
1256        .into()
1257    }
1258
1259    pub(crate) fn schema_id(self) -> &'static str {
1260        match self {
1261            Self::String => "serde_with::FlexibleStringTimespan",
1262            Self::F64 => "serde_with::FlexibleF64Timespan",
1263            Self::U64 => "serde_with::FlexibleU64Timespan",
1264            Self::I64 => "serde_with::FlexibleI64Timespan",
1265        }
1266    }
1267}
1268
1269impl<T, F> JsonSchemaAs<T> for Timespan<F, Flexible>
1270where
1271    T: TimespanSchemaTarget<F>,
1272    F: Format + JsonSchema,
1273{
1274    fn schema_name() -> String {
1275        <T as TimespanSchemaTarget<F>>::TYPE
1276            .schema_id()
1277            .strip_prefix("serde_with::")
1278            .expect("schema id did not start with `serde_with::` - this is a bug")
1279            .into()
1280    }
1281
1282    fn schema_id() -> Cow<'static, str> {
1283        <T as TimespanSchemaTarget<F>>::TYPE.schema_id().into()
1284    }
1285
1286    fn json_schema(_: &mut SchemaGenerator) -> Schema {
1287        <T as TimespanSchemaTarget<F>>::TYPE
1288            .into_flexible_schema(<T as TimespanSchemaTarget<F>>::SIGNED)
1289    }
1290
1291    fn is_referenceable() -> bool {
1292        false
1293    }
1294}
1295
1296macro_rules! forward_duration_schema {
1297    ($ty:ident) => {
1298        impl<T, F> JsonSchemaAs<T> for $ty<F, Strict>
1299        where
1300            T: TimespanSchemaTarget<F>,
1301            F: Format + JsonSchema
1302        {
1303            forward_schema!(WrapSchema<T, Timespan<F, Strict>>);
1304        }
1305
1306        impl<T, F> JsonSchemaAs<T> for $ty<F, Flexible>
1307        where
1308            T: TimespanSchemaTarget<F>,
1309            F: Format + JsonSchema
1310        {
1311            forward_schema!(WrapSchema<T, Timespan<F, Flexible>>);
1312        }
1313    };
1314}
1315
1316impl<T, F> JsonSchemaAs<T> for DurationSeconds<F, Strict> where
    T: TimespanSchemaTarget<F>, F: Format + JsonSchema {
    fn schema_name() -> String {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::is_referenceable()
    }
}
impl<T, F> JsonSchemaAs<T> for DurationSeconds<F, Flexible> where
    T: TimespanSchemaTarget<F>, F: Format + JsonSchema {
    fn schema_name() -> String {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <WrapSchema<T, Timespan<F, Flexible>> as
                JsonSchema>::is_referenceable()
    }
}forward_duration_schema!(DurationSeconds);
1317impl<T, F> JsonSchemaAs<T> for DurationMilliSeconds<F, Strict> where
    T: TimespanSchemaTarget<F>, F: Format + JsonSchema {
    fn schema_name() -> String {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::is_referenceable()
    }
}
impl<T, F> JsonSchemaAs<T> for DurationMilliSeconds<F, Flexible> where
    T: TimespanSchemaTarget<F>, F: Format + JsonSchema {
    fn schema_name() -> String {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <WrapSchema<T, Timespan<F, Flexible>> as
                JsonSchema>::is_referenceable()
    }
}forward_duration_schema!(DurationMilliSeconds);
1318impl<T, F> JsonSchemaAs<T> for DurationMicroSeconds<F, Strict> where
    T: TimespanSchemaTarget<F>, F: Format + JsonSchema {
    fn schema_name() -> String {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::is_referenceable()
    }
}
impl<T, F> JsonSchemaAs<T> for DurationMicroSeconds<F, Flexible> where
    T: TimespanSchemaTarget<F>, F: Format + JsonSchema {
    fn schema_name() -> String {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <WrapSchema<T, Timespan<F, Flexible>> as
                JsonSchema>::is_referenceable()
    }
}forward_duration_schema!(DurationMicroSeconds);
1319impl<T, F> JsonSchemaAs<T> for DurationNanoSeconds<F, Strict> where
    T: TimespanSchemaTarget<F>, F: Format + JsonSchema {
    fn schema_name() -> String {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::is_referenceable()
    }
}
impl<T, F> JsonSchemaAs<T> for DurationNanoSeconds<F, Flexible> where
    T: TimespanSchemaTarget<F>, F: Format + JsonSchema {
    fn schema_name() -> String {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <WrapSchema<T, Timespan<F, Flexible>> as
                JsonSchema>::is_referenceable()
    }
}forward_duration_schema!(DurationNanoSeconds);
1320
1321impl<T, F> JsonSchemaAs<T> for DurationSecondsWithFrac<F, Strict> where
    T: TimespanSchemaTarget<F>, F: Format + JsonSchema {
    fn schema_name() -> String {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::is_referenceable()
    }
}
impl<T, F> JsonSchemaAs<T> for DurationSecondsWithFrac<F, Flexible> where
    T: TimespanSchemaTarget<F>, F: Format + JsonSchema {
    fn schema_name() -> String {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <WrapSchema<T, Timespan<F, Flexible>> as
                JsonSchema>::is_referenceable()
    }
}forward_duration_schema!(DurationSecondsWithFrac);
1322impl<T, F> JsonSchemaAs<T> for DurationMilliSecondsWithFrac<F, Strict> where
    T: TimespanSchemaTarget<F>, F: Format + JsonSchema {
    fn schema_name() -> String {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::is_referenceable()
    }
}
impl<T, F> JsonSchemaAs<T> for DurationMilliSecondsWithFrac<F, Flexible> where
    T: TimespanSchemaTarget<F>, F: Format + JsonSchema {
    fn schema_name() -> String {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <WrapSchema<T, Timespan<F, Flexible>> as
                JsonSchema>::is_referenceable()
    }
}forward_duration_schema!(DurationMilliSecondsWithFrac);
1323impl<T, F> JsonSchemaAs<T> for DurationMicroSecondsWithFrac<F, Strict> where
    T: TimespanSchemaTarget<F>, F: Format + JsonSchema {
    fn schema_name() -> String {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::is_referenceable()
    }
}
impl<T, F> JsonSchemaAs<T> for DurationMicroSecondsWithFrac<F, Flexible> where
    T: TimespanSchemaTarget<F>, F: Format + JsonSchema {
    fn schema_name() -> String {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <WrapSchema<T, Timespan<F, Flexible>> as
                JsonSchema>::is_referenceable()
    }
}forward_duration_schema!(DurationMicroSecondsWithFrac);
1324impl<T, F> JsonSchemaAs<T> for DurationNanoSecondsWithFrac<F, Strict> where
    T: TimespanSchemaTarget<F>, F: Format + JsonSchema {
    fn schema_name() -> String {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::is_referenceable()
    }
}
impl<T, F> JsonSchemaAs<T> for DurationNanoSecondsWithFrac<F, Flexible> where
    T: TimespanSchemaTarget<F>, F: Format + JsonSchema {
    fn schema_name() -> String {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <WrapSchema<T, Timespan<F, Flexible>> as
                JsonSchema>::is_referenceable()
    }
}forward_duration_schema!(DurationNanoSecondsWithFrac);
1325
1326impl<T, F> JsonSchemaAs<T> for TimestampSeconds<F, Strict> where
    T: TimespanSchemaTarget<F>, F: Format + JsonSchema {
    fn schema_name() -> String {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::is_referenceable()
    }
}
impl<T, F> JsonSchemaAs<T> for TimestampSeconds<F, Flexible> where
    T: TimespanSchemaTarget<F>, F: Format + JsonSchema {
    fn schema_name() -> String {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <WrapSchema<T, Timespan<F, Flexible>> as
                JsonSchema>::is_referenceable()
    }
}forward_duration_schema!(TimestampSeconds);
1327impl<T, F> JsonSchemaAs<T> for TimestampMilliSeconds<F, Strict> where
    T: TimespanSchemaTarget<F>, F: Format + JsonSchema {
    fn schema_name() -> String {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::is_referenceable()
    }
}
impl<T, F> JsonSchemaAs<T> for TimestampMilliSeconds<F, Flexible> where
    T: TimespanSchemaTarget<F>, F: Format + JsonSchema {
    fn schema_name() -> String {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <WrapSchema<T, Timespan<F, Flexible>> as
                JsonSchema>::is_referenceable()
    }
}forward_duration_schema!(TimestampMilliSeconds);
1328impl<T, F> JsonSchemaAs<T> for TimestampMicroSeconds<F, Strict> where
    T: TimespanSchemaTarget<F>, F: Format + JsonSchema {
    fn schema_name() -> String {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::is_referenceable()
    }
}
impl<T, F> JsonSchemaAs<T> for TimestampMicroSeconds<F, Flexible> where
    T: TimespanSchemaTarget<F>, F: Format + JsonSchema {
    fn schema_name() -> String {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <WrapSchema<T, Timespan<F, Flexible>> as
                JsonSchema>::is_referenceable()
    }
}forward_duration_schema!(TimestampMicroSeconds);
1329impl<T, F> JsonSchemaAs<T> for TimestampNanoSeconds<F, Strict> where
    T: TimespanSchemaTarget<F>, F: Format + JsonSchema {
    fn schema_name() -> String {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::is_referenceable()
    }
}
impl<T, F> JsonSchemaAs<T> for TimestampNanoSeconds<F, Flexible> where
    T: TimespanSchemaTarget<F>, F: Format + JsonSchema {
    fn schema_name() -> String {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <WrapSchema<T, Timespan<F, Flexible>> as
                JsonSchema>::is_referenceable()
    }
}forward_duration_schema!(TimestampNanoSeconds);
1330
1331impl<T, F> JsonSchemaAs<T> for TimestampSecondsWithFrac<F, Strict> where
    T: TimespanSchemaTarget<F>, F: Format + JsonSchema {
    fn schema_name() -> String {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::is_referenceable()
    }
}
impl<T, F> JsonSchemaAs<T> for TimestampSecondsWithFrac<F, Flexible> where
    T: TimespanSchemaTarget<F>, F: Format + JsonSchema {
    fn schema_name() -> String {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <WrapSchema<T, Timespan<F, Flexible>> as
                JsonSchema>::is_referenceable()
    }
}forward_duration_schema!(TimestampSecondsWithFrac);
1332impl<T, F> JsonSchemaAs<T> for TimestampMilliSecondsWithFrac<F, Strict> where
    T: TimespanSchemaTarget<F>, F: Format + JsonSchema {
    fn schema_name() -> String {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::is_referenceable()
    }
}
impl<T, F> JsonSchemaAs<T> for TimestampMilliSecondsWithFrac<F, Flexible>
    where T: TimespanSchemaTarget<F>, F: Format + JsonSchema {
    fn schema_name() -> String {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <WrapSchema<T, Timespan<F, Flexible>> as
                JsonSchema>::is_referenceable()
    }
}forward_duration_schema!(TimestampMilliSecondsWithFrac);
1333impl<T, F> JsonSchemaAs<T> for TimestampMicroSecondsWithFrac<F, Strict> where
    T: TimespanSchemaTarget<F>, F: Format + JsonSchema {
    fn schema_name() -> String {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::is_referenceable()
    }
}
impl<T, F> JsonSchemaAs<T> for TimestampMicroSecondsWithFrac<F, Flexible>
    where T: TimespanSchemaTarget<F>, F: Format + JsonSchema {
    fn schema_name() -> String {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <WrapSchema<T, Timespan<F, Flexible>> as
                JsonSchema>::is_referenceable()
    }
}forward_duration_schema!(TimestampMicroSecondsWithFrac);
1334impl<T, F> JsonSchemaAs<T> for TimestampNanoSecondsWithFrac<F, Strict> where
    T: TimespanSchemaTarget<F>, F: Format + JsonSchema {
    fn schema_name() -> String {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <WrapSchema<T, Timespan<F, Strict>> as JsonSchema>::is_referenceable()
    }
}
impl<T, F> JsonSchemaAs<T> for TimestampNanoSecondsWithFrac<F, Flexible> where
    T: TimespanSchemaTarget<F>, F: Format + JsonSchema {
    fn schema_name() -> String {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::schema_name()
    }
    fn schema_id() -> Cow<'static, str> {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::schema_id()
    }
    fn json_schema(gen: &mut SchemaGenerator) -> Schema {
        <WrapSchema<T, Timespan<F, Flexible>> as JsonSchema>::json_schema(gen)
    }
    fn is_referenceable() -> bool {
        <WrapSchema<T, Timespan<F, Flexible>> as
                JsonSchema>::is_referenceable()
    }
}forward_duration_schema!(TimestampNanoSecondsWithFrac);
1335
1336#[cfg(feature = "json")]
1337impl<T> JsonSchemaAs<T> for json::JsonString {
1338    String
<String as JsonSchema>::schema_name();
Cow<'static, str>
<String as JsonSchema>::schema_id();
&mut SchemaGenerator
gen
Schema
<String as JsonSchema>::json_schema(gen);
bool
<String as JsonSchema>::is_referenceable();forward_schema!(String);
1339}