Try not to loose existing children

This commit is contained in:
Timothy Clem 2019-11-18 14:48:24 -08:00
parent 5c72642634
commit c346ce4a5e

View file

@ -615,12 +615,20 @@ pub(crate) fn generate_node_types_json(
.iter()
.map(child_type_to_node_type)
.collect::<Vec<_>>();
let mut multiple = info.children_without_fields.quantity.multiple;
let mut required = info.children_without_fields.quantity.required;
if let Some(children) = &mut node_type_json.children {
println!("children: {:?}", children);
children_types.append(&mut children.types);
multiple |= children.multiple;
required |= children.required;
}
if children_types.len() > 0 {
children_types.sort_unstable();
children_types.dedup();
node_type_json.children = Some(FieldInfoJSON {
multiple: info.children_without_fields.quantity.multiple,
required: info.children_without_fields.quantity.required,
multiple: multiple,
required: required,
types: children_types,
});
}