1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//! schemars `>=0.9, <1`: a two-way bridge between `vld` and `schemars`.
//!
//! - **vld → schemars**: [`impl_json_schema!`] implements `schemars::JsonSchema`
//! from a vld type's `json_schema()`; nested `vld::nested!` types are added to
//! the generator's definitions, with `$ref`s pointing at its definitions
//! path, and an OpenAPI 3.0 generator gets OpenAPI 3.0 schemas.
//! - **schemars → vld**: [`impl_vld_parse!`] validates a `schemars::JsonSchema`
//! type against its schema ([`validate_with_schema`]) and implements
//! `vld::schema::VldParse`, so it works with vld extractors.
//!
//! The selected schemars is re-exported as [`schemars`]; the
//! version-independent items of [`crate::validator`] are re-exported here.
//!
//! **aide**: aide generates OpenAPI from `schemars::JsonSchema`, so
//! `impl_json_schema!` makes a vld type usable in `aide::axum::Json<T>` and
//! friends (nested types land under aide's `#/components/schemas/`). Pick the
//! module of the schemars major your aide uses (`cargo tree -i schemars`):
//! aide 0.15 builds on schemars 0.9: aide 0.15 users use this module.
//!
//! ```rust
//! use vld_openapi::schemars0::prelude::*;
//! use vld_openapi::schemars0::schemars;
//! ```
//!
//! Guide: <https://s00d.github.io/vld/integrations/openapi/schemars>
pub use schemars0 as schemars;
pub use vld;
// Each major compiles the shared implementation against its own alias.
pub use *;
/// Implement `schemars::JsonSchema` for a type with a `json_schema()`
/// associated function (`vld::schema!`, `#[derive(Validate)]`):
/// `impl_json_schema!(T)` or `impl_json_schema!(T, "SchemaName")`. See the
/// [module docs](self).
pub use crate__schemars0_impl_json_schema as impl_json_schema;
/// Implement `vld::schema::VldParse` and [`SchemarsValidate`] for a type that
/// derives `schemars::JsonSchema`, `serde::Serialize` and `serde::Deserialize`:
/// `impl_vld_parse!(T)`. The value is validated against the type's schemars
/// schema, then deserialized. See the [module docs](self).
pub use crate__schemars0_impl_vld_parse as impl_vld_parse;