pub fn validate_json_schema_value(
parameters: &Value,
) -> Result<(), ValidationError>Available on crate feature
toolkits only.Expand description
Validate a parsed JSON Schema value.
With the toolkits feature enabled this performs meta-schema validation;
otherwise it requires an object or boolean schema.
§Errors
"invalid_json_schema"- The JSON value is not a valid JSON Schema
§Examples
use zai_rs::model::model_validate::validate_json_schema_value;
use serde_json::json;
// Valid JSON Schema
let valid_schema = json!({
"type": "object",
"properties": {
"name": {"type": "string"}
}
});
assert!(validate_json_schema_value(&valid_schema).is_ok());
// Invalid JSON Schema
let invalid_schema = json!({"type": "invalid_type"});
assert!(validate_json_schema_value(&invalid_schema).is_err());