added realm to jspg processing

This commit is contained in:
2026-04-17 18:25:14 -04:00
parent 8ebf6a69bf
commit f450f8ab8b
59 changed files with 3884 additions and 2194 deletions

View File

@ -1,6 +1,7 @@
use crate::validator::context::ValidationContext;
use crate::validator::error::ValidationError;
use crate::validator::result::ValidationResult;
use crate::database::realm::SchemaRealm;
impl<'a> ValidationContext<'a> {
pub(crate) fn validate_family(
@ -99,8 +100,8 @@ impl<'a> ValidationContext<'a> {
if let Some(val) = instance_val {
if let Some((idx_opt, target_id_opt)) = options.get(&val) {
if let Some(target_id) = target_id_opt {
if let Some(target_schema) = self.db.schemas.get(target_id) {
let derived = self.derive_for_schema(target_schema.as_ref(), false);
if let Some(target_schema) = self.db.get_scoped_schema(SchemaRealm::Type, target_id) {
let derived = self.derive_for_schema(&target_schema, false);
let sub_res = derived.validate()?;
let is_valid = sub_res.is_valid();
result.merge(sub_res);
@ -221,21 +222,21 @@ impl<'a> ValidationContext<'a> {
}
for t in custom_types {
if let Some(global_schema) = self.db.schemas.get(&t) {
if let Some(global_schema) = self.db.get_scoped_schema(SchemaRealm::Type, &t) {
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,
&global_schema,
self.instance,
&self.path,
new_overrides,
self.extensible,
true, // Reporter mode
);
shadow.root = global_schema;
shadow.root = &global_schema;
result.merge(shadow.validate()?);
} else {
result.errors.push(ValidationError {