Skip to main content

Crate vld_openapi

Crate vld_openapi 

Source
Expand description

§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.

modulefeaturewhat it does
utoipa5 / utoipa6utoipa-5 / utoipa-6impl_to_schema!: utoipa ToSchema / IntoParams from a vld type
schemars0 / schemars1schemars-0 / schemars-1impl_json_schema! (vld → schemars::JsonSchema, also for aide) and impl_vld_parse! (schemars type → vld validation)
validatoralwaysvalidate JSON against a JSON Schema, inspect and combine schemas, to_openapi3
vld-openapi = { version = "0.8", features = ["utoipa-5"] }
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

Re-exports§

pub use vld;

Modules§

schemars0schemars-0
schemars >=0.9, <1: a two-way bridge between vld and schemars.
schemars1schemars-1
schemars >=1, <2: a two-way bridge between vld and schemars.
utoipa5utoipa-5
utoipa 5: vld schemas as utoipa OpenAPI types.
utoipa6utoipa-6
utoipa 6: vld schemas as utoipa OpenAPI types.
validator
Version-independent JSON Schema tools: validate a JSON value against a JSON Schema, inspect and combine schemas, rewrite a 2020-12 schema into the OpenAPI 3.0 dialect. No schemars dependency; the schemars modules re-export every item.