1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//! # vld-openapi — `vld` schemas in OpenAPI tools
//!
//! One module per integration, each behind its feature (none is on by
//! default). The majors of one dependency are additive: any set of features
//! compiles together.
//!
//! | module | feature | what it does |
//! |---|---|---|
//! | [`utoipa5`] / [`utoipa6`] | `utoipa-5` / `utoipa-6` | `impl_to_schema!`: utoipa `ToSchema` / `IntoParams` from a vld type |
//! | [`schemars0`] / [`schemars1`] | `schemars-0` / `schemars-1` | `impl_json_schema!` (vld → `schemars::JsonSchema`, also for aide) and `impl_vld_parse!` (schemars type → vld validation) |
//! | [`validator`] | always | validate JSON against a JSON Schema, inspect and combine schemas, `to_openapi3` |
//!
//! ```toml
//! vld-openapi = { version = "0.8", features = ["utoipa-5"] }
//! ```
//!
//! ```rust
//! let schema = serde_json::json!({"type": "string", "minLength": 2});
//! assert!(vld_openapi::validator::validate_with_schema(&schema, &"hi".into()).is_ok());
//! assert!(vld_openapi::validator::validate_with_schema(&schema, &"h".into()).is_err());
//! ```
//!
//! Guide: <https://s00d.github.io/vld/integrations/openapi/utoipa>
pub use vld;
/// Fallback for types without nested vld schemas: the inherent
/// `__vld_nested_schemas` of `vld::schema!` / derive types wins over this
/// trait method in `<T>::f()` path resolution.