fixed and tested subschema promotions for beat processing
This commit is contained in:
@ -508,21 +508,24 @@ impl Schema {
|
||||
to_insert: &mut Vec<(String, Arc<Schema>)>,
|
||||
errors: &mut Vec<crate::drop::Error>,
|
||||
) {
|
||||
let mut should_push = false;
|
||||
|
||||
// Push ad-hoc inline composition into the addressable registry
|
||||
if schema_arc.obj.properties.is_some()
|
||||
|| schema_arc.obj.items.is_some()
|
||||
|| schema_arc.obj.family.is_some()
|
||||
|| schema_arc.obj.one_of.is_some()
|
||||
{
|
||||
should_push = true;
|
||||
}
|
||||
|
||||
if let Some(crate::database::object::SchemaTypeOrArray::Single(t)) = &schema_arc.obj.type_ {
|
||||
if !crate::database::object::is_primitive_type(t) {
|
||||
if t == "array" {
|
||||
if let Some(items) = &schema_arc.obj.items {
|
||||
if let Some(crate::database::object::SchemaTypeOrArray::Single(it)) = &items.obj.type_ {
|
||||
if !crate::database::object::is_primitive_type(it) {
|
||||
if items.obj.properties.is_some() || items.obj.cases.is_some() {
|
||||
to_insert.push((path.clone(), Arc::clone(schema_arc)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if !crate::database::object::is_primitive_type(t) {
|
||||
Self::validate_identifier(t, "type", root_id, &path, errors);
|
||||
should_push = true;
|
||||
|
||||
// Is this an explicit inline ad-hoc composition?
|
||||
if schema_arc.obj.properties.is_some() || schema_arc.obj.cases.is_some() {
|
||||
to_insert.push((path.clone(), Arc::clone(schema_arc)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -530,10 +533,6 @@ impl Schema {
|
||||
Self::validate_identifier(family, "$family", root_id, &path, errors);
|
||||
}
|
||||
|
||||
if should_push {
|
||||
to_insert.push((path.clone(), Arc::clone(schema_arc)));
|
||||
}
|
||||
|
||||
Self::collect_child_schemas(schema_arc, root_id, path, to_insert, errors);
|
||||
}
|
||||
|
||||
@ -575,7 +574,9 @@ impl Schema {
|
||||
let mut map_opt = |opt: &Option<Arc<Schema>>, pass_path: bool, sub: &str| {
|
||||
if let Some(v) = opt {
|
||||
if pass_path {
|
||||
Self::collect_schemas(v, root_id, format!("{}/{}", path, sub), to_insert, errors);
|
||||
// Arrays explicitly push their wrapper natively.
|
||||
// 'items' becomes a transparent conduit, bypassing self-promotion and skipping the '/items' suffix.
|
||||
Self::collect_child_schemas(v, root_id, path.clone(), to_insert, errors);
|
||||
} else {
|
||||
Self::collect_child_schemas(v, root_id, format!("{}/{}", path, sub), to_insert, errors);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user