Expand description
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.
use vld_openapi::validator::*;
let schema = serde_json::json!({
"type": "object",
"required": ["name"],
"properties": { "name": { "type": "string", "minLength": 1 } }
});
assert!(validate_with_schema(&schema, &serde_json::json!({"name": "Alice"})).is_ok());
assert!(is_required(&schema, "name"));
assert_eq!(list_properties(&schema)[0].name, "name");Structs§
- Property
Info - Information about a single property in a JSON Schema object.
Enums§
- VldSchemars
Error - Error returned by schemars → vld validation.
Functions§
- get_
property - Get the property schema for a specific field.
- is_
required - Check if a field is required in a JSON Schema.
- list_
properties - Extract property information from a JSON Schema object.
- overlay_
constraints - Overlay additional constraints from one schema onto another.
- schema_
type - Get the “type” field from a JSON Schema.
- schemas_
equal - Check if two JSON Schema values are structurally equal.
- to_
openapi3 - Rewrite vld’s JSON Schema (2020-12) into the OpenAPI 3.0 dialect, applied
when the generator uses
SchemaSettings::openapi3(): - validate_
with_ schema - Validate a
serde_json::Valueagainst a JSON Schema.