1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//! [`ResponseSchema`] — newtype wrapper around [`schemars::Schema`]
//! that delegates its `JsonSchema` impl to [`serde_json::Value`].
//!
//! Every cli `*-schema` leaf subcommand emits a JSON Schema document
//! as its response. The wire shape is opaque JSON — any valid schema
//! is acceptable. Typing the response as `schemars::Schema` directly
//! makes that wire shape strongly typed, but `schemars::Schema`'s own
//! JsonSchema impl emits `{"type": ["object", "boolean"]}` (because
//! the JSON Schema spec says a (sub)schema can be either an object or
//! a bare boolean). That type array trips the
//! `no_type_arrays_outside_properties` builder property test.
//!
//! The orphan rule prevents us from `impl JsonSchema for schemars::Schema`
//! directly. This wrapper provides the same in-process typing
//! (a `schemars::Schema` inside) while overriding the JsonSchema impl
//! to behave exactly like `serde_json::Value` (no constraints, no
//! type array). Serialization is transparent — the wire shape is
//! identical to `schemars::Schema`'s.
use schema_override;
;