significantly simplified the validator and work continues on query

This commit is contained in:
2026-03-03 17:58:31 -05:00
parent 3898c43742
commit e7f20e2cb6
58 changed files with 5446 additions and 5693 deletions

View File

@ -8,17 +8,16 @@ pub use context::ValidationContext;
pub use error::ValidationError;
pub use result::ValidationResult;
use crate::database::schema::Schema;
use serde_json::Value;
use std::collections::HashSet;
use std::collections::HashMap;
use std::sync::Arc;
pub struct Validator {
pub schemas: std::sync::Arc<std::collections::HashMap<String, crate::database::schema::Schema>>,
pub schemas: Arc<HashMap<String, Schema>>,
}
impl Validator {
pub fn new(
schemas: std::sync::Arc<std::collections::HashMap<String, crate::database::schema::Schema>>,
) -> Self {
pub fn new(schemas: Arc<HashMap<String, Schema>>) -> Self {
Self { schemas }
}
@ -50,7 +49,15 @@ impl Validator {
instance: &Value,
) -> Result<ValidationResult, ValidationError> {
if let Some(schema) = self.schemas.get(schema_id) {
let ctx = ValidationContext::new(&self.schemas, schema, schema, instance, false, false);
let ctx = ValidationContext::new(
&self.schemas,
schema,
schema,
instance,
std::collections::HashSet::new(),
false,
false,
);
ctx.validate_scoped()
} else {
Err(ValidationError {