significantly simplified the validator and work continues on query
This commit is contained in:
@ -39,22 +39,31 @@ impl<'a> ValidationContext<'a> {
|
||||
&self,
|
||||
result: &mut ValidationResult,
|
||||
) -> Result<bool, ValidationError> {
|
||||
// 1. Core $ref logic fully transitioned to memory pointer resolutions.
|
||||
if let Some(_ref_str) = &self.schema.ref_string {
|
||||
if let Some(global_schema) = &self.schema.compiled_ref {
|
||||
// 1. Core $ref logic relies on the fast O(1) map to allow cycles and proper nesting
|
||||
if let Some(ref_str) = &self.schema.ref_string {
|
||||
if let Some(global_schema) = self.schemas.get(ref_str) {
|
||||
let mut new_overrides = self.overrides.clone();
|
||||
if let Some(props) = &self.schema.properties {
|
||||
new_overrides.extend(props.keys().map(|k| k.to_string()));
|
||||
}
|
||||
|
||||
let mut shadow = self.derive(
|
||||
global_schema,
|
||||
self.instance,
|
||||
&self.path,
|
||||
new_overrides,
|
||||
self.extensible,
|
||||
false,
|
||||
true,
|
||||
);
|
||||
shadow.root = global_schema;
|
||||
result.merge(shadow.validate()?);
|
||||
} else {
|
||||
result.errors.push(ValidationError {
|
||||
code: "REF_RESOLUTION_FAILED".to_string(),
|
||||
message: format!("Reference pointer was not compiled inside Database graph"),
|
||||
message: format!(
|
||||
"Reference pointer to '{}' was not found in schema registry",
|
||||
ref_str
|
||||
),
|
||||
path: self.path.to_string(),
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user